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

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

Issue 17518004: Move IndexedDB from WEBKIT_DEPRECATED to dedicated thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: IOS build fix 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_internals_ui.cc
diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc
index c070e574ad110ca8ef53542012abf33f27254fe9..ae834ea9f111284b1b6b0d91ab8418dc2ceedbf1 100644
--- a/content/browser/indexed_db/indexed_db_internals_ui.cc
+++ b/content/browser/indexed_db/indexed_db_internals_ui.cc
@@ -59,12 +59,14 @@ IndexedDBInternalsUI::IndexedDBInternalsUI(WebUI* web_ui)
IndexedDBInternalsUI::~IndexedDBInternalsUI() {}
void IndexedDBInternalsUI::AddContextFromStoragePartition(
- ContextList* contexts,
- std::vector<base::FilePath>* paths,
StoragePartition* partition) {
scoped_refptr<IndexedDBContext> context = partition->GetIndexedDBContext();
- contexts->push_back(context);
- paths->push_back(partition->GetPath());
+ context->TaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&IndexedDBInternalsUI::GetAllOriginsOnIndexedDBThread,
+ base::Unretained(this),
+ context,
+ partition->GetPath()));
}
void IndexedDBInternalsUI::GetAllOrigins(const base::ListValue* args) {
@@ -73,50 +75,30 @@ void IndexedDBInternalsUI::GetAllOrigins(const base::ListValue* args) {
BrowserContext* browser_context =
web_ui()->GetWebContents()->GetBrowserContext();
- scoped_ptr<std::vector<base::FilePath> > paths(
- new std::vector<base::FilePath>);
- scoped_ptr<ContextList> contexts(new ContextList);
BrowserContext::StoragePartitionCallback cb =
- base::Bind(&AddContextFromStoragePartition, contexts.get(), paths.get());
+ base::Bind(&IndexedDBInternalsUI::AddContextFromStoragePartition,
+ base::Unretained(this));
BrowserContext::ForEachStoragePartition(browser_context, cb);
-
- BrowserThread::PostTask(
- BrowserThread::WEBKIT_DEPRECATED,
- FROM_HERE,
- base::Bind(&IndexedDBInternalsUI::GetAllOriginsOnWebkitThread,
- base::Unretained(this),
- base::Passed(&contexts),
- base::Passed(&paths)));
}
-bool HostNameComparator(const IndexedDBInfo& i, const IndexedDBInfo& j) {
+static bool HostNameComparator(const IndexedDBInfo& i, const IndexedDBInfo& j) {
return i.origin_.host() < j.origin_.host();
}
-void IndexedDBInternalsUI::GetAllOriginsOnWebkitThread(
- const scoped_ptr<ContextList> contexts,
- const scoped_ptr<std::vector<base::FilePath> > context_paths) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
- DCHECK_EQ(contexts->size(), context_paths->size());
-
- std::vector<base::FilePath>::const_iterator path_iter =
- context_paths->begin();
- for (ContextList::const_iterator iter = contexts->begin();
- iter != contexts->end();
- ++iter, ++path_iter) {
- IndexedDBContext* context = iter->get();
- const base::FilePath& context_path = *path_iter;
-
- scoped_ptr<std::vector<IndexedDBInfo> > info_list(
- new std::vector<IndexedDBInfo>(context->GetAllOriginsInfo()));
- std::sort(info_list->begin(), info_list->end(), HostNameComparator);
- BrowserThread::PostTask(BrowserThread::UI,
- FROM_HERE,
- base::Bind(&IndexedDBInternalsUI::OnOriginsReady,
- base::Unretained(this),
- base::Passed(&info_list),
- context_path));
- }
+void IndexedDBInternalsUI::GetAllOriginsOnIndexedDBThread(
+ scoped_refptr<IndexedDBContext> context,
+ const base::FilePath& context_path) {
+ DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread());
+
+ scoped_ptr<std::vector<IndexedDBInfo> > info_list(
+ new std::vector<IndexedDBInfo>(context->GetAllOriginsInfo()));
+ std::sort(info_list->begin(), info_list->end(), HostNameComparator);
+ BrowserThread::PostTask(BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&IndexedDBInternalsUI::OnOriginsReady,
+ base::Unretained(this),
+ base::Passed(&info_list),
+ context_path));
}
void IndexedDBInternalsUI::OnOriginsReady(
@@ -176,21 +158,20 @@ void IndexedDBInternalsUI::DownloadOriginData(const base::ListValue* args) {
DCHECK(result_partition);
DCHECK(result_context.get());
- BrowserThread::PostTask(
- BrowserThread::WEBKIT_DEPRECATED,
+ result_context->TaskRunner()->PostTask(
FROM_HERE,
- base::Bind(&IndexedDBInternalsUI::DownloadOriginDataOnWebkitThread,
+ base::Bind(&IndexedDBInternalsUI::DownloadOriginDataOnIndexedDBThread,
base::Unretained(this),
result_partition->GetPath(),
result_context,
origin_url));
}
-void IndexedDBInternalsUI::DownloadOriginDataOnWebkitThread(
+void IndexedDBInternalsUI::DownloadOriginDataOnIndexedDBThread(
const base::FilePath& partition_path,
const scoped_refptr<IndexedDBContextImpl> context,
const GURL& origin_url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread());
if (!context->IsInOriginSet(origin_url))
return;
« no previous file with comments | « content/browser/indexed_db/indexed_db_internals_ui.h ('k') | content/browser/indexed_db/indexed_db_quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698