| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Indicates whether or not we're currently fetching information: | 92 // Indicates whether or not we're currently fetching information: |
| 93 // it's true when StartFetching() is called in the UI thread, and it's reset | 93 // it's true when StartFetching() is called in the UI thread, and it's reset |
| 94 // after we notified the callback in the UI thread. | 94 // after we notified the callback in the UI thread. |
| 95 // This only mutates on the UI thread. | 95 // This only mutates on the UI thread. |
| 96 bool is_fetching_; | 96 bool is_fetching_; |
| 97 | 97 |
| 98 // This only mutates in the WEBKIT thread. | 98 // This only mutates in the WEBKIT thread. |
| 99 std::list<LocalStorageInfo> local_storage_info_; | 99 std::list<LocalStorageInfo> local_storage_info_; |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 // Enumerates all local storage files in the WEBKIT thread. | 102 // Enumerates all local storage files in a sequenced task. |
| 103 void FetchLocalStorageInfoInWebKitThread(); | 103 void FetchLocalStorageInfoHelper(); |
| 104 // Delete a single local storage file in the WEBKIT thread. | 104 // Delete a single local storage file in a sequenced task. |
| 105 void DeleteLocalStorageFileInWebKitThread(const FilePath& file_path); | 105 void DeleteLocalStorageFileHelper(const FilePath& file_path); |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); | 107 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does | 110 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does |
| 111 // not fetch its information from the local storage tracker, but gets them | 111 // not fetch its information from the local storage tracker, but gets them |
| 112 // passed as a parameter during construction. | 112 // passed as a parameter during construction. |
| 113 class CannedBrowsingDataLocalStorageHelper | 113 class CannedBrowsingDataLocalStorageHelper |
| 114 : public BrowsingDataLocalStorageHelper { | 114 : public BrowsingDataLocalStorageHelper { |
| 115 public: | 115 public: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 133 // BrowsingDataLocalStorageHelper implementation. | 133 // BrowsingDataLocalStorageHelper implementation. |
| 134 virtual void StartFetching( | 134 virtual void StartFetching( |
| 135 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) | 135 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) |
| 136 OVERRIDE; | 136 OVERRIDE; |
| 137 virtual void CancelNotification() OVERRIDE {} | 137 virtual void CancelNotification() OVERRIDE {} |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 virtual ~CannedBrowsingDataLocalStorageHelper(); | 140 virtual ~CannedBrowsingDataLocalStorageHelper(); |
| 141 | 141 |
| 142 // Convert the pending local storage info to local storage info objects. | 142 // Convert the pending local storage info to local storage info objects. |
| 143 void ConvertPendingInfoInWebKitThread(); | 143 void ConvertPendingInfo(); |
| 144 | 144 |
| 145 // Used to protect access to pending_local_storage_info_. | |
| 146 mutable base::Lock lock_; | |
| 147 | |
| 148 // May mutate on WEBKIT and UI threads. | |
| 149 std::set<GURL> pending_local_storage_info_; | 145 std::set<GURL> pending_local_storage_info_; |
| 150 | 146 |
| 151 Profile* profile_; | 147 Profile* profile_; |
| 152 | 148 |
| 153 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); | 149 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); |
| 154 }; | 150 }; |
| 155 | 151 |
| 156 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 152 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
| OLD | NEW |