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

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

Issue 17518004: Move IndexedDB from WEBKIT_DEPRECATED to dedicated thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing files Created 7 years, 6 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/indexed_db/indexed_db_quota_client.cc
diff --git a/content/browser/indexed_db/indexed_db_quota_client.cc b/content/browser/indexed_db/indexed_db_quota_client.cc
index eedd3226e7e70ba042c0d672e014547f9f06135f..dac82bc4d3ebeb86c92e853f866c18f6548f6fa5 100644
--- a/content/browser/indexed_db/indexed_db_quota_client.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client.cc
@@ -7,7 +7,6 @@
#include <vector>
#include "base/logging.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "content/browser/indexed_db/indexed_db_context_impl.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/net_util.h"
@@ -19,22 +18,22 @@ using webkit_database::DatabaseUtil;
namespace content {
namespace {
-quota::QuotaStatusCode DeleteOriginDataOnWebKitThread(
+quota::QuotaStatusCode DeleteOriginDataOnIndexedDBThread(
IndexedDBContextImpl* context,
const GURL& origin) {
context->DeleteForOrigin(origin);
return quota::kQuotaStatusOk;
}
-int64 GetOriginUsageOnWebKitThread(IndexedDBContextImpl* context,
+int64 GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context,
const GURL& origin) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ DCHECK(context->OnIndexedDBThread());
return context->GetOriginDiskUsage(origin);
}
-void GetAllOriginsOnWebKitThread(IndexedDBContextImpl* context,
+void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context,
std::set<GURL>* origins_to_return) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ DCHECK(context->OnIndexedDBThread());
std::vector<GURL> all_origins = context->GetAllOrigins();
origins_to_return->insert(all_origins.begin(), all_origins.end());
}
@@ -45,10 +44,10 @@ void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback,
callback.Run(*origins);
}
-void GetOriginsForHostOnWebKitThread(IndexedDBContextImpl* context,
+void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context,
const std::string& host,
std::set<GURL>* origins_to_return) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ DCHECK(context->OnIndexedDBThread());
std::vector<GURL> all_origins = context->GetAllOrigins();
for (std::vector<GURL>::const_iterator iter = all_origins.begin();
iter != all_origins.end();
@@ -63,10 +62,8 @@ void GetOriginsForHostOnWebKitThread(IndexedDBContextImpl* context,
// IndexedDBQuotaClient --------------------------------------------------------
IndexedDBQuotaClient::IndexedDBQuotaClient(
- base::MessageLoopProxy* webkit_thread_message_loop,
IndexedDBContextImpl* indexed_db_context)
- : webkit_thread_message_loop_(webkit_thread_message_loop),
- indexed_db_context_(indexed_db_context) {}
+ : indexed_db_context_(indexed_db_context) {}
IndexedDBQuotaClient::~IndexedDBQuotaClient() {}
@@ -87,10 +84,10 @@ void IndexedDBQuotaClient::GetOriginUsage(const GURL& origin_url,
}
base::PostTaskAndReplyWithResult(
- webkit_thread_message_loop_.get(),
+ indexed_db_context_->TaskRunner(),
FROM_HERE,
base::Bind(
- &GetOriginUsageOnWebKitThread, indexed_db_context_, origin_url),
+ &GetOriginUsageOnIndexedDBThread, indexed_db_context_, origin_url),
callback);
}
@@ -107,9 +104,9 @@ void IndexedDBQuotaClient::GetOriginsForType(
}
std::set<GURL>* origins_to_return = new std::set<GURL>();
- webkit_thread_message_loop_->PostTaskAndReply(
+ indexed_db_context_->TaskRunner()->PostTaskAndReply(
FROM_HERE,
- base::Bind(&GetAllOriginsOnWebKitThread,
+ base::Bind(&GetAllOriginsOnIndexedDBThread,
indexed_db_context_,
base::Unretained(origins_to_return)),
base::Bind(&DidGetOrigins, callback, base::Owned(origins_to_return)));
@@ -129,9 +126,9 @@ void IndexedDBQuotaClient::GetOriginsForHost(
}
std::set<GURL>* origins_to_return = new std::set<GURL>();
- webkit_thread_message_loop_->PostTaskAndReply(
+ indexed_db_context_->TaskRunner()->PostTaskAndReply(
FROM_HERE,
- base::Bind(&GetOriginsForHostOnWebKitThread,
+ base::Bind(&GetOriginsForHostOnIndexedDBThread,
indexed_db_context_,
host,
base::Unretained(origins_to_return)),
@@ -147,9 +144,10 @@ void IndexedDBQuotaClient::DeleteOriginData(const GURL& origin,
}
base::PostTaskAndReplyWithResult(
- webkit_thread_message_loop_.get(),
+ indexed_db_context_->TaskRunner(),
FROM_HERE,
- base::Bind(&DeleteOriginDataOnWebKitThread, indexed_db_context_, origin),
+ base::Bind(
+ &DeleteOriginDataOnIndexedDBThread, indexed_db_context_, origin),
callback);
}

Powered by Google App Engine
This is Rietveld 408576698