Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: net/disk_cache/simple/simple_entry_impl.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 21 matching lines...) Expand all
32 namespace disk_cache { 32 namespace disk_cache {
33 33
34 class SimpleBackendImpl; 34 class SimpleBackendImpl;
35 class SimpleSynchronousEntry; 35 class SimpleSynchronousEntry;
36 class SimpleEntryStat; 36 class SimpleEntryStat;
37 struct SimpleEntryCreationResults; 37 struct SimpleEntryCreationResults;
38 38
39 // SimpleEntryImpl is the IO thread interface to an entry in the very simple 39 // SimpleEntryImpl is the IO thread interface to an entry in the very simple
40 // disk cache. It proxies for the SimpleSynchronousEntry, which performs IO 40 // disk cache. It proxies for the SimpleSynchronousEntry, which performs IO
41 // on the worker thread. 41 // on the worker thread.
42 class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, 42 class NET_EXPORT_PRIVATE SimpleEntryImpl
43 public base::RefCounted<SimpleEntryImpl>, 43 : public Entry,
44 public base::SupportsWeakPtr<SimpleEntryImpl> { 44 public base::RefCounted<SimpleEntryImpl>,
45 public base::SupportsWeakPtr<SimpleEntryImpl> {
45 friend class base::RefCounted<SimpleEntryImpl>; 46 friend class base::RefCounted<SimpleEntryImpl>;
47
46 public: 48 public:
47 enum OperationsMode { 49 enum OperationsMode {
48 NON_OPTIMISTIC_OPERATIONS, 50 NON_OPTIMISTIC_OPERATIONS,
49 OPTIMISTIC_OPERATIONS, 51 OPTIMISTIC_OPERATIONS,
50 }; 52 };
51 53
52 SimpleEntryImpl(net::CacheType cache_type, 54 SimpleEntryImpl(net::CacheType cache_type,
53 const base::FilePath& path, 55 const base::FilePath& path,
54 uint64 entry_hash, 56 uint64 entry_hash,
55 OperationsMode operations_mode, 57 OperationsMode operations_mode,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 scoped_ptr<int> result); 258 scoped_ptr<int> result);
257 259
258 // Called after an asynchronous doom completes. 260 // Called after an asynchronous doom completes.
259 void DoomOperationComplete(const CompletionCallback& callback, 261 void DoomOperationComplete(const CompletionCallback& callback,
260 State state_to_restore, 262 State state_to_restore,
261 int result); 263 int result);
262 264
263 // Called after validating the checksums on an entry. Passes through the 265 // Called after validating the checksums on an entry. Passes through the
264 // original result if successful, propogates the error if the checksum does 266 // original result if successful, propogates the error if the checksum does
265 // not validate. 267 // not validate.
266 void ChecksumOperationComplete( 268 void ChecksumOperationComplete(int stream_index,
267 int stream_index, 269 int orig_result,
268 int orig_result, 270 const CompletionCallback& completion_callback,
269 const CompletionCallback& completion_callback, 271 scoped_ptr<int> result);
270 scoped_ptr<int> result);
271 272
272 // Called after completion of asynchronous IO and receiving file metadata for 273 // Called after completion of asynchronous IO and receiving file metadata for
273 // the entry in |entry_stat|. Updates the metadata in the entry and in the 274 // the entry in |entry_stat|. Updates the metadata in the entry and in the
274 // index to make them available on next IO operations. 275 // index to make them available on next IO operations.
275 void UpdateDataFromEntryStat(const SimpleEntryStat& entry_stat); 276 void UpdateDataFromEntryStat(const SimpleEntryStat& entry_stat);
276 277
277 int64 GetDiskUsage() const; 278 int64 GetDiskUsage() const;
278 279
279 // Used to report histograms. 280 // Used to report histograms.
280 void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const; 281 void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const;
281 void RecordWriteDependencyType(const SimpleEntryOperation& operation) const; 282 void RecordWriteDependencyType(const SimpleEntryOperation& operation) const;
282 283
283 // Reads from the stream 0 data kept in memory. 284 // Reads from the stream 0 data kept in memory.
284 int ReadStream0Data(net::IOBuffer* buf, int offset, int buf_len); 285 int ReadStream0Data(net::IOBuffer* buf, int offset, int buf_len);
285 286
286 // Copies data from |buf| to the internal in-memory buffer for stream 0. If 287 // Copies data from |buf| to the internal in-memory buffer for stream 0. If
287 // |truncate| is set to true, the target buffer will be truncated at |offset| 288 // |truncate| is set to true, the target buffer will be truncated at |offset|
288 // + |buf_len| before being written. 289 // + |buf_len| before being written.
289 int SetStream0Data(net::IOBuffer* buf, 290 int SetStream0Data(net::IOBuffer* buf,
290 int offset, int buf_len, 291 int offset,
292 int buf_len,
291 bool truncate); 293 bool truncate);
292 294
293 // Updates |crc32s_| and |crc32s_end_offset_| for a write of the data in 295 // Updates |crc32s_| and |crc32s_end_offset_| for a write of the data in
294 // |buffer| on |stream_index|, starting at |offset| and of length |length|. 296 // |buffer| on |stream_index|, starting at |offset| and of length |length|.
295 void AdvanceCrc(net::IOBuffer* buffer, 297 void AdvanceCrc(net::IOBuffer* buffer,
296 int offset, 298 int offset,
297 int length, 299 int length,
298 int stream_index); 300 int stream_index);
299 301
300 // All nonstatic SimpleEntryImpl methods should always be called on the IO 302 // All nonstatic SimpleEntryImpl methods should always be called on the IO
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // 1 on disk, to reduce the number of file descriptors and save disk space. 365 // 1 on disk, to reduce the number of file descriptors and save disk space.
364 // This strategy allows stream 1 to change size easily. Since stream 0 is only 366 // This strategy allows stream 1 to change size easily. Since stream 0 is only
365 // used to write HTTP headers, the memory consumption of keeping it in memory 367 // used to write HTTP headers, the memory consumption of keeping it in memory
366 // is acceptable. 368 // is acceptable.
367 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; 369 scoped_refptr<net::GrowableIOBuffer> stream_0_data_;
368 }; 370 };
369 371
370 } // namespace disk_cache 372 } // namespace disk_cache
371 373
372 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 374 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698