| Index: chrome/browser/browsing_data_indexed_db_helper.h
|
| diff --git a/chrome/browser/browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data_indexed_db_helper.h
|
| index 6be7bbeedd927357bce71adac434d0b662b8c0e5..7000a208fcb8aab0a10e220cf8bb469af816583d 100644
|
| --- a/chrome/browser/browsing_data_indexed_db_helper.h
|
| +++ b/chrome/browser/browsing_data_indexed_db_helper.h
|
| @@ -7,6 +7,7 @@
|
| #pragma once
|
|
|
| #include <list>
|
| +#include <set>
|
| #include <string>
|
|
|
| #include "base/callback.h"
|
| @@ -16,7 +17,6 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/synchronization/lock.h"
|
| #include "base/time.h"
|
| -#include "chrome/common/url_constants.h"
|
| #include "googleurl/src/gurl.h"
|
|
|
| class Profile;
|
| @@ -66,6 +66,17 @@ class BrowsingDataIndexedDBHelper
|
| class CannedBrowsingDataIndexedDBHelper
|
| : public BrowsingDataIndexedDBHelper {
|
| public:
|
| + // Contains information about an indexed database.
|
| + struct PendingIndexedDBInfo {
|
| + PendingIndexedDBInfo(const GURL& origin, const string16& name);
|
| + ~PendingIndexedDBInfo();
|
| +
|
| + bool operator<(const PendingIndexedDBInfo& other) const;
|
| +
|
| + GURL origin;
|
| + string16 name;
|
| + };
|
| +
|
| CannedBrowsingDataIndexedDBHelper();
|
|
|
| // Return a copy of the IndexedDB helper. Only one consumer can use the
|
| @@ -76,7 +87,7 @@ class CannedBrowsingDataIndexedDBHelper
|
| // Add a indexed database to the set of canned indexed databases that is
|
| // returned by this helper.
|
| void AddIndexedDB(const GURL& origin,
|
| - const string16& description);
|
| + const string16& name);
|
|
|
| // Clear the list of canned indexed databases.
|
| void Reset();
|
| @@ -87,22 +98,18 @@ class CannedBrowsingDataIndexedDBHelper
|
| // Returns the number of currently stored indexed databases.
|
| size_t GetIndexedDBCount() const;
|
|
|
| + // Returns the current list of indexed data bases.
|
| + const std::set<CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo>&
|
| + GetIndexedDBInfo() const;
|
| +
|
| // BrowsingDataIndexedDBHelper methods.
|
| virtual void StartFetching(
|
| const base::Callback<void(const std::list<IndexedDBInfo>&)>&
|
| callback) OVERRIDE;
|
| +
|
| virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE {}
|
|
|
| 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.
|
| @@ -113,10 +120,16 @@ class CannedBrowsingDataIndexedDBHelper
|
| // Lock to protect access to pending_indexed_db_info_;
|
| mutable base::Lock lock_;
|
|
|
| - // This may mutate on WEBKIT and UI threads.
|
| - std::list<PendingIndexedDBInfo> pending_indexed_db_info_;
|
| + // Access to |pending_indexed_db_info_| is protected by |lock_| since it can
|
| + // be accessed on the UI and on the WEBKIT thread.
|
| + std::set<PendingIndexedDBInfo> pending_indexed_db_info_;
|
|
|
| - // This only mutates on the WEBKIT thread.
|
| + // Access to |indexed_db_info_| is triggered indirectly via the UI thread and
|
| + // guarded by |is_fetching_|. This means |indexed_db_info_| is only accessed
|
| + // while |is_fetching_| is true. The flag |is_fetching_| is only accessed on
|
| + // the UI thread.
|
| + // In the context of this class |indexed_db_info_| is only accessed on the UI
|
| + // thread.
|
| std::list<IndexedDBInfo> indexed_db_info_;
|
|
|
| // This only mutates on the UI thread.
|
|
|