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

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

Issue 7461106: Inform disk cache of WebKit memory cache hits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_IN_FLIGHT_BACKEND_IO_H_ 5 #ifndef NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_
6 #define NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_ 6 #define NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 int buf_len); 63 int buf_len);
64 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, 64 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf,
65 int buf_len, bool truncate); 65 int buf_len, bool truncate);
66 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, 66 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf,
67 int buf_len); 67 int buf_len);
68 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, 68 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf,
69 int buf_len); 69 int buf_len);
70 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start); 70 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start);
71 void CancelSparseIO(EntryImpl* entry); 71 void CancelSparseIO(EntryImpl* entry);
72 void ReadyForSparseIO(EntryImpl* entry); 72 void ReadyForSparseIO(EntryImpl* entry);
73 void UpdateRankForExternalCacheHit(EntryImpl* entry);
73 74
74 private: 75 private:
75 // There are two types of operations to proxy: regular backend operations are 76 // There are two types of operations to proxy: regular backend operations are
76 // executed sequentially (queued by the message loop). On the other hand, 77 // executed sequentially (queued by the message loop). On the other hand,
77 // operations targeted to a given entry can be long lived and support multiple 78 // operations targeted to a given entry can be long lived and support multiple
78 // simultaneous users (multiple reads or writes to the same entry), and they 79 // simultaneous users (multiple reads or writes to the same entry), and they
79 // are subject to throttling, so we keep an explicit queue. 80 // are subject to throttling, so we keep an explicit queue.
80 enum Operation { 81 enum Operation {
81 OP_NONE = 0, 82 OP_NONE = 0,
82 OP_INIT, 83 OP_INIT,
(...skipping 10 matching lines...) Expand all
93 OP_DOOM_ENTRY, 94 OP_DOOM_ENTRY,
94 OP_FLUSH_QUEUE, 95 OP_FLUSH_QUEUE,
95 OP_RUN_TASK, 96 OP_RUN_TASK,
96 OP_MAX_BACKEND, 97 OP_MAX_BACKEND,
97 OP_READ, 98 OP_READ,
98 OP_WRITE, 99 OP_WRITE,
99 OP_READ_SPARSE, 100 OP_READ_SPARSE,
100 OP_WRITE_SPARSE, 101 OP_WRITE_SPARSE,
101 OP_GET_RANGE, 102 OP_GET_RANGE,
102 OP_CANCEL_IO, 103 OP_CANCEL_IO,
103 OP_IS_READY 104 OP_IS_READY,
105 OP_UPDATE_RANK,
104 }; 106 };
105 107
106 virtual ~BackendIO(); 108 virtual ~BackendIO();
107 109
108 void ExecuteBackendOperation(); 110 void ExecuteBackendOperation();
109 void ExecuteEntryOperation(); 111 void ExecuteEntryOperation();
110 112
111 BackendImpl* backend_; 113 BackendImpl* backend_;
112 net::CompletionCallback* callback_; 114 net::CompletionCallback* callback_;
113 Operation operation_; 115 Operation operation_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, 170 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf,
169 int buf_len, bool truncate, net::CompletionCallback* callback); 171 int buf_len, bool truncate, net::CompletionCallback* callback);
170 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, 172 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf,
171 int buf_len, net::CompletionCallback* callback); 173 int buf_len, net::CompletionCallback* callback);
172 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, 174 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf,
173 int buf_len, net::CompletionCallback* callback); 175 int buf_len, net::CompletionCallback* callback);
174 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start, 176 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start,
175 net::CompletionCallback* callback); 177 net::CompletionCallback* callback);
176 void CancelSparseIO(EntryImpl* entry); 178 void CancelSparseIO(EntryImpl* entry);
177 void ReadyForSparseIO(EntryImpl* entry, net::CompletionCallback* callback); 179 void ReadyForSparseIO(EntryImpl* entry, net::CompletionCallback* callback);
180 void UpdateRankForExternalCacheHit(EntryImpl* entry);
178 181
179 // Blocks until all operations are cancelled or completed. 182 // Blocks until all operations are cancelled or completed.
180 void WaitForPendingIO(); 183 void WaitForPendingIO();
181 184
182 scoped_refptr<base::MessageLoopProxy> background_thread() { 185 scoped_refptr<base::MessageLoopProxy> background_thread() {
183 return background_thread_; 186 return background_thread_;
184 } 187 }
185 188
186 // Returns true if the current thread is the background thread. 189 // Returns true if the current thread is the background thread.
187 bool BackgroundIsCurrentThread() { 190 bool BackgroundIsCurrentThread() {
188 return background_thread_->BelongsToCurrentThread(); 191 return background_thread_->BelongsToCurrentThread();
189 } 192 }
190 193
191 protected: 194 protected:
192 virtual void OnOperationComplete(BackgroundIO* operation, bool cancel); 195 virtual void OnOperationComplete(BackgroundIO* operation, bool cancel);
193 196
194 private: 197 private:
195 void PostOperation(BackendIO* operation); 198 void PostOperation(BackendIO* operation);
196 199
197 BackendImpl* backend_; 200 BackendImpl* backend_;
198 scoped_refptr<base::MessageLoopProxy> background_thread_; 201 scoped_refptr<base::MessageLoopProxy> background_thread_;
199 202
200 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); 203 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO);
201 }; 204 };
202 205
203 } // namespace disk_cache 206 } // namespace disk_cache
204 207
205 #endif // NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_ 208 #endif // NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698