| Index: net/disk_cache/simple/simple_synchronous_entry.h
|
| diff --git a/net/disk_cache/simple/simple_synchronous_entry.h b/net/disk_cache/simple/simple_synchronous_entry.h
|
| index 7f98b21ceaa42c26bcc8128a49fe9fea5234d3a7..6386a451235a4f3b7449e2163872cb7a3eac22ad 100644
|
| --- a/net/disk_cache/simple/simple_synchronous_entry.h
|
| +++ b/net/disk_cache/simple/simple_synchronous_entry.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_
|
| #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_
|
|
|
| +#include <stdint.h>
|
| +
|
| #include <algorithm>
|
| #include <map>
|
| #include <string>
|
| @@ -36,15 +38,15 @@ class NET_EXPORT_PRIVATE SimpleEntryStat {
|
| public:
|
| SimpleEntryStat(base::Time last_used,
|
| base::Time last_modified,
|
| - const int32 data_size[],
|
| - const int32 sparse_data_size);
|
| + const int32_t data_size[],
|
| + const int32_t sparse_data_size);
|
|
|
| int GetOffsetInFile(const std::string& key,
|
| int offset,
|
| int stream_index) const;
|
| int GetEOFOffsetInFile(const std::string& key, int stream_index) const;
|
| int GetLastEOFOffsetInFile(const std::string& key, int file_index) const;
|
| - int64 GetFileSize(const std::string& key, int file_index) const;
|
| + int64_t GetFileSize(const std::string& key, int file_index) const;
|
|
|
| base::Time last_used() const { return last_used_; }
|
| base::Time last_modified() const { return last_modified_; }
|
| @@ -53,21 +55,21 @@ class NET_EXPORT_PRIVATE SimpleEntryStat {
|
| last_modified_ = last_modified;
|
| }
|
|
|
| - int32 data_size(int stream_index) const { return data_size_[stream_index]; }
|
| + int32_t data_size(int stream_index) const { return data_size_[stream_index]; }
|
| void set_data_size(int stream_index, int data_size) {
|
| data_size_[stream_index] = data_size;
|
| }
|
|
|
| - int32 sparse_data_size() const { return sparse_data_size_; }
|
| - void set_sparse_data_size(int32 sparse_data_size) {
|
| + int32_t sparse_data_size() const { return sparse_data_size_; }
|
| + void set_sparse_data_size(int32_t sparse_data_size) {
|
| sparse_data_size_ = sparse_data_size;
|
| }
|
|
|
| private:
|
| base::Time last_used_;
|
| base::Time last_modified_;
|
| - int32 data_size_[kSimpleEntryStreamCount];
|
| - int32 sparse_data_size_;
|
| + int32_t data_size_[kSimpleEntryStreamCount];
|
| + int32_t sparse_data_size_;
|
| };
|
|
|
| struct SimpleEntryCreationResults {
|
| @@ -77,7 +79,7 @@ struct SimpleEntryCreationResults {
|
| SimpleSynchronousEntry* sync_entry;
|
| scoped_refptr<net::GrowableIOBuffer> stream_0_data;
|
| SimpleEntryStat entry_stat;
|
| - uint32 stream_0_crc32;
|
| + uint32_t stream_0_crc32;
|
| int result;
|
| };
|
|
|
| @@ -88,11 +90,11 @@ class SimpleSynchronousEntry {
|
| public:
|
| struct CRCRecord {
|
| CRCRecord();
|
| - CRCRecord(int index_p, bool has_crc32_p, uint32 data_crc32_p);
|
| + CRCRecord(int index_p, bool has_crc32_p, uint32_t data_crc32_p);
|
|
|
| int index;
|
| bool has_crc32;
|
| - uint32 data_crc32;
|
| + uint32_t data_crc32;
|
| };
|
|
|
| struct EntryOperationData {
|
| @@ -102,11 +104,11 @@ class SimpleSynchronousEntry {
|
| int buf_len_p,
|
| bool truncate_p,
|
| bool doomed_p);
|
| - EntryOperationData(int64 sparse_offset_p, int buf_len_p);
|
| + EntryOperationData(int64_t sparse_offset_p, int buf_len_p);
|
|
|
| int index;
|
| int offset;
|
| - int64 sparse_offset;
|
| + int64_t sparse_offset;
|
| int buf_len;
|
| bool truncate;
|
| bool doomed;
|
| @@ -114,33 +116,32 @@ class SimpleSynchronousEntry {
|
|
|
| static void OpenEntry(net::CacheType cache_type,
|
| const base::FilePath& path,
|
| - uint64 entry_hash,
|
| + uint64_t entry_hash,
|
| bool had_index,
|
| SimpleEntryCreationResults* out_results);
|
|
|
| static void CreateEntry(net::CacheType cache_type,
|
| const base::FilePath& path,
|
| const std::string& key,
|
| - uint64 entry_hash,
|
| + uint64_t entry_hash,
|
| bool had_index,
|
| SimpleEntryCreationResults* out_results);
|
|
|
| // Deletes an entry from the file system without affecting the state of the
|
| // corresponding instance, if any (allowing operations to continue to be
|
| // executed through that instance). Returns a net error code.
|
| - static int DoomEntry(const base::FilePath& path,
|
| - uint64 entry_hash);
|
| + static int DoomEntry(const base::FilePath& path, uint64_t entry_hash);
|
|
|
| // Like |DoomEntry()| above. Deletes all entries corresponding to the
|
| // |key_hashes|. Succeeds only when all entries are deleted. Returns a net
|
| // error code.
|
| - static int DoomEntrySet(const std::vector<uint64>* key_hashes,
|
| + static int DoomEntrySet(const std::vector<uint64_t>* key_hashes,
|
| const base::FilePath& path);
|
|
|
| // N.B. ReadData(), WriteData(), CheckEOFRecord() and Close() may block on IO.
|
| void ReadData(const EntryOperationData& in_entry_op,
|
| net::IOBuffer* out_buf,
|
| - uint32* out_crc32,
|
| + uint32_t* out_crc32,
|
| SimpleEntryStat* entry_stat,
|
| int* out_result) const;
|
| void WriteData(const EntryOperationData& in_entry_op,
|
| @@ -149,7 +150,7 @@ class SimpleSynchronousEntry {
|
| int* out_result);
|
| void CheckEOFRecord(int index,
|
| const SimpleEntryStat& entry_stat,
|
| - uint32 expected_crc32,
|
| + uint32_t expected_crc32,
|
| int* out_result) const;
|
|
|
| void ReadSparseData(const EntryOperationData& in_entry_op,
|
| @@ -158,11 +159,11 @@ class SimpleSynchronousEntry {
|
| int* out_result);
|
| void WriteSparseData(const EntryOperationData& in_entry_op,
|
| net::IOBuffer* in_buf,
|
| - uint64 max_sparse_data_size,
|
| + uint64_t max_sparse_data_size,
|
| SimpleEntryStat* out_entry_stat,
|
| int* out_result);
|
| void GetAvailableRange(const EntryOperationData& in_entry_op,
|
| - int64* out_start,
|
| + int64_t* out_start,
|
| int* out_result);
|
|
|
| // Close all streams, and add write EOF records to streams indicated by the
|
| @@ -189,21 +190,20 @@ class SimpleSynchronousEntry {
|
| };
|
|
|
| struct SparseRange {
|
| - int64 offset;
|
| - int64 length;
|
| - uint32 data_crc32;
|
| - int64 file_offset;
|
| + int64_t offset;
|
| + int64_t length;
|
| + uint32_t data_crc32;
|
| + int64_t file_offset;
|
|
|
| bool operator<(const SparseRange& other) const {
|
| return offset < other.offset;
|
| }
|
| };
|
|
|
| - SimpleSynchronousEntry(
|
| - net::CacheType cache_type,
|
| - const base::FilePath& path,
|
| - const std::string& key,
|
| - uint64 entry_hash);
|
| + SimpleSynchronousEntry(net::CacheType cache_type,
|
| + const base::FilePath& path,
|
| + const std::string& key,
|
| + uint64_t entry_hash);
|
|
|
| // Like Entry, the SimpleSynchronousEntry self releases when Close() is
|
| // called.
|
| @@ -233,7 +233,7 @@ class SimpleSynchronousEntry {
|
| int InitializeForOpen(bool had_index,
|
| SimpleEntryStat* out_entry_stat,
|
| scoped_refptr<net::GrowableIOBuffer>* stream_0_data,
|
| - uint32* out_stream_0_crc32);
|
| + uint32_t* out_stream_0_crc32);
|
|
|
| // Writes the header and key to a newly-created stream file. |index| is the
|
| // index of the stream. Returns true on success; returns false and sets
|
| @@ -252,17 +252,17 @@ class SimpleSynchronousEntry {
|
| int total_data_size,
|
| SimpleEntryStat* out_entry_stat,
|
| scoped_refptr<net::GrowableIOBuffer>* stream_0_data,
|
| - uint32* out_stream_0_crc32) const;
|
| + uint32_t* out_stream_0_crc32) const;
|
|
|
| int GetEOFRecordData(int index,
|
| const SimpleEntryStat& entry_stat,
|
| bool* out_has_crc32,
|
| - uint32* out_crc32,
|
| + uint32_t* out_crc32,
|
| int* out_data_size) const;
|
| void Doom() const;
|
|
|
| // Opens the sparse data file and scans it if it exists.
|
| - bool OpenSparseFileIfExists(int32* out_sparse_data_size);
|
| + bool OpenSparseFileIfExists(int32_t* out_sparse_data_size);
|
|
|
| // Creates and initializes the sparse data file.
|
| bool CreateSparseFile();
|
| @@ -279,7 +279,7 @@ class SimpleSynchronousEntry {
|
| // Scans the existing ranges in the sparse file. Populates |sparse_ranges_|
|
| // and sets |*out_sparse_data_size| to the total size of all the ranges (not
|
| // including headers).
|
| - bool ScanSparseFile(int32* out_sparse_data_size);
|
| + bool ScanSparseFile(int32_t* out_sparse_data_size);
|
|
|
| // Reads from a single sparse range. If asked to read the entire range, also
|
| // verifies the CRC32.
|
| @@ -292,13 +292,13 @@ class SimpleSynchronousEntry {
|
| int offset, int len, const char* buf);
|
|
|
| // Appends a new sparse range to the sparse data file.
|
| - bool AppendSparseRange(int64 offset, int len, const char* buf);
|
| + bool AppendSparseRange(int64_t offset, int len, const char* buf);
|
|
|
| static bool DeleteFileForEntryHash(const base::FilePath& path,
|
| - uint64 entry_hash,
|
| + uint64_t entry_hash,
|
| int file_index);
|
| static bool DeleteFilesForEntryHash(const base::FilePath& path,
|
| - uint64 entry_hash);
|
| + uint64_t entry_hash);
|
|
|
| void RecordSyncCreateResult(CreateEntryResult result, bool had_index);
|
|
|
| @@ -310,7 +310,7 @@ class SimpleSynchronousEntry {
|
|
|
| const net::CacheType cache_type_;
|
| const base::FilePath path_;
|
| - const uint64 entry_hash_;
|
| + const uint64_t entry_hash_;
|
| std::string key_;
|
|
|
| bool have_open_files_;
|
| @@ -322,13 +322,13 @@ class SimpleSynchronousEntry {
|
| // was created to store it.
|
| bool empty_file_omitted_[kSimpleEntryFileCount];
|
|
|
| - typedef std::map<int64, SparseRange> SparseRangeOffsetMap;
|
| + typedef std::map<int64_t, SparseRange> SparseRangeOffsetMap;
|
| typedef SparseRangeOffsetMap::iterator SparseRangeIterator;
|
| SparseRangeOffsetMap sparse_ranges_;
|
| base::File sparse_file_;
|
| // Offset of the end of the sparse file (where the next sparse range will be
|
| // written).
|
| - int64 sparse_tail_offset_;
|
| + int64_t sparse_tail_offset_;
|
|
|
| // True if the entry was created, or false if it was opened. Used to log
|
| // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries.
|
|
|