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

Unified Diff: chrome/browser/browsing_data_local_storage_helper.cc

Issue 9700007: ContentAPI change - Post DomStorage tasks via a SequencedTaskRunner instead of directly to WEBKIT_DE (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 126447)
+++ chrome/browser/browsing_data_local_storage_helper.cc (working copy)
@@ -66,8 +66,8 @@
is_fetching_ = true;
completion_callback_ = callback;
- BrowserThread::PostTask(
- BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
+ dom_storage_context_->task_runner()->PostTask(
+ FROM_HERE,
base::Bind(
&BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread,
this));
@@ -81,15 +81,15 @@
void BrowsingDataLocalStorageHelper::DeleteLocalStorageFile(
const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- BrowserThread::PostTask(
- BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
+ dom_storage_context_->task_runner()->PostTask(
+ FROM_HERE,
base::Bind(
&BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread,
this, file_path));
}
void BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread() {
michaeln 2012/03/14 05:17:26 i'll change these methods names to read <DoX>InSeq
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ DCHECK(dom_storage_context_->task_runner()->RunsTasksOnCurrentThread());
std::vector<FilePath> files = dom_storage_context_->GetAllStorageFiles();
for (size_t i = 0; i < files.size(); ++i) {
FilePath file_path = files[i];
@@ -134,10 +134,12 @@
void BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread(
const FilePath& file_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ DCHECK(dom_storage_context_->task_runner()->RunsTasksOnCurrentThread());
dom_storage_context_->DeleteLocalStorageFile(file_path);
}
+//---------------------------------------------------------
+
CannedBrowsingDataLocalStorageHelper::CannedBrowsingDataLocalStorageHelper(
Profile* profile)
: BrowsingDataLocalStorageHelper(profile),
@@ -150,7 +152,6 @@
CannedBrowsingDataLocalStorageHelper* clone =
new CannedBrowsingDataLocalStorageHelper(profile_);
- base::AutoLock auto_lock(lock_);
clone->pending_local_storage_info_ = pending_local_storage_info_;
clone->local_storage_info_ = local_storage_info_;
return clone;
@@ -158,18 +159,15 @@
void CannedBrowsingDataLocalStorageHelper::AddLocalStorage(
const GURL& origin) {
- base::AutoLock auto_lock(lock_);
pending_local_storage_info_.insert(origin);
}
void CannedBrowsingDataLocalStorageHelper::Reset() {
- base::AutoLock auto_lock(lock_);
local_storage_info_.clear();
pending_local_storage_info_.clear();
}
bool CannedBrowsingDataLocalStorageHelper::empty() const {
- base::AutoLock auto_lock(lock_);
return local_storage_info_.empty() && pending_local_storage_info_.empty();
}
@@ -181,16 +179,17 @@
is_fetching_ = true;
completion_callback_ = callback;
- BrowserThread::PostTask(
- BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
+
+ // We post a task to emulate async fetching behavior.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&CannedBrowsingDataLocalStorageHelper::
- ConvertPendingInfoInWebKitThread, this));
+ ConvertPendingInfo, this));
}
CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {}
-void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfoInWebKitThread() {
- base::AutoLock auto_lock(lock_);
+void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfo() {
for (std::set<GURL>::iterator info = pending_local_storage_info_.begin();
info != pending_local_storage_info_.end(); ++info) {
WebSecurityOrigin web_security_origin =

Powered by Google App Engine
This is Rietveld 408576698