diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 22:23:01 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 22:23:01 +0000 |
commit | b05474d73e1f33770648ac9e11d58c6393caa82d (patch) | |
tree | e4fc5694358bf016a3fd0aa609ac59b10566d8de /net/disk_cache/in_flight_backend_io.h | |
parent | 0e38171bbd68e2a008fdc340942dc6eef9766563 (diff) | |
download | chromium_src-b05474d73e1f33770648ac9e11d58c6393caa82d.zip chromium_src-b05474d73e1f33770648ac9e11d58c6393caa82d.tar.gz chromium_src-b05474d73e1f33770648ac9e11d58c6393caa82d.tar.bz2 |
Disk cache: Implement request throttling.
Note that no throttling is performed with this change,
the backend is not activating the feature.
BUG=54338
TEST=none.
Review URL: http://codereview.chromium.org/3416002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/in_flight_backend_io.h')
-rw-r--r-- | net/disk_cache/in_flight_backend_io.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/net/disk_cache/in_flight_backend_io.h b/net/disk_cache/in_flight_backend_io.h index 083c6fd..213c261 100644 --- a/net/disk_cache/in_flight_backend_io.h +++ b/net/disk_cache/in_flight_backend_io.h @@ -39,6 +39,9 @@ class BackendIO : public BackgroundIO { void ReleaseEntry(); + // Returns the time that has passed since the operation was created. + base::TimeDelta ElapsedTime() const; + // The operations we proxy: void Init(); void OpenEntry(const std::string& key, Entry** entry); @@ -124,6 +127,7 @@ class BackendIO : public BackgroundIO { bool truncate_; int64 offset64_; int64* start_; + base::TimeTicks start_time_; DISALLOW_COPY_AND_ASSIGN(BackendIO); }; @@ -132,9 +136,8 @@ class BackendIO : public BackgroundIO { class InFlightBackendIO : public InFlightIO { public: InFlightBackendIO(BackendImpl* backend, - base::MessageLoopProxy* background_thread) - : backend_(backend), background_thread_(background_thread) {} - ~InFlightBackendIO() {} + base::MessageLoopProxy* background_thread); + ~InFlightBackendIO(); // The operations we proxy: void Init(net::CompletionCallback* callback); @@ -182,6 +185,10 @@ class InFlightBackendIO : public InFlightIO { return background_thread_->BelongsToCurrentThread(); } + // Controls the queing of entry (async) operations. + void StartQueingOperations(); + void StopQueingOperations(); + protected: virtual void OnOperationComplete(BackgroundIO* operation, bool cancel); @@ -189,10 +196,14 @@ class InFlightBackendIO : public InFlightIO { typedef std::list<scoped_refptr<BackendIO> > OperationList; void QueueOperation(BackendIO* operation); void PostOperation(BackendIO* operation); + void PostQueuedOperation(OperationList* from_list); + void QueueOperationToList(BackendIO* operation, OperationList* list); BackendImpl* backend_; scoped_refptr<base::MessageLoopProxy> background_thread_; OperationList pending_ops_; // The list of operations to be posted. + OperationList pending_entry_ops_; // Entry (async) operations to be posted. + bool queue_entry_ops_; // True if we are queuing entry (async) operations. DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO); }; |