Chromium Code Reviews| 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_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 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, | 67 void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, |
| 68 int buf_len, bool truncate); | 68 int buf_len, bool truncate); |
| 69 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, | 69 void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, |
| 70 int buf_len); | 70 int buf_len); |
| 71 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, | 71 void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, |
| 72 int buf_len); | 72 int buf_len); |
| 73 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start); | 73 void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start); |
| 74 void CancelSparseIO(EntryImpl* entry); | 74 void CancelSparseIO(EntryImpl* entry); |
| 75 void ReadyForSparseIO(EntryImpl* entry); | 75 void ReadyForSparseIO(EntryImpl* entry); |
| 76 | 76 |
| 77 private: | |
| 78 // There are two types of operations to proxy: regular backend operations are | 77 // There are two types of operations to proxy: regular backend operations are |
| 79 // executed sequentially (queued by the message loop). On the other hand, | 78 // executed sequentially (queued by the message loop). On the other hand, |
| 80 // operations targeted to a given entry can be long lived and support multiple | 79 // operations targeted to a given entry can be long lived and support multiple |
| 81 // simultaneous users (multiple reads or writes to the same entry), and they | 80 // simultaneous users (multiple reads or writes to the same entry), and they |
| 82 // are subject to throttling, so we keep an explicit queue. | 81 // are subject to throttling, so we keep an explicit queue. |
| 83 enum Operation { | 82 enum Operation { |
| 84 OP_NONE = 0, | 83 OP_NONE = 0, |
| 85 OP_INIT, | 84 OP_INIT, |
| 86 OP_OPEN, | 85 OP_OPEN, |
| 87 OP_CREATE, | 86 OP_CREATE, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 99 OP_RUN_TASK, | 98 OP_RUN_TASK, |
| 100 OP_MAX_BACKEND, | 99 OP_MAX_BACKEND, |
| 101 OP_READ, | 100 OP_READ, |
| 102 OP_WRITE, | 101 OP_WRITE, |
| 103 OP_READ_SPARSE, | 102 OP_READ_SPARSE, |
| 104 OP_WRITE_SPARSE, | 103 OP_WRITE_SPARSE, |
| 105 OP_GET_RANGE, | 104 OP_GET_RANGE, |
| 106 OP_CANCEL_IO, | 105 OP_CANCEL_IO, |
| 107 OP_IS_READY | 106 OP_IS_READY |
| 108 }; | 107 }; |
| 108 private: | |
|
rvargas (doing something else)
2013/04/05 19:25:13
nit: move one line down (emty line before, not aft
pasko-google - do not use
2013/04/09 11:53:17
Done.
| |
| 109 | 109 |
| 110 virtual ~BackendIO(); | 110 virtual ~BackendIO(); |
| 111 | 111 |
| 112 // Returns true if this operation returns an entry. | 112 // Returns true if this operation returns an entry. |
| 113 bool ReturnsEntry(); | 113 bool ReturnsEntry(); |
| 114 | 114 |
| 115 // Returns the time that has passed since the operation was created. | 115 // Returns the time that has passed since the operation was created. |
| 116 base::TimeDelta ElapsedTime() const; | 116 base::TimeDelta ElapsedTime() const; |
| 117 | 117 |
| 118 void ExecuteBackendOperation(); | 118 void ExecuteBackendOperation(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 BackendImpl* backend_; | 214 BackendImpl* backend_; |
| 215 scoped_refptr<base::MessageLoopProxy> background_thread_; | 215 scoped_refptr<base::MessageLoopProxy> background_thread_; |
| 216 base::WeakPtrFactory<InFlightBackendIO> ptr_factory_; | 216 base::WeakPtrFactory<InFlightBackendIO> ptr_factory_; |
| 217 | 217 |
| 218 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); | 218 DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 } // namespace disk_cache | 221 } // namespace disk_cache |
| 222 | 222 |
| 223 #endif // NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_ | 223 #endif // NET_DISK_CACHE_IN_FLIGHT_BACKEND_IO_H_ |
| OLD | NEW |