OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ | 5 #ifndef NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ |
6 #define NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ | 6 #define NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 // Logs a begin event and enables logging for the EntryImplV3. Will also cause | 71 // Logs a begin event and enables logging for the EntryImplV3. Will also cause |
72 // an end event to be logged on destruction. The EntryImplV3 must have its key | 72 // an end event to be logged on destruction. The EntryImplV3 must have its key |
73 // initialized before this is called. |created| is true if the Entry was | 73 // initialized before this is called. |created| is true if the Entry was |
74 // created rather than opened. | 74 // created rather than opened. |
75 void BeginLogging(net::NetLog* net_log, bool created); | 75 void BeginLogging(net::NetLog* net_log, bool created); |
76 | 76 |
77 const net::BoundNetLog& net_log() const; | 77 const net::BoundNetLog& net_log() const; |
78 | 78 |
79 // Entry interface. | 79 // Entry interface. |
80 virtual void Doom() override; | 80 void Doom() override; |
81 virtual void Close() override; | 81 void Close() override; |
82 virtual std::string GetKey() const override; | 82 std::string GetKey() const override; |
83 virtual base::Time GetLastUsed() const override; | 83 base::Time GetLastUsed() const override; |
84 virtual base::Time GetLastModified() const override; | 84 base::Time GetLastModified() const override; |
85 virtual int32 GetDataSize(int index) const override; | 85 int32 GetDataSize(int index) const override; |
86 virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, | 86 int ReadData(int index, |
87 const CompletionCallback& callback) override; | 87 int offset, |
88 virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len, | 88 IOBuffer* buf, |
89 const CompletionCallback& callback, | 89 int buf_len, |
90 bool truncate) override; | 90 const CompletionCallback& callback) override; |
91 virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len, | 91 int WriteData(int index, |
92 const CompletionCallback& callback) override; | 92 int offset, |
93 virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len, | 93 IOBuffer* buf, |
94 const CompletionCallback& callback) override; | 94 int buf_len, |
95 virtual int GetAvailableRange(int64 offset, int len, int64* start, | 95 const CompletionCallback& callback, |
96 const CompletionCallback& callback) override; | 96 bool truncate) override; |
97 virtual bool CouldBeSparse() const override; | 97 int ReadSparseData(int64 offset, |
98 virtual void CancelSparseIO() override; | 98 IOBuffer* buf, |
99 virtual int ReadyForSparseIO(const CompletionCallback& callback) override; | 99 int buf_len, |
| 100 const CompletionCallback& callback) override; |
| 101 int WriteSparseData(int64 offset, |
| 102 IOBuffer* buf, |
| 103 int buf_len, |
| 104 const CompletionCallback& callback) override; |
| 105 int GetAvailableRange(int64 offset, |
| 106 int len, |
| 107 int64* start, |
| 108 const CompletionCallback& callback) override; |
| 109 bool CouldBeSparse() const override; |
| 110 void CancelSparseIO() override; |
| 111 int ReadyForSparseIO(const CompletionCallback& callback) override; |
100 | 112 |
101 private: | 113 private: |
102 enum { | 114 enum { |
103 kNumStreams = 3 | 115 kNumStreams = 3 |
104 }; | 116 }; |
105 class UserBuffer; | 117 class UserBuffer; |
106 | 118 |
107 virtual ~EntryImplV3(); | 119 ~EntryImplV3() override; |
108 | 120 |
109 // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as | 121 // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as |
110 // separate functions to make logging of results simpler. | 122 // separate functions to make logging of results simpler. |
111 int InternalReadData(int index, int offset, IOBuffer* buf, | 123 int InternalReadData(int index, int offset, IOBuffer* buf, |
112 int buf_len, const CompletionCallback& callback); | 124 int buf_len, const CompletionCallback& callback); |
113 int InternalWriteData(int index, int offset, IOBuffer* buf, int buf_len, | 125 int InternalWriteData(int index, int offset, IOBuffer* buf, int buf_len, |
114 const CompletionCallback& callback, bool truncate); | 126 const CompletionCallback& callback, bool truncate); |
115 | 127 |
116 // Initializes the storage for an internal or external data block. | 128 // Initializes the storage for an internal or external data block. |
117 bool CreateDataBlock(int index, int size); | 129 bool CreateDataBlock(int index, int size); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // scoped_ptr<SparseControlV3> sparse_; // Support for sparse entries. | 211 // scoped_ptr<SparseControlV3> sparse_; // Support for sparse entries. |
200 | 212 |
201 net::BoundNetLog net_log_; | 213 net::BoundNetLog net_log_; |
202 | 214 |
203 DISALLOW_COPY_AND_ASSIGN(EntryImplV3); | 215 DISALLOW_COPY_AND_ASSIGN(EntryImplV3); |
204 }; | 216 }; |
205 | 217 |
206 } // namespace disk_cache | 218 } // namespace disk_cache |
207 | 219 |
208 #endif // NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ | 220 #endif // NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ |
OLD | NEW |