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

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

Issue 8832006: Reverts a commit that caused ASAN failures, and 2 dependent commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/entry_impl.cc ('k') | net/disk_cache/in_flight_backend_io.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 11
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/disk_cache/in_flight_io.h" 16 #include "net/disk_cache/in_flight_io.h"
17 17
18 namespace disk_cache { 18 namespace disk_cache {
19 19
20 class BackendImpl; 20 class BackendImpl;
21 class Entry; 21 class Entry;
22 class EntryImpl; 22 class EntryImpl;
23 23
24 // This class represents a single asynchronous disk cache IO operation while it 24 // This class represents a single asynchronous disk cache IO operation while it
25 // is being bounced between threads. 25 // is being bounced between threads.
26 class BackendIO : public BackgroundIO { 26 class BackendIO : public BackgroundIO {
27 public: 27 public:
28 BackendIO(InFlightIO* controller, BackendImpl* backend, 28 BackendIO(InFlightIO* controller, BackendImpl* backend,
29 net::OldCompletionCallback* callback); 29 net::OldCompletionCallback* callback);
30 BackendIO(InFlightIO* controller, BackendImpl* backend,
31 const net::CompletionCallback& callback);
32 30
33 // Runs the actual operation on the background thread. 31 // Runs the actual operation on the background thread.
34 void ExecuteOperation(); 32 void ExecuteOperation();
35 33
36 // Callback implementation. 34 // Callback implementation.
37 void OnIOComplete(int result); 35 void OnIOComplete(int result);
38 36
39 // Returns true if this operation is directed to an entry (vs. the backend). 37 // Returns true if this operation is directed to an entry (vs. the backend).
40 bool IsEntryOperation(); 38 bool IsEntryOperation();
41 39
42 net::OldCompletionCallback* old_callback() const { return old_callback_; } 40 net::OldCompletionCallback* callback() { return callback_; }
43 net::CompletionCallback callback() const { return callback_; }
44 41
45 // Grabs an extra reference of entry_. 42 // Grabs an extra reference of entry_.
46 void ReferenceEntry(); 43 void ReferenceEntry();
47 44
48 // Returns the time that has passed since the operation was created. 45 // Returns the time that has passed since the operation was created.
49 base::TimeDelta ElapsedTime() const; 46 base::TimeDelta ElapsedTime() const;
50 47
51 // The operations we proxy: 48 // The operations we proxy:
52 void Init(); 49 void Init();
53 void OpenEntry(const std::string& key, Entry** entry); 50 void OpenEntry(const std::string& key, Entry** entry);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 OP_CANCEL_IO, 106 OP_CANCEL_IO,
110 OP_IS_READY 107 OP_IS_READY
111 }; 108 };
112 109
113 virtual ~BackendIO(); 110 virtual ~BackendIO();
114 111
115 void ExecuteBackendOperation(); 112 void ExecuteBackendOperation();
116 void ExecuteEntryOperation(); 113 void ExecuteEntryOperation();
117 114
118 BackendImpl* backend_; 115 BackendImpl* backend_;
119 net::OldCompletionCallback* old_callback_; 116 net::OldCompletionCallback* callback_;
120 net::CompletionCallback callback_;
121 Operation operation_; 117 Operation operation_;
122 net::OldCompletionCallbackImpl<BackendIO> my_callback_; 118 net::OldCompletionCallbackImpl<BackendIO> my_callback_;
123 119
124 // The arguments of all the operations we proxy: 120 // The arguments of all the operations we proxy:
125 std::string key_; 121 std::string key_;
126 Entry** entry_ptr_; 122 Entry** entry_ptr_;
127 base::Time initial_time_; 123 base::Time initial_time_;
128 base::Time end_time_; 124 base::Time end_time_;
129 void** iter_ptr_; 125 void** iter_ptr_;
130 void* iter_; 126 void* iter_;
(...skipping 15 matching lines...) Expand all
146 class InFlightBackendIO : public InFlightIO { 142 class InFlightBackendIO : public InFlightIO {
147 public: 143 public:
148 InFlightBackendIO(BackendImpl* backend, 144 InFlightBackendIO(BackendImpl* backend,
149 base::MessageLoopProxy* background_thread); 145 base::MessageLoopProxy* background_thread);
150 virtual ~InFlightBackendIO(); 146 virtual ~InFlightBackendIO();
151 147
152 // The operations we proxy: 148 // The operations we proxy:
153 void Init(net::OldCompletionCallback* callback); 149 void Init(net::OldCompletionCallback* callback);
154 void OpenEntry(const std::string& key, Entry** entry, 150 void OpenEntry(const std::string& key, Entry** entry,
155 net::OldCompletionCallback* callback); 151 net::OldCompletionCallback* callback);
156 void OpenEntry(const std::string& key, Entry** entry,
157 const net::CompletionCallback& callback);
158 void CreateEntry(const std::string& key, Entry** entry, 152 void CreateEntry(const std::string& key, Entry** entry,
159 net::OldCompletionCallback* callback); 153 net::OldCompletionCallback* callback);
160 void CreateEntry(const std::string& key, Entry** entry,
161 const net::CompletionCallback& callback);
162 void DoomEntry(const std::string& key, net::OldCompletionCallback* callback); 154 void DoomEntry(const std::string& key, net::OldCompletionCallback* callback);
163 void DoomAllEntries(net::OldCompletionCallback* callback); 155 void DoomAllEntries(net::OldCompletionCallback* callback);
164 void DoomAllEntries(const net::CompletionCallback& callback);
165 void DoomEntriesBetween(const base::Time initial_time, 156 void DoomEntriesBetween(const base::Time initial_time,
166 const base::Time end_time, 157 const base::Time end_time,
167 net::OldCompletionCallback* callback); 158 net::OldCompletionCallback* callback);
168 void DoomEntriesBetween(const base::Time initial_time,
169 const base::Time end_time,
170 const net::CompletionCallback& callback);
171 void DoomEntriesSince(const base::Time initial_time, 159 void DoomEntriesSince(const base::Time initial_time,
172 net::OldCompletionCallback* callback); 160 net::OldCompletionCallback* callback);
173 void OpenNextEntry(void** iter, Entry** next_entry, 161 void OpenNextEntry(void** iter, Entry** next_entry,
174 net::OldCompletionCallback* callback); 162 net::OldCompletionCallback* callback);
175 void OpenNextEntry(void** iter, Entry** next_entry,
176 const net::CompletionCallback& callback);
177 void OpenPrevEntry(void** iter, Entry** prev_entry, 163 void OpenPrevEntry(void** iter, Entry** prev_entry,
178 net::OldCompletionCallback* callback); 164 net::OldCompletionCallback* callback);
179 void EndEnumeration(void* iterator); 165 void EndEnumeration(void* iterator);
180 void OnExternalCacheHit(const std::string& key); 166 void OnExternalCacheHit(const std::string& key);
181 void CloseEntryImpl(EntryImpl* entry); 167 void CloseEntryImpl(EntryImpl* entry);
182 void DoomEntryImpl(EntryImpl* entry); 168 void DoomEntryImpl(EntryImpl* entry);
183 void FlushQueue(net::OldCompletionCallback* callback); 169 void FlushQueue(net::OldCompletionCallback* callback);
184 void RunTask(Task* task, net::OldCompletionCallback* callback); 170 void RunTask(Task* task, net::OldCompletionCallback* callback);
185 void ReadData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, 171 void ReadData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf,
186 int buf_len, net::OldCompletionCallback* callback); 172 int buf_len, net::OldCompletionCallback* callback);
187 void ReadData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, 173 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf,
188 int buf_len, const net::CompletionCallback& callback); 174 int buf_len, bool truncate, net::OldCompletionCallback* callbac k);
189 void WriteData(EntryImpl* entry, int index, int offset,
190 net::IOBuffer* buf, int buf_len, bool truncate,
191 net::OldCompletionCallback* callback);
192 void WriteData(EntryImpl* entry, int index, int offset,
193 net::IOBuffer* buf, int buf_len, bool truncate,
194 const net::CompletionCallback& callback);
195 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, 175 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf,
196 int buf_len, net::OldCompletionCallback* callback); 176 int buf_len, net::OldCompletionCallback* callback);
197 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, 177 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf,
198 int buf_len, net::OldCompletionCallback* callback); 178 int buf_len, net::OldCompletionCallback* callback);
199 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start, 179 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start,
200 net::OldCompletionCallback* callback); 180 net::OldCompletionCallback* callback);
201 void CancelSparseIO(EntryImpl* entry); 181 void CancelSparseIO(EntryImpl* entry);
202 void ReadyForSparseIO(EntryImpl* entry, net::OldCompletionCallback* callback); 182 void ReadyForSparseIO(EntryImpl* entry, net::OldCompletionCallback* callback);
203 183
204 // Blocks until all operations are cancelled or completed. 184 // Blocks until all operations are cancelled or completed.
(...skipping 17 matching lines...) Expand all
222 202
223 BackendImpl* backend_; 203 BackendImpl* backend_;
224 scoped_refptr<base::MessageLoopProxy> background_thread_; 204 scoped_refptr<base::MessageLoopProxy> background_thread_;
225 205
226 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); 206 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO);
227 }; 207 };
228 208
229 } // namespace disk_cache 209 } // namespace disk_cache
230 210
231 #endif // NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_ 211 #endif // NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_
OLDNEW
« no previous file with comments | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/in_flight_backend_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698