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

Unified Diff: chrome/browser/browsing_data_local_storage_helper.h

Issue 6246105: Only invoke WebKit methods in browsing data helpers on the WEBKIT thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 10 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.h
diff --git a/chrome/browser/browsing_data_local_storage_helper.h b/chrome/browser/browsing_data_local_storage_helper.h
index f363542a05e7b4d38e6c1eb1976388fa6f9324f4..227b2009079a7815e5ab858eb9af3b42eef8f2cc 100644
--- a/chrome/browser/browsing_data_local_storage_helper.h
+++ b/chrome/browser/browsing_data_local_storage_helper.h
@@ -12,6 +12,7 @@
#include "base/callback.h"
#include "base/file_path.h"
#include "base/scoped_ptr.h"
+#include "base/synchronization/lock.h"
#include "base/time.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
@@ -74,28 +75,30 @@ class BrowsingDataLocalStorageHelper
friend class base::RefCountedThreadSafe<BrowsingDataLocalStorageHelper>;
virtual ~BrowsingDataLocalStorageHelper();
- Profile* profile_;
-
- // This only mutates in the WEBKIT thread.
- std::vector<LocalStorageInfo> local_storage_info_;
-
- private:
- // Enumerates all local storage files in the WEBKIT thread.
- void FetchLocalStorageInfoInWebKitThread();
// Notifies the completion callback in the UI thread.
void NotifyInUIThread();
- // Delete a single local storage file in the WEBKIT thread.
- void DeleteLocalStorageFileInWebKitThread(const FilePath& file_path);
+
+ Profile* profile_;
// This only mutates on the UI thread.
scoped_ptr<Callback1<const std::vector<LocalStorageInfo>& >::Type >
completion_callback_;
+
// Indicates whether or not we're currently fetching information:
// it's true when StartFetching() is called in the UI thread, and it's reset
// after we notified the callback in the UI thread.
// This only mutates on the UI thread.
bool is_fetching_;
+ // This only mutates in the WEBKIT thread.
+ std::vector<LocalStorageInfo> local_storage_info_;
+
+ private:
+ // Enumerates all local storage files in the WEBKIT thread.
+ void FetchLocalStorageInfoInWebKitThread();
+ // Delete a single local storage file in the WEBKIT thread.
+ void DeleteLocalStorageFileInWebKitThread(const FilePath& file_path);
+
DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper);
};
@@ -125,6 +128,15 @@ class CannedBrowsingDataLocalStorageHelper
private:
virtual ~CannedBrowsingDataLocalStorageHelper() {}
+ // Convert the pending local storage info to local storage info objects.
+ void ConvertPendingInfoInWebKitThread();
+
+ // Used to protect access to pending_local_storage_info_.
+ mutable base::Lock lock_;
+
+ // May mutate on WEBKIT and UI threads.
+ std::vector<GURL> pending_local_storage_info_;
+
DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper);
};

Powered by Google App Engine
This is Rietveld 408576698