summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-12 19:18:56 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-12 19:18:56 +0000
commitdbe1ffe826dd2e1f68dc153d6de952eede409cea (patch)
treecefe2fdfea1661f1f1bb2ab902baa0b78e6c84ea
parentbd154cfb198297202c028fba2fc80a0c3d5cc9ea (diff)
downloadchromium_src-dbe1ffe826dd2e1f68dc153d6de952eede409cea.zip
chromium_src-dbe1ffe826dd2e1f68dc153d6de952eede409cea.tar.gz
chromium_src-dbe1ffe826dd2e1f68dc153d6de952eede409cea.tar.bz2
Reland r113261 rebased after revert of r113249.
base::Bind: Convert browsing_data_remover.h. BUG=none TEST=none R=csilv,ajwong Review URL: http://codereview.chromium.org/8896024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114052 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/disk_cache/backend_impl.cc14
-rw-r--r--net/disk_cache/backend_impl.h5
-rw-r--r--net/disk_cache/disk_cache.h4
-rw-r--r--net/disk_cache/in_flight_backend_io.cc37
-rw-r--r--net/disk_cache/in_flight_backend_io.h12
-rw-r--r--net/disk_cache/mem_backend_impl.cc16
-rw-r--r--net/disk_cache/mem_backend_impl.h5
-rw-r--r--net/http/mock_http_cache.cc10
-rw-r--r--net/http/mock_http_cache.h5
-rw-r--r--webkit/glue/web_io_operators.h3
10 files changed, 105 insertions, 6 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 14a2722..4ffac86 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1401,6 +1401,12 @@ int BackendImpl::DoomAllEntries(OldCompletionCallback* callback) {
return net::ERR_IO_PENDING;
}
+int BackendImpl::DoomAllEntries(const net::CompletionCallback& callback) {
+ DCHECK(!callback.is_null());
+ background_queue_.DoomAllEntries(callback);
+ return net::ERR_IO_PENDING;
+}
+
int BackendImpl::DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
OldCompletionCallback* callback) {
@@ -1409,6 +1415,14 @@ int BackendImpl::DoomEntriesBetween(const base::Time initial_time,
return net::ERR_IO_PENDING;
}
+int BackendImpl::DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) {
+ DCHECK(!callback.is_null());
+ background_queue_.DoomEntriesBetween(initial_time, end_time, callback);
+ return net::ERR_IO_PENDING;
+}
+
int BackendImpl::DoomEntriesSince(const base::Time initial_time,
OldCompletionCallback* callback) {
DCHECK(callback);
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 1e38678..80998c4 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -265,9 +265,14 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
virtual int DoomEntry(const std::string& key,
OldCompletionCallback* callback) OVERRIDE;
virtual int DoomAllEntries(OldCompletionCallback* callback) OVERRIDE;
+ virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
OldCompletionCallback* callback) OVERRIDE;
+ virtual int DoomEntriesBetween(
+ const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesSince(const base::Time initial_time,
OldCompletionCallback* callback) OVERRIDE;
virtual int OpenNextEntry(void** iter, Entry** next_entry,
diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h
index 3e0efa6..d220d91 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -98,6 +98,7 @@ class NET_EXPORT Backend {
// this method returns ERR_IO_PENDING, the |callback| will be invoked when the
// operation completes.
virtual int DoomAllEntries(OldCompletionCallback* callback) = 0;
+ virtual int DoomAllEntries(const net::CompletionCallback& callback) = 0;
// Marks a range of entries for deletion. This supports unbounded deletes in
// either direction by using null Time values for either argument. The return
@@ -106,6 +107,9 @@ class NET_EXPORT Backend {
virtual int DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
OldCompletionCallback* callback) = 0;
+ virtual int DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) = 0;
// Marks all entries accessed since |initial_time| for deletion. The return
// value is a net error code. If this method returns ERR_IO_PENDING, the
diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc
index b99d627..eb42b2a 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) {
diff --git a/net/disk_cache/in_flight_backend_io.h b/net/disk_cache/in_flight_backend_io.h
index 17efb1a..992d3c4 100644
--- a/net/disk_cache/in_flight_backend_io.h
+++ b/net/disk_cache/in_flight_backend_io.h
@@ -27,6 +27,8 @@ class BackendIO : public BackgroundIO {
public:
BackendIO(InFlightIO* controller, BackendImpl* backend,
net::OldCompletionCallback* callback);
+ BackendIO(InFlightIO* controller, BackendImpl* backend,
+ const net::CompletionCallback& callback);
// Runs the actual operation on the background thread.
void ExecuteOperation();
@@ -37,7 +39,8 @@ class BackendIO : public BackgroundIO {
// Returns true if this operation is directed to an entry (vs. the backend).
bool IsEntryOperation();
- net::OldCompletionCallback* callback() { return callback_; }
+ net::OldCompletionCallback* old_callback() const { return old_callback_; }
+ net::CompletionCallback callback() const { return callback_; }
// Grabs an extra reference of entry_.
void ReferenceEntry();
@@ -113,7 +116,8 @@ class BackendIO : public BackgroundIO {
void ExecuteEntryOperation();
BackendImpl* backend_;
- net::OldCompletionCallback* callback_;
+ net::OldCompletionCallback* old_callback_;
+ net::CompletionCallback callback_;
Operation operation_;
net::OldCompletionCallbackImpl<BackendIO> my_callback_;
@@ -153,9 +157,13 @@ class InFlightBackendIO : public InFlightIO {
net::OldCompletionCallback* callback);
void DoomEntry(const std::string& key, net::OldCompletionCallback* callback);
void DoomAllEntries(net::OldCompletionCallback* callback);
+ void DoomAllEntries(const net::CompletionCallback& callback);
void DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
net::OldCompletionCallback* callback);
+ void DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback);
void DoomEntriesSince(const base::Time initial_time,
net::OldCompletionCallback* callback);
void OpenNextEntry(void** iter, Entry** next_entry,
diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc
index f08b316..226050c 100644
--- a/net/disk_cache/mem_backend_impl.cc
+++ b/net/disk_cache/mem_backend_impl.cc
@@ -159,6 +159,13 @@ int MemBackendImpl::DoomAllEntries(OldCompletionCallback* callback) {
return net::ERR_FAILED;
}
+int MemBackendImpl::DoomAllEntries(const net::CompletionCallback& callback) {
+ if (DoomAllEntries())
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
OldCompletionCallback* callback) {
@@ -168,6 +175,15 @@ int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time,
return net::ERR_FAILED;
}
+int MemBackendImpl::DoomEntriesBetween(
+ const base::Time initial_time, const base::Time end_time,
+ const net::CompletionCallback& callback) {
+ if (DoomEntriesBetween(initial_time, end_time))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
int MemBackendImpl::DoomEntriesSince(const base::Time initial_time,
OldCompletionCallback* callback) {
if (DoomEntriesSince(initial_time))
diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h
index abf1443..326bfba 100644
--- a/net/disk_cache/mem_backend_impl.h
+++ b/net/disk_cache/mem_backend_impl.h
@@ -71,9 +71,14 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend {
virtual int DoomEntry(const std::string& key,
OldCompletionCallback* callback) OVERRIDE;
virtual int DoomAllEntries(OldCompletionCallback* callback) OVERRIDE;
+ virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
OldCompletionCallback* callback) OVERRIDE;
+ virtual int DoomEntriesBetween(
+ const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesSince(const base::Time initial_time,
OldCompletionCallback* callback) OVERRIDE;
virtual int OpenNextEntry(void** iter, Entry** next_entry,
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index 98efd70..dc06aaa 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -442,12 +442,22 @@ int MockDiskCache::DoomAllEntries(net::OldCompletionCallback* callback) {
return net::ERR_NOT_IMPLEMENTED;
}
+int MockDiskCache::DoomAllEntries(const net::CompletionCallback& callback) {
+ return net::ERR_NOT_IMPLEMENTED;
+}
+
int MockDiskCache::DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
net::OldCompletionCallback* callback) {
return net::ERR_NOT_IMPLEMENTED;
}
+int MockDiskCache::DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) {
+ return net::ERR_NOT_IMPLEMENTED;
+}
+
int MockDiskCache::DoomEntriesSince(const base::Time initial_time,
net::OldCompletionCallback* callback) {
return net::ERR_NOT_IMPLEMENTED;
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h
index 975058f..71aad88 100644
--- a/net/http/mock_http_cache.h
+++ b/net/http/mock_http_cache.h
@@ -103,9 +103,14 @@ class MockDiskCache : public disk_cache::Backend {
virtual int DoomEntry(const std::string& key,
net::OldCompletionCallback* callback) OVERRIDE;
virtual int DoomAllEntries(net::OldCompletionCallback* callback) OVERRIDE;
+ virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
net::OldCompletionCallback* callback) OVERRIDE;
+ virtual int DoomEntriesBetween(
+ const base::Time initial_time,
+ const base::Time end_time,
+ const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesSince(const base::Time initial_time,
net::OldCompletionCallback* callback) OVERRIDE;
virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry,
diff --git a/webkit/glue/web_io_operators.h b/webkit/glue/web_io_operators.h
index 12052d2..f161601 100644
--- a/webkit/glue/web_io_operators.h
+++ b/webkit/glue/web_io_operators.h
@@ -14,7 +14,8 @@ namespace WebKit {
#if defined(WCHAR_T_IS_UTF32)
class WebString;
-std::ostream& operator<<(std::ostream& out, const WebString& s);
+WEBKIT_GLUE_EXPORT std::ostream& operator<<(std::ostream& out,
+ const WebString& s);
#endif // defined(WCHAR_T_IS_UTF32)
struct WebPoint;