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

Unified Diff: chrome/browser/browsing_data_local_storage_helper.cc

Issue 9704048: Make the content::DOMStorageContext methods callable on the main thread and hide the threading deta… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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: chrome/browser/browsing_data_local_storage_helper.cc
===================================================================
--- chrome/browser/browsing_data_local_storage_helper.cc (revision 126737)
+++ chrome/browser/browsing_data_local_storage_helper.cc (working copy)
@@ -52,7 +52,7 @@
Profile* profile)
: dom_storage_context_(BrowserContext::GetDOMStorageContext(profile)),
is_fetching_(false) {
- DCHECK(dom_storage_context_.get());
+ DCHECK(dom_storage_context_);
}
BrowsingDataLocalStorageHelper::~BrowsingDataLocalStorageHelper() {
@@ -66,11 +66,9 @@
is_fetching_ = true;
completion_callback_ = callback;
- dom_storage_context_->task_runner()->PostTask(
- FROM_HERE,
+ dom_storage_context_->GetAllStorageFiles(
base::Bind(
- &BrowsingDataLocalStorageHelper::FetchLocalStorageInfoHelper,
- this));
+ &BrowsingDataLocalStorageHelper::GetAllStorageFilesCallback, this));
}
void BrowsingDataLocalStorageHelper::CancelNotification() {
@@ -81,16 +79,23 @@
void BrowsingDataLocalStorageHelper::DeleteLocalStorageFile(
const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- dom_storage_context_->task_runner()->PostTask(
+ dom_storage_context_->DeleteLocalStorageFile(file_path);
+}
+
+void BrowsingDataLocalStorageHelper::GetAllStorageFilesCallback(
+ const std::vector<FilePath>& files) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ BrowserThread::PostTask(
+ BrowserThread::FILE,
FROM_HERE,
base::Bind(
- &BrowsingDataLocalStorageHelper::DeleteLocalStorageFileHelper,
- this, file_path));
+ &BrowsingDataLocalStorageHelper::FetchLocalStorageInfo,
+ this, files));
}
-void BrowsingDataLocalStorageHelper::FetchLocalStorageInfoHelper() {
- DCHECK(dom_storage_context_->task_runner()->RunsTasksOnCurrentThread());
- std::vector<FilePath> files = dom_storage_context_->GetAllStorageFiles();
+void BrowsingDataLocalStorageHelper::FetchLocalStorageInfo(
+ const std::vector<FilePath>& files) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
for (size_t i = 0; i < files.size(); ++i) {
FilePath file_path = files[i];
WebSecurityOrigin web_security_origin =
@@ -132,12 +137,6 @@
is_fetching_ = false;
}
-void BrowsingDataLocalStorageHelper::DeleteLocalStorageFileHelper(
- const FilePath& file_path) {
- DCHECK(dom_storage_context_->task_runner()->RunsTasksOnCurrentThread());
- dom_storage_context_->DeleteLocalStorageFile(file_path);
-}
-
//---------------------------------------------------------
CannedBrowsingDataLocalStorageHelper::CannedBrowsingDataLocalStorageHelper(

Powered by Google App Engine
This is Rietveld 408576698