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 f4b5ed81020538c9917f40db4d93a84f7e5d298f..84b49544d8fe724d9786a10980b5bd9da174a3f8 100644 |
--- a/net/disk_cache/simple/simple_synchronous_entry.h |
+++ b/net/disk_cache/simple/simple_synchronous_entry.h |
@@ -11,6 +11,7 @@ |
#include <vector> |
#include "base/files/file_path.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/platform_file.h" |
#include "base/time/time.h" |
@@ -18,6 +19,7 @@ |
#include "net/disk_cache/simple/simple_entry_format.h" |
namespace net { |
+class GrowableIOBuffer; |
class IOBuffer; |
} |
@@ -31,9 +33,16 @@ struct SimpleEntryStat { |
base::Time last_modified_p, |
const int32 data_size_p[]); |
+ 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; |
+ int GetFileSize(const std::string& key, int file_index) const; |
+ |
base::Time last_used; |
base::Time last_modified; |
- int32 data_size[kSimpleEntryFileCount]; |
+ int32 data_size[kSimpleEntryStreamCount]; |
}; |
struct SimpleEntryCreationResults { |
@@ -41,6 +50,7 @@ struct SimpleEntryCreationResults { |
~SimpleEntryCreationResults(); |
SimpleSynchronousEntry* sync_entry; |
+ scoped_refptr<net::GrowableIOBuffer> stream_0_data; |
SimpleEntryStat entry_stat; |
int result; |
}; |
@@ -102,21 +112,22 @@ class SimpleSynchronousEntry { |
void ReadData(const EntryOperationData& in_entry_op, |
net::IOBuffer* out_buf, |
uint32* out_crc32, |
- base::Time* out_last_used, |
+ SimpleEntryStat* out_entry_stat, |
int* out_result) const; |
void WriteData(const EntryOperationData& in_entry_op, |
net::IOBuffer* in_buf, |
SimpleEntryStat* out_entry_stat, |
int* out_result) const; |
void CheckEOFRecord(int index, |
- int data_size, |
+ const SimpleEntryStat& entry_stat, |
uint32 expected_crc32, |
int* out_result) const; |
// Close all streams, and add write EOF records to streams indicated by the |
// CRCRecord entries in |crc32s_to_write|. |
void Close(const SimpleEntryStat& entry_stat, |
- scoped_ptr<std::vector<CRCRecord> > crc32s_to_write); |
+ scoped_ptr<std::vector<CRCRecord> > crc32s_to_write, |
+ net::GrowableIOBuffer* stream_0_data); |
const base::FilePath& path() const { return path_; } |
std::string key() const { return key_; } |
@@ -140,7 +151,9 @@ class SimpleSynchronousEntry { |
// Returns a net error, i.e. net::OK on success. |had_index| is passed |
// from the main entry for metrics purposes, and is true if the index was |
// initialized when the open operation began. |
- int InitializeForOpen(bool had_index, SimpleEntryStat* out_entry_stat); |
+ int InitializeForOpen(bool had_index, |
+ SimpleEntryStat* out_entry_stat, |
+ scoped_refptr<net::GrowableIOBuffer>* stream_0_data); |
// Returns a net error, including net::OK on success and net::FILE_EXISTS |
// when the entry already exists. |had_index| is passed from the main entry |
@@ -148,6 +161,18 @@ class SimpleSynchronousEntry { |
// create operation began. |
int InitializeForCreate(bool had_index, SimpleEntryStat* out_entry_stat); |
+ // Allocates and fills a buffer with stream 0 data in |stream_0_data|, then |
+ // checks its crc32. |
+ int ReadAndValidateStream0( |
+ int total_data_size, |
+ SimpleEntryStat* out_entry_stat, |
+ scoped_refptr<net::GrowableIOBuffer>* stream_0_data) const; |
+ |
+ int GetEOFRecordData(int index, |
+ const SimpleEntryStat& entry_stat, |
+ bool* out_has_crc32, |
+ uint32* out_crc32, |
+ int* out_data_size) const; |
void Doom() const; |
static bool DeleteFilesForEntryHash(const base::FilePath& path, |