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

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

Issue 206453003: Move Preload() code to MappedFile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New attempt Created 6 years, 9 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
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_BLOCKFILE_MAPPED_FILE_H_ 7 #ifndef NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_
8 #define NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_ 8 #define NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_
9 9
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 28 matching lines...) Expand all
39 bool Store(const FileBlock* block); 39 bool Store(const FileBlock* block);
40 40
41 // Asynchronous versions of Load/Store, following the semantics of File::Read 41 // Asynchronous versions of Load/Store, following the semantics of File::Read
42 // and File::Write. 42 // and File::Write.
43 bool Load(const FileBlock* block, FileIOCallback* callback, bool* completed); 43 bool Load(const FileBlock* block, FileIOCallback* callback, bool* completed);
44 bool Store(const FileBlock* block, FileIOCallback* callback, bool* completed); 44 bool Store(const FileBlock* block, FileIOCallback* callback, bool* completed);
45 45
46 // Flush the memory-mapped section to disk (synchronously). 46 // Flush the memory-mapped section to disk (synchronously).
47 void Flush(); 47 void Flush();
48 48
49 // Heats up the file cache and make sure the file is fully readable
50 // (synchronously).
51 bool Preload();
gavinp 2014/03/21 10:20:24 Are there any MappedFile instances that we do not
52
49 private: 53 private:
50 virtual ~MappedFile(); 54 virtual ~MappedFile();
51 55
52 bool init_; 56 bool init_;
53 #if defined(OS_WIN) 57 #if defined(OS_WIN)
54 HANDLE section_; 58 HANDLE section_;
55 #endif 59 #endif
56 void* buffer_; // Address of the memory mapped buffer. 60 void* buffer_; // Address of the memory mapped buffer.
57 size_t view_size_; // Size of the memory pointed by buffer_. 61 size_t view_size_; // Size of the memory pointed by buffer_.
58 #if defined(POSIX_AVOID_MMAP) 62 #if defined(POSIX_AVOID_MMAP)
(...skipping 10 matching lines...) Expand all
69 ~ScopedFlush() { 73 ~ScopedFlush() {
70 file_->Flush(); 74 file_->Flush();
71 } 75 }
72 private: 76 private:
73 MappedFile* file_; 77 MappedFile* file_;
74 }; 78 };
75 79
76 } // namespace disk_cache 80 } // namespace disk_cache
77 81
78 #endif // NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_ 82 #endif // NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698