Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: net/disk_cache/in_flight_backend_io.cc

Issue 8896024: Reland r113261 rebased after revert of r113249. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/in_flight_backend_io.h ('k') | net/disk_cache/mem_backend_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/in_flight_backend_io.cc
diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc
index b99d62760a5c29eb4bf40f3e76ff6fec1dacbf32..eb42b2a645a19a945e8d3115dc5cf56a216d06af 100644
--- a/net/disk_cache/in_flight_backend_io.cc
+++ b/net/disk_cache/in_flight_backend_io.cc
@@ -16,7 +16,21 @@ namespace disk_cache {
BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend,
net::OldCompletionCallback* callback)
- : BackgroundIO(controller), backend_(backend), callback_(callback),
+ : BackgroundIO(controller),
+ backend_(backend),
+ old_callback_(callback),
+ operation_(OP_NONE),
+ ALLOW_THIS_IN_INITIALIZER_LIST(
+ my_callback_(this, &BackendIO::OnIOComplete)) {
+ start_time_ = base::TimeTicks::Now();
+}
+
+BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend,
+ const net::CompletionCallback& callback)
+ : BackgroundIO(controller),
+ backend_(backend),
+ old_callback_(NULL),
+ callback_(callback),
operation_(OP_NONE),
ALLOW_THIS_IN_INITIALIZER_LIST(
my_callback_(this, &BackendIO::OnIOComplete)) {
@@ -333,6 +347,13 @@ void InFlightBackendIO::DoomAllEntries(OldCompletionCallback* callback) {
PostOperation(operation);
}
+void InFlightBackendIO::DoomAllEntries(
+ const net::CompletionCallback& callback) {
+ scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
+ operation->DoomAllEntries();
+ PostOperation(operation);
+}
+
void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
OldCompletionCallback* callback) {
@@ -341,6 +362,14 @@ void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time,
PostOperation(operation);
}
+void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) {
+ scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
+ operation->DoomEntriesBetween(initial_time, end_time);
+ PostOperation(operation);
+}
+
void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time,
OldCompletionCallback* callback) {
scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
@@ -464,8 +493,10 @@ void InFlightBackendIO::OnOperationComplete(BackgroundIO* operation,
CACHE_UMA(TIMES, "TotalIOTime", 0, op->ElapsedTime());
}
- if (op->callback() && (!cancel || op->IsEntryOperation()))
- op->callback()->Run(op->result());
+ if (op->old_callback() && (!cancel || op->IsEntryOperation()))
+ op->old_callback()->Run(op->result());
+ else if (!op->callback().is_null() && (!cancel || op->IsEntryOperation()))
+ op->callback().Run(op->result());
}
void InFlightBackendIO::PostOperation(BackendIO* operation) {
« no previous file with comments | « net/disk_cache/in_flight_backend_io.h ('k') | net/disk_cache/mem_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698