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

Unified Diff: content/browser/in_process_webkit/indexed_db_quota_client.cc

Issue 8070001: Use base::Callback in Quota related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: choke lint Created 9 years, 3 months 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
Index: content/browser/in_process_webkit/indexed_db_quota_client.cc
diff --git a/content/browser/in_process_webkit/indexed_db_quota_client.cc b/content/browser/in_process_webkit/indexed_db_quota_client.cc
index 618f1470b4a76239160bdd8c7edfefae778bee61..30b0851236fce514b0da37f5496d7faecfba22fd 100644
--- a/content/browser/in_process_webkit/indexed_db_quota_client.cc
+++ b/content/browser/in_process_webkit/indexed_db_quota_client.cc
@@ -36,7 +36,7 @@ class IndexedDBQuotaClient::DeleteOriginTask : public HelperTask {
DeleteOriginTask(IndexedDBQuotaClient* client,
base::MessageLoopProxy* webkit_thread_message_loop,
const GURL& origin_url,
- DeletionCallback* callback)
+ DeletionCallback callback)
: HelperTask(client, webkit_thread_message_loop),
origin_url_(origin_url), callback_(callback) {
}
@@ -45,14 +45,14 @@ class IndexedDBQuotaClient::DeleteOriginTask : public HelperTask {
indexed_db_context_->DeleteIndexedDBForOrigin(origin_url_);
}
virtual void Aborted() OVERRIDE {
- callback_.reset();
+ callback_.Reset();
}
virtual void Completed() OVERRIDE {
- callback_->Run(quota::kQuotaStatusOk);
- callback_.reset();
+ callback_.Run(quota::kQuotaStatusOk);
+ callback_.Reset();
}
GURL origin_url_;
- scoped_ptr<DeletionCallback> callback_;
+ DeletionCallback callback_;
};
class IndexedDBQuotaClient::GetOriginUsageTask : public HelperTask {
@@ -168,18 +168,17 @@ void IndexedDBQuotaClient::OnQuotaManagerDestroyed() {
void IndexedDBQuotaClient::GetOriginUsage(
const GURL& origin_url,
quota::StorageType type,
- GetUsageCallback* callback_ptr) {
- DCHECK(callback_ptr);
+ GetUsageCallback callback) {
+ DCHECK(!callback.is_null());
DCHECK(indexed_db_context_.get());
- scoped_ptr<GetUsageCallback> callback(callback_ptr);
// IndexedDB is in the temp namespace for now.
if (type != quota::kStorageTypeTemporary) {
- callback->Run(0);
+ callback.Run(0);
return;
}
- if (usage_for_origin_callbacks_.Add(origin_url, callback.release())) {
+ if (usage_for_origin_callbacks_.Add(origin_url, callback)) {
scoped_refptr<GetOriginUsageTask> task(
new GetOriginUsageTask(this, webkit_thread_message_loop_, origin_url));
task->Start();
@@ -188,18 +187,17 @@ void IndexedDBQuotaClient::GetOriginUsage(
void IndexedDBQuotaClient::GetOriginsForType(
quota::StorageType type,
- GetOriginsCallback* callback_ptr) {
- DCHECK(callback_ptr);
+ GetOriginsCallback callback) {
+ DCHECK(!callback.is_null());
DCHECK(indexed_db_context_.get());
- scoped_ptr<GetOriginsCallback> callback(callback_ptr);
// All databases are in the temp namespace for now.
if (type != quota::kStorageTypeTemporary) {
- callback->Run(std::set<GURL>(), type);
+ callback.Run(std::set<GURL>(), type);
return;
}
- if (origins_for_type_callbacks_.Add(callback.release())) {
+ if (origins_for_type_callbacks_.Add(callback)) {
scoped_refptr<GetAllOriginsTask> task(
new GetAllOriginsTask(this, webkit_thread_message_loop_, type));
task->Start();
@@ -209,18 +207,17 @@ void IndexedDBQuotaClient::GetOriginsForType(
void IndexedDBQuotaClient::GetOriginsForHost(
quota::StorageType type,
const std::string& host,
- GetOriginsCallback* callback_ptr) {
- DCHECK(callback_ptr);
+ GetOriginsCallback callback) {
+ DCHECK(!callback.is_null());
DCHECK(indexed_db_context_.get());
- scoped_ptr<GetOriginsCallback> callback(callback_ptr);
// All databases are in the temp namespace for now.
if (type != quota::kStorageTypeTemporary) {
- callback->Run(std::set<GURL>(), type);
+ callback.Run(std::set<GURL>(), type);
return;
}
- if (origins_for_host_callbacks_.Add(host, callback.release())) {
+ if (origins_for_host_callbacks_.Add(host, callback)) {
scoped_refptr<GetOriginsForHostTask> task(
new GetOriginsForHostTask(
this, webkit_thread_message_loop_, host, type));
@@ -230,9 +227,9 @@ void IndexedDBQuotaClient::GetOriginsForHost(
void IndexedDBQuotaClient::DeleteOriginData(const GURL& origin,
quota::StorageType type,
- DeletionCallback* callback) {
+ DeletionCallback callback) {
if (type != quota::kStorageTypeTemporary) {
- callback->Run(quota::kQuotaErrorNotSupported);
+ callback.Run(quota::kQuotaErrorNotSupported);
return;
}
scoped_refptr<DeleteOriginTask> task(
awong 2011/09/29 18:05:15 I'm thinking something like webkit_thread_message
tzik 2011/10/11 04:53:57 Sounds good. But this CL is already too big, let m

Powered by Google App Engine
This is Rietveld 408576698