format code: blank lines

This commit is contained in:
2015-01-18 21:32:37 +01:00
parent 6ffcca82e7
commit ade56d45a2
640 changed files with 12702 additions and 3882 deletions
+17 -4
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -26,18 +26,31 @@ import java.io.InputStream;
public class BlockFileHeader {
protected static final int kBlockHeaderSize = 8192; // Two pages: almost 64k entries
private static final int kMaxBlocks = (kBlockHeaderSize - 80) * 8;
private final long magic; // c3 ca 04 c1
private final long magic; // c3 ca 04 c1
private final long version; // 00 00 02 00
private final int this_file;
private final int next_file;
private final int entry_size;
private final int num_entries;
private final int max_entries;
private int empty[] = new int[4];
private int hints[] = new int[4];
private final int updating;
private int user[] = new int[5];
private final long allocation_map[];
public BlockFileHeader(InputStream is) throws IOException {
+32 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -30,34 +30,63 @@ import java.util.Map;
public class CacheAddr {
private static final int EXTERNAL = 0;
private static final int RANKINGS = 1;
private static final int BLOCK_256 = 2;
private static final int BLOCK_1K = 3;
private static final int BLOCK_4K = 4;
private static final int BLOCK_FILES = 5;
private static final int BLOCK_ENTRIES = 6;
private static final int BLOCK_EVICTED = 7;
private static final String blockNames[] = new String[]{"EXTERNAL", "RANKINGS", "BLOCK_256", "BLOCK_1K", "BLOCK_4K", "BLOCK_FILES", "BLOCK_ENTRIES", "BLOCK_EVICTED"};
private static final int blockSizes[] = new int[]{0, 36, 256, 1024, 4096, 8, 104, 48};
private static final long kInitializedMask = 0x80000000L;
private static final long kFileTypeMask = 0x70000000L;
private static final int kFileTypeOffset = 28;
private static final long kReservedBitsMask = 0x0c000000L;
private static final long kNumBlocksMask = 0x03000000L;
private static final int kNumBlocksOffset = 24;
private static final long kFileSelectorMask = 0x00ff0000L;
private static final int FileSelectorOffset = 16;
private static final long kStartBlockMask = 0x0000FFFFL;
private static final long kFileNameMask = 0x0FFFFFFFL;
private final boolean initialized;
private final int fileType;
private int numBlocks;
private int fileSelector;
private int startBlock;
private int fileName;
private final long val;
private final File rootPath;
private final Map<Integer, RandomAccessFile> dataFiles;
private final File externalFilesDir;
public CacheAddr(InputStream is, File rootPath, Map<Integer, RandomAccessFile> dataFiles, File externalFilesDir) throws IOException {
+8 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -36,8 +36,11 @@ import java.util.logging.Logger;
public class ChromeCache implements CacheImplementation {
private static ChromeCache instance;
private File tempDir;
private List<File> dataFiles;
private File indexFile;
private ChromeCache() {
@@ -55,7 +58,9 @@ public class ChromeCache implements CacheImplementation {
}
return instance;
}
private boolean loaded = false;
private Index index;
@Override
+4 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -23,5 +23,6 @@ package com.jpexs.browsers.cache.chrome;
public class EntryFlags {
public static final int PARENT_ENTRY = 1;
public static final int CHILD_ENTRY = 1 << 1;
}
+5 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -23,6 +23,8 @@ package com.jpexs.browsers.cache.chrome;
public class EntryState {
public static final int ENTRY_NORMAL = 0;
public static final int ENTRY_EVICTED = 1;
public static final int ENTRY_DOOMED = 2;
}
+22 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -34,24 +34,43 @@ import java.util.logging.Logger;
public class EntryStore extends CacheEntry {
public static final int ENTRY_NORMAL = 0;
public static final int ENTRY_EVICTED = 1; // The entry was recently evicted from the cache.
public static final int ENTRY_DOOMED = 2; // The entry was doomed
public static final int PARENT_ENTRY = 1; // This entry has children (sparse) entries.
public static final int CHILD_ENTRY = 1 << 1;
public long hash; // Full hash of the key.
public CacheAddr next; // Next entry with the same hash or bucket.
public CacheAddr rankings_node; // Rankings node for this entry.
public int reuse_count; // How often is this entry used.
public int refetch_count; // How often is this fetched from the net.
public int state; // Current state.
public long creation_time;
public int key_len;
public CacheAddr long_key; // Optional address of a long key.
public int data_size[] = new int[4]; // We can store up to 4 data streams for each
public CacheAddr data_addr[] = new CacheAddr[4]; // entry.
public long flags; // Any combination of EntryFlags.
public int pad[] = new int[4];
public long self_hash; // The hash of EntryStore up to this point.
public byte key[] = new byte[256 - 24 * 4]; // null terminated
public EntryStore(InputStream is, File rootDir, Map<Integer, RandomAccessFile> dataFiles, File externalFilesDir) throws IOException {
+23 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -28,44 +28,64 @@ import java.util.List;
public class HttpResponseInfo {
public long flags;
public int version;
public long request_time;
public long response_time;
public long payload_size;
public List<String> headers;
// The version of the response info used when persisting response info.
public static final int RESPONSE_INFO_VERSION = 3;
// The minimum version supported for deserializing response info.
public static final int RESPONSE_INFO_MINIMUM_VERSION = 1;
// We reserve up to 8 bits for the version number.
public static final int RESPONSE_INFO_VERSION_MASK = 0xFF;
// This bit is set if the response info has a cert at the end.
// Version 1 serialized only the end-entity certificate, while subsequent
// versions include the available certificate chain.
public static final int RESPONSE_INFO_HAS_CERT = 1 << 8;
// This bit is set if the response info has a security-bits field (security
// strength, in bits, of the SSL connection) at the end.
public static final int RESPONSE_INFO_HAS_SECURITY_BITS = 1 << 9;
// This bit is set if the response info has a cert status at the end.
public static final int RESPONSE_INFO_HAS_CERT_STATUS = 1 << 10;
// This bit is set if the response info has vary header data.
public static final int RESPONSE_INFO_HAS_VARY_DATA = 1 << 11;
// This bit is set if the request was cancelled before completion.
public static final int RESPONSE_INFO_TRUNCATED = 1 << 12;
// This bit is set if the response was received via SPDY.
public static final int RESPONSE_INFO_WAS_SPDY = 1 << 13;
// This bit is set if the request has NPN negotiated.
public static final int RESPONSE_INFO_WAS_NPN = 1 << 14;
// This bit is set if the request was fetched via an explicit proxy.
public static final int RESPONSE_INFO_WAS_PROXY = 1 << 15;
// This bit is set if the response info has an SSL connection status field.
// This contains the ciphersuite used to fetch the resource as well as the
// protocol version, compression method and whether SSLv3 fallback was used.
public static final int RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS = 1 << 16;
// This bit is set if the response info has protocol version.
public static final int RESPONSE_INFO_HAS_NPN_NEGOTIATED_PROTOCOL = 1 << 17;
// This bit is set if the response info has connection info.
public static final int RESPONSE_INFO_HAS_CONNECTION_INFO = 1 << 18;
// This bit is set if the request has http authentication.
public static final int RESPONSE_INFO_USE_HTTP_AUTHENTICATION = 1 << 19;
+8 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -33,10 +33,15 @@ import java.util.Map;
public class Index {
IndexHeader header;
CacheAddr table[];
public static final int kIndexTablesize = 0x10000;
public File rootDir;
private final Map<Integer, RandomAccessFile> dataFiles;
private final File externalFilesDir;
public void free() {
+15 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -29,17 +29,29 @@ import java.util.Map;
public class IndexHeader {
long magic; //c3 ca 03 c1
long version; //01 00 02 00
int num_entries;
int num_bytes;
int last_file;
int this_id;
CacheAddr stats;
int table_len;
int crash;
int experiment;
long create_time;
int pad[] = new int[52];
LruData lru;
public IndexHeader(InputStream is, File rootDir, Map<Integer, RandomAccessFile> dataFiles, File externalFilesDir) throws IOException {
+4 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -26,6 +26,7 @@ import java.io.InputStream;
public class IndexInputStream extends InputStream {
private final InputStream is;
public long pos = 0;
public long getPos() {
+11 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -29,13 +29,21 @@ import java.util.Map;
public class LruData {
int pad1[] = new int[2];
int filled;
int sizes[] = new int[5];
CacheAddr heads[] = new CacheAddr[5];
CacheAddr tails[] = new CacheAddr[5];
CacheAddr transaction;
int operation;
int operation_list;
int pad2[] = new int[7];
public LruData(InputStream is, File rootDir, Map<Integer, RandomAccessFile> dataFiles, File externalFilesDir) throws IOException {
+9 -3
View File
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -23,10 +23,16 @@ package com.jpexs.browsers.cache.chrome;
public class RankingsNode {
public long last_used;
public long last_modified;
CacheAddr next;
CacheAddr prev;
CacheAddr contents;
int dirty;
long self_hash;
}