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 ae80681d429dbad1886bcf593ae562515595d408..6b748f283a106f23798bc26ef42c7d218b16f33d 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" |
@@ -33,7 +34,7 @@ struct SimpleEntryStat { |
base::Time last_used; |
base::Time last_modified; |
- int32 data_size[kSimpleEntryFileCount]; |
+ int32 data_size[kSimpleEntryStreamCount]; |
}; |
struct SimpleEntryCreationResults { |
@@ -41,6 +42,7 @@ struct SimpleEntryCreationResults { |
~SimpleEntryCreationResults(); |
SimpleSynchronousEntry* sync_entry; |
+ scoped_refptr<net::IOBuffer> stream_0_data; |
SimpleEntryStat entry_stat; |
int result; |
}; |
@@ -104,21 +106,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 int data_size[], |
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::IOBuffer* stream_0_data); |
const base::FilePath& path() const { return path_; } |
std::string key() const { return key_; } |
@@ -142,7 +145,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::IOBuffer>* 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 |
@@ -150,6 +155,17 @@ class SimpleSynchronousEntry { |
// create operation began. |
int InitializeForCreate(bool had_index, SimpleEntryStat* out_entry_stat); |
+ // Allocates and fill a buffer with stream 0 data in |stream_0_data|, then |
pasko
2013/09/09 20:01:22
s/fill/fills/
s/checks it/checks its/
clamy
2013/09/10 14:35:59
Done.
|
+ // checks it crc32. |
+ int ReadAndValidateStream0(int data_size[], |
+ scoped_refptr<net::IOBuffer>* stream_0_data) const; |
+ |
+ // Writes the header for an entry. |
+ int WriteHeader(int file_index, int stream_0_size, int stream_1_size) const; |
+ |
+ int CheckEOFRecordInternal(int index, |
+ const int data_size[], |
+ uint32 expected_crc32) const; |
void Doom() const; |
static bool DeleteFilesForEntryHash(const base::FilePath& path, |