Chromium Code Reviews| Index: net/disk_cache/simple/simple_entry_impl.h |
| diff --git a/net/disk_cache/simple/simple_entry_impl.h b/net/disk_cache/simple/simple_entry_impl.h |
| index 7b898cf4881f68f2c019ccd14c065c7261b18796..70e30042a18530f5ddd5423e8e80f1e4b0e21331 100644 |
| --- a/net/disk_cache/simple/simple_entry_impl.h |
| +++ b/net/disk_cache/simple/simple_entry_impl.h |
| @@ -5,6 +5,7 @@ |
| #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| +#include <queue> |
| #include <string> |
| #include "base/files/file_path.h" |
| @@ -85,6 +86,23 @@ class SimpleEntryImpl : public Entry { |
| virtual ~SimpleEntryImpl(); |
| + // Runs next operation in the queue, if any and if there is no other operation |
|
gavinp
2013/04/17 13:13:45
Nit: "Runs _the_ next", and also "if and _only_ if
felipeg
2013/04/17 13:34:18
Done.
|
| + // running at the moment. Returns true if a operation has run. |
|
gavinp
2013/04/17 13:13:45
What is this return value used for?
felipeg
2013/04/17 13:34:18
It will be used to implement the optimistic writes
|
| + bool RunNextOperationIfNeeded(); |
| + |
| + void ReadDataInternal(int index, |
| + int offset, |
| + scoped_refptr<net::IOBuffer> buf, |
| + int buf_len, |
| + const CompletionCallback& callback); |
| + |
| + void WriteDataInternal(int index, |
| + int offset, |
| + scoped_refptr<net::IOBuffer> buf, |
| + int buf_len, |
| + const CompletionCallback& callback, |
| + bool truncate); |
| + |
| // Called after a SimpleSynchronousEntry has completed CreateEntry() or |
| // OpenEntry(). Constructs the new SimpleEntryImpl (if |result| is net::OK) |
| // and passes it back to the caller via |out_entry|. Also runs |
| @@ -130,16 +148,17 @@ class SimpleEntryImpl : public Entry { |
| int32 data_size_[kSimpleEntryFileCount]; |
| // The |synchronous_entry_| is the worker thread object that performs IO on |
| - // entries. It's owned by this SimpleEntryImpl whenever |
| - // |synchronous_entry_in_use_by_worker_| is false (i.e. when an operation |
| - // is not pending on the worker pool). When an operation is pending on the |
| - // worker pool, the |synchronous_entry_| is owned by itself. |
| + // entries. It's owned by this SimpleEntryImpl whenever |operation_running_| |
| + // is false (i.e. when an operation is not pending on the worker pool). When |
| + // an operation is pending on the worker pool, the |synchronous_entry_| is |
|
gavinp
2013/04/17 13:13:45
While we're here, the last sentence of this commen
felipeg
2013/04/17 13:34:18
Done.
|
| + // owned by itself. |
| SimpleSynchronousEntry* synchronous_entry_; |
| // Set to true when a worker operation is posted on the |synchronous_entry_|, |
| // and false after. Used to ensure thread safety by not allowing multiple |
| // threads to access the |synchronous_entry_| simultaneously. |
| - bool synchronous_entry_in_use_by_worker_; |
| + bool operation_running_; |
| + std::queue<base::Closure> operations_; |
|
gavinp
2013/04/17 13:13:45
pending_operations_ ?
felipeg
2013/04/17 13:34:18
Done.
|
| base::WeakPtr<SimpleIndex> index_; |
| }; |