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

Side by Side Diff: net/disk_cache/mapped_file.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « net/disk_cache/file.h ('k') | net/http/infinite_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // See net/disk_cache/disk_cache.h for the public interface of the cache. 5 // See net/disk_cache/disk_cache.h for the public interface of the cache.
6 6
7 #ifndef NET_DISK_CACHE_MAPPED_FILE_H_ 7 #ifndef NET_DISK_CACHE_MAPPED_FILE_H_
8 #define NET_DISK_CACHE_MAPPED_FILE_H_ 8 #define NET_DISK_CACHE_MAPPED_FILE_H_
9 9
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
11 #include "net/disk_cache/disk_format.h" 11 #include "net/disk_cache/disk_format.h"
12 #include "net/disk_cache/file.h" 12 #include "net/disk_cache/file.h"
13 #include "net/disk_cache/file_block.h" 13 #include "net/disk_cache/file_block.h"
14 14
15 namespace base {
15 class FilePath; 16 class FilePath;
17 }
16 18
17 namespace disk_cache { 19 namespace disk_cache {
18 20
19 // This class implements a memory mapped file used to access block-files. The 21 // This class implements a memory mapped file used to access block-files. The
20 // idea is that the header and bitmap will be memory mapped all the time, and 22 // idea is that the header and bitmap will be memory mapped all the time, and
21 // the actual data for the blocks will be access asynchronously (most of the 23 // the actual data for the blocks will be access asynchronously (most of the
22 // time). 24 // time).
23 class NET_EXPORT_PRIVATE MappedFile : public File { 25 class NET_EXPORT_PRIVATE MappedFile : public File {
24 public: 26 public:
25 MappedFile() : File(true), init_(false) {} 27 MappedFile() : File(true), init_(false) {}
26 28
27 // Performs object initialization. name is the file to use, and size is the 29 // Performs object initialization. name is the file to use, and size is the
28 // amount of data to memory map from the file. If size is 0, the whole file 30 // amount of data to memory map from the file. If size is 0, the whole file
29 // will be mapped in memory. 31 // will be mapped in memory.
30 void* Init(const FilePath& name, size_t size); 32 void* Init(const base::FilePath& name, size_t size);
31 33
32 void* buffer() const { 34 void* buffer() const {
33 return buffer_; 35 return buffer_;
34 } 36 }
35 37
36 // Loads or stores a given block from the backing file (synchronously). 38 // Loads or stores a given block from the backing file (synchronously).
37 bool Load(const FileBlock* block); 39 bool Load(const FileBlock* block);
38 bool Store(const FileBlock* block); 40 bool Store(const FileBlock* block);
39 41
40 // Flush the memory-mapped section to disk (synchronously). 42 // Flush the memory-mapped section to disk (synchronously).
(...skipping 22 matching lines...) Expand all
63 ~ScopedFlush() { 65 ~ScopedFlush() {
64 file_->Flush(); 66 file_->Flush();
65 } 67 }
66 private: 68 private:
67 MappedFile* file_; 69 MappedFile* file_;
68 }; 70 };
69 71
70 } // namespace disk_cache 72 } // namespace disk_cache
71 73
72 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ 74 #endif // NET_DISK_CACHE_MAPPED_FILE_H_
OLDNEW
« no previous file with comments | « net/disk_cache/file.h ('k') | net/http/infinite_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698