diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 15:27:55 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 15:27:55 +0000 |
commit | 0c7a6b2d0bc0ab111013601882cf4b8813d24f35 (patch) | |
tree | e763c887b93c6f35ca764a62f081889cd92b6c0c /chrome/browser/browsing_data_indexed_db_helper.h | |
parent | 248ce19f35b73cdd48ba005c7e4e7b3bc34817fc (diff) | |
download | chromium_src-0c7a6b2d0bc0ab111013601882cf4b8813d24f35.zip chromium_src-0c7a6b2d0bc0ab111013601882cf4b8813d24f35.tar.gz chromium_src-0c7a6b2d0bc0ab111013601882cf4b8813d24f35.tar.bz2 |
Only invoke WebKit methods in browsing data helpers on the WEBKIT thread.
BUG=71786
TEST=browser & unit tests
Review URL: http://codereview.chromium.org/6246105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data_indexed_db_helper.h')
-rw-r--r-- | chrome/browser/browsing_data_indexed_db_helper.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/chrome/browser/browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data_indexed_db_helper.h index 129987b..e0f25b6 100644 --- a/chrome/browser/browsing_data_indexed_db_helper.h +++ b/chrome/browser/browsing_data_indexed_db_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,8 @@ #include "base/callback.h" #include "base/file_path.h" #include "base/ref_counted.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" @@ -101,12 +103,43 @@ class CannedBrowsingDataIndexedDBHelper virtual void DeleteIndexedDBFile(const FilePath& file_path) {} private: + struct PendingIndexedDBInfo { + PendingIndexedDBInfo(); + PendingIndexedDBInfo(const GURL& origin, const string16& description); + ~PendingIndexedDBInfo(); + + GURL origin; + string16 description; + }; + virtual ~CannedBrowsingDataIndexedDBHelper(); + // Convert the pending indexed db info to indexed db info objects. + void ConvertPendingInfoInWebKitThread(); + + void NotifyInUIThread(); + Profile* profile_; + // Lock to protect access to pending_indexed_db_info_; + mutable base::Lock lock_; + + // This may mutate on WEBKIT and UI threads. + std::vector<PendingIndexedDBInfo> pending_indexed_db_info_; + + // This only mutates on the WEBKIT thread. std::vector<IndexedDBInfo> indexed_db_info_; + // This only mutates on the UI thread. + scoped_ptr<Callback1<const std::vector<IndexedDBInfo>& >::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_; + DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); }; |