| OLD | NEW |
| 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 #ifndef NET_DISK_CACHE_BLOCKFILE_IN_FLIGHT_BACKEND_IO_H_ | 5 #ifndef NET_DISK_CACHE_BLOCKFILE_IN_FLIGHT_BACKEND_IO_H_ |
| 6 #define NET_DISK_CACHE_BLOCKFILE_IN_FLIGHT_BACKEND_IO_H_ | 6 #define NET_DISK_CACHE_BLOCKFILE_IN_FLIGHT_BACKEND_IO_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void ReadyForSparseIO(EntryImpl* entry, | 212 void ReadyForSparseIO(EntryImpl* entry, |
| 213 const net::CompletionCallback& callback); | 213 const net::CompletionCallback& callback); |
| 214 | 214 |
| 215 // Blocks until all operations are cancelled or completed. | 215 // Blocks until all operations are cancelled or completed. |
| 216 void WaitForPendingIO(); | 216 void WaitForPendingIO(); |
| 217 | 217 |
| 218 scoped_refptr<base::SingleThreadTaskRunner> background_thread() { | 218 scoped_refptr<base::SingleThreadTaskRunner> background_thread() { |
| 219 return background_thread_; | 219 return background_thread_; |
| 220 } | 220 } |
| 221 | 221 |
| 222 // Returns true if the current thread is the background thread. | 222 // Returns true if the current sequence is the background thread. |
| 223 bool BackgroundIsCurrentThread() { | 223 bool BackgroundIsCurrentSequence() { |
| 224 return background_thread_->RunsTasksOnCurrentThread(); | 224 return background_thread_->RunsTasksInCurrentSequence(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 base::WeakPtr<InFlightBackendIO> GetWeakPtr(); | 227 base::WeakPtr<InFlightBackendIO> GetWeakPtr(); |
| 228 | 228 |
| 229 protected: | 229 protected: |
| 230 void OnOperationComplete(BackgroundIO* operation, bool cancel) override; | 230 void OnOperationComplete(BackgroundIO* operation, bool cancel) override; |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 void PostOperation(const tracked_objects::Location& from_here, | 233 void PostOperation(const tracked_objects::Location& from_here, |
| 234 BackendIO* operation); | 234 BackendIO* operation); |
| 235 | 235 |
| 236 BackendImpl* backend_; | 236 BackendImpl* backend_; |
| 237 scoped_refptr<base::SingleThreadTaskRunner> background_thread_; | 237 scoped_refptr<base::SingleThreadTaskRunner> background_thread_; |
| 238 base::WeakPtrFactory<InFlightBackendIO> ptr_factory_; | 238 base::WeakPtrFactory<InFlightBackendIO> ptr_factory_; |
| 239 | 239 |
| 240 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); | 240 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 } // namespace disk_cache | 243 } // namespace disk_cache |
| 244 | 244 |
| 245 #endif // NET_DISK_CACHE_BLOCKFILE_IN_FLIGHT_BACKEND_IO_H_ | 245 #endif // NET_DISK_CACHE_BLOCKFILE_IN_FLIGHT_BACKEND_IO_H_ |
| OLD | NEW |