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

Unified Diff: webkit/fileapi/file_system_quota_client.cc

Issue 8070001: Use base::Callback in Quota related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 2 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
« no previous file with comments | « webkit/fileapi/file_system_quota_client.h ('k') | webkit/fileapi/file_system_quota_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_quota_client.cc
diff --git a/webkit/fileapi/file_system_quota_client.cc b/webkit/fileapi/file_system_quota_client.cc
index 3f8e2e5f2dfb71f19027961df47eca679ebe72b6..662f1ffe9455c7ddef24fc60baac792942d5b673 100644
--- a/webkit/fileapi/file_system_quota_client.cc
+++ b/webkit/fileapi/file_system_quota_client.cc
@@ -138,7 +138,7 @@ class FileSystemQuotaClient::DeleteOriginTask
scoped_refptr<MessageLoopProxy> file_message_loop,
const GURL& origin,
FileSystemType type,
- DeletionCallback* callback)
+ const DeletionCallback& callback)
: QuotaThreadTask(quota_client, file_message_loop),
file_system_context_(quota_client->file_system_context_),
origin_(origin),
@@ -158,14 +158,14 @@ class FileSystemQuotaClient::DeleteOriginTask
}
virtual void Completed() OVERRIDE {
- callback_->Run(status_);
+ callback_.Run(status_);
}
private:
FileSystemContext* file_system_context_;
GURL origin_;
FileSystemType type_;
quota::QuotaStatusCode status_;
- scoped_ptr<DeletionCallback> callback_;
+ DeletionCallback callback_;
};
FileSystemQuotaClient::FileSystemQuotaClient(
@@ -192,13 +192,12 @@ void FileSystemQuotaClient::OnQuotaManagerDestroyed() {
void FileSystemQuotaClient::GetOriginUsage(
const GURL& origin_url,
StorageType storage_type,
- GetUsageCallback* callback_ptr) {
- DCHECK(callback_ptr);
- scoped_ptr<GetUsageCallback> callback(callback_ptr);
+ const GetUsageCallback& callback) {
+ DCHECK(!callback.is_null());
if (is_incognito_) {
// We don't support FileSystem in incognito mode yet.
- callback->Run(0);
+ callback.Run(0);
return;
}
@@ -206,7 +205,7 @@ void FileSystemQuotaClient::GetOriginUsage(
DCHECK(type != kFileSystemTypeUnknown);
if (pending_usage_callbacks_.Add(
- std::make_pair(type, origin_url.spec()), callback.release())) {
+ std::make_pair(type, origin_url.spec()), callback)) {
scoped_refptr<GetOriginUsageTask> task(
new GetOriginUsageTask(this, file_message_loop_, origin_url, type));
task->Start();
@@ -215,19 +214,20 @@ void FileSystemQuotaClient::GetOriginUsage(
void FileSystemQuotaClient::GetOriginsForType(
StorageType storage_type,
- GetOriginsCallback* callback_ptr) {
+ const GetOriginsCallback& callback) {
+ DCHECK(!callback.is_null());
+
std::set<GURL> origins;
- scoped_ptr<GetOriginsCallback> callback(callback_ptr);
if (is_incognito_) {
// We don't support FileSystem in incognito mode yet.
- callback->Run(origins, storage_type);
+ callback.Run(origins, storage_type);
return;
}
FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
DCHECK(type != kFileSystemTypeUnknown);
- if (pending_origins_for_type_callbacks_.Add(type, callback.release())) {
+ if (pending_origins_for_type_callbacks_.Add(type, callback)) {
scoped_refptr<GetOriginsForTypeTask> task(
new GetOriginsForTypeTask(this, file_message_loop_, type));
task->Start();
@@ -237,12 +237,13 @@ void FileSystemQuotaClient::GetOriginsForType(
void FileSystemQuotaClient::GetOriginsForHost(
StorageType storage_type,
const std::string& host,
- GetOriginsCallback* callback_ptr) {
+ const GetOriginsCallback& callback) {
+ DCHECK(!callback.is_null());
+
std::set<GURL> origins;
- scoped_ptr<GetOriginsCallback> callback(callback_ptr);
if (is_incognito_) {
// We don't support FileSystem in incognito mode yet.
- callback->Run(origins, storage_type);
+ callback.Run(origins, storage_type);
return;
}
@@ -250,7 +251,7 @@ void FileSystemQuotaClient::GetOriginsForHost(
DCHECK(type != kFileSystemTypeUnknown);
if (pending_origins_for_host_callbacks_.Add(
- std::make_pair(type, host), callback.release())) {
+ std::make_pair(type, host), callback)) {
scoped_refptr<GetOriginsForHostTask> task(
new GetOriginsForHostTask(this, file_message_loop_,
type, host));
@@ -260,7 +261,7 @@ void FileSystemQuotaClient::GetOriginsForHost(
void FileSystemQuotaClient::DeleteOriginData(const GURL& origin,
StorageType type,
- DeletionCallback* callback) {
+ const DeletionCallback& callback) {
FileSystemType fs_type = QuotaStorageTypeToFileSystemType(type);
DCHECK(fs_type != kFileSystemTypeUnknown);
scoped_refptr<DeleteOriginTask> task(
« no previous file with comments | « webkit/fileapi/file_system_quota_client.h ('k') | webkit/fileapi/file_system_quota_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698