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

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

Issue 15563005: **STILLBAKING** Switch SimpleCache to SequencedWorkerPool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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_SYNCHRONOUS_ENTRY_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 struct CRCRecord { 30 struct CRCRecord {
31 CRCRecord(); 31 CRCRecord();
32 CRCRecord(int index_p, bool has_crc32_p, uint32 data_crc32_p); 32 CRCRecord(int index_p, bool has_crc32_p, uint32 data_crc32_p);
33 33
34 int index; 34 int index;
35 bool has_crc32; 35 bool has_crc32;
36 uint32 data_crc32; 36 uint32 data_crc32;
37 }; 37 };
38 38
39 static void OpenEntry( 39 SimpleSynchronousEntry(
40 const base::FilePath& path,
41 const std::string& key,
42 uint64 entry_hash);
43
44 ~SimpleSynchronousEntry();
45
46 void OpenEntry(
40 const base::FilePath& path, 47 const base::FilePath& path,
41 const std::string& key, 48 const std::string& key,
42 uint64 entry_hash, 49 uint64 entry_hash,
43 SimpleSynchronousEntry** out_entry,
44 int* out_result); 50 int* out_result);
45 51
46 static void CreateEntry( 52 void CreateEntry(
47 const base::FilePath& path, 53 const base::FilePath& path,
48 const std::string& key, 54 const std::string& key,
49 uint64 entry_hash, 55 uint64 entry_hash,
50 SimpleSynchronousEntry** out_entry,
51 int* out_result); 56 int* out_result);
52 57
53 // Deletes an entry without first Opening it. Does not check if there is 58 // Deletes an entry without first Opening it. Does not check if there is
54 // already an Entry object in memory holding the open files. Be careful! This 59 // already an Entry object in memory holding the open files. Be careful! This
55 // is meant to be used by the Backend::DoomEntry() call. |callback| will be 60 // is meant to be used by the Backend::DoomEntry() call. |callback| will be
56 // run by |callback_runner|. 61 // run by |callback_runner|.
57 static void DoomEntry(const base::FilePath& path, 62 static void DoomEntry(const base::FilePath& path,
58 const std::string& key, 63 const std::string& key,
59 uint64 entry_hash, 64 uint64 entry_hash,
60 int* out_result); 65 int* out_result);
(...skipping 27 matching lines...) Expand all
88 93
89 const base::FilePath& path() const { return path_; } 94 const base::FilePath& path() const { return path_; }
90 std::string key() const { return key_; } 95 std::string key() const { return key_; }
91 base::Time last_used() const { return last_used_; } 96 base::Time last_used() const { return last_used_; }
92 base::Time last_modified() const { return last_modified_; } 97 base::Time last_modified() const { return last_modified_; }
93 int32 data_size(int index) const { return data_size_[index]; } 98 int32 data_size(int index) const { return data_size_[index]; }
94 99
95 int64 GetFileSize() const; 100 int64 GetFileSize() const;
96 101
97 private: 102 private:
98 SimpleSynchronousEntry(
99 const base::FilePath& path,
100 const std::string& key,
101 uint64 entry_hash);
102
103 // Like Entry, the SimpleSynchronousEntry self releases when Close() is
104 // called.
105 ~SimpleSynchronousEntry();
106
107 bool OpenOrCreateFiles(bool create); 103 bool OpenOrCreateFiles(bool create);
108 void CloseFiles(); 104 void CloseFiles();
109 105
110 // Returns a net::Error, i.e. net::OK on success. 106 // Returns a net::Error, i.e. net::OK on success.
111 int InitializeForOpen(); 107 int InitializeForOpen();
112 108
113 // Returns a net::Error, including net::OK on success and net::FILE_EXISTS 109 // Returns a net::Error, including net::OK on success and net::FILE_EXISTS
114 // when the entry already exists. 110 // when the entry already exists.
115 int InitializeForCreate(); 111 int InitializeForCreate();
116 112
(...skipping 12 matching lines...) Expand all
129 base::Time last_used_; 125 base::Time last_used_;
130 base::Time last_modified_; 126 base::Time last_modified_;
131 int32 data_size_[kSimpleEntryFileCount]; 127 int32 data_size_[kSimpleEntryFileCount];
132 128
133 base::PlatformFile files_[kSimpleEntryFileCount]; 129 base::PlatformFile files_[kSimpleEntryFileCount];
134 }; 130 };
135 131
136 } // namespace disk_cache 132 } // namespace disk_cache
137 133
138 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ 134 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698