| 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..aaec134824ab5ea6c2820193f3da2080d4e72661 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 the next operation in the queue, if any and if there is no other
|
| + // operation running at the moment. Returns true if a operation has run.
|
| + 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,15 @@ 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).
|
| 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> pending_operations_;
|
|
|
| base::WeakPtr<SimpleIndex> index_;
|
| };
|
|
|