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

Side by Side Diff: chrome/browser/browsing_data_indexed_db_helper.h

Issue 7676002: When deleting storage through the cookies tree model, also update its cache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_INDEXED_DB_HELPER_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list>
9 #include <string> 10 #include <string>
10 #include <vector>
11 11
12 #include "base/callback_old.h" 12 #include "base/callback_old.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 20
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 }; 57 };
58 58
59 // Create a BrowsingDataIndexedDBHelper instance for the indexed databases 59 // Create a BrowsingDataIndexedDBHelper instance for the indexed databases
60 // stored in |profile|'s user data directory. 60 // stored in |profile|'s user data directory.
61 static BrowsingDataIndexedDBHelper* Create(Profile* profile); 61 static BrowsingDataIndexedDBHelper* Create(Profile* profile);
62 62
63 // Starts the fetching process, which will notify its completion via 63 // Starts the fetching process, which will notify its completion via
64 // callback. 64 // callback.
65 // This must be called only in the UI thread. 65 // This must be called only in the UI thread.
66 virtual void StartFetching( 66 virtual void StartFetching(
67 Callback1<const std::vector<IndexedDBInfo>& >::Type* callback) = 0; 67 Callback1<const std::list<IndexedDBInfo>& >::Type* callback) = 0;
68 // Cancels the notification callback (i.e., the window that created it no 68 // Cancels the notification callback (i.e., the window that created it no
69 // longer exists). 69 // longer exists).
70 // This must be called only in the UI thread. 70 // This must be called only in the UI thread.
71 virtual void CancelNotification() = 0; 71 virtual void CancelNotification() = 0;
72 // Requests a single indexed database file to be deleted in the WEBKIT thread. 72 // Requests a single indexed database file to be deleted in the WEBKIT thread.
73 virtual void DeleteIndexedDBFile(const FilePath& file_path) = 0; 73 virtual void DeleteIndexedDBFile(const FilePath& file_path) = 0;
74 74
75 protected: 75 protected:
76 friend class base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper>; 76 friend class base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper>;
77 virtual ~BrowsingDataIndexedDBHelper() {} 77 virtual ~BrowsingDataIndexedDBHelper() {}
(...skipping 18 matching lines...) Expand all
96 const string16& description); 96 const string16& description);
97 97
98 // Clear the list of canned indexed databases. 98 // Clear the list of canned indexed databases.
99 void Reset(); 99 void Reset();
100 100
101 // True if no indexed databases are currently stored. 101 // True if no indexed databases are currently stored.
102 bool empty() const; 102 bool empty() const;
103 103
104 // BrowsingDataIndexedDBHelper methods. 104 // BrowsingDataIndexedDBHelper methods.
105 virtual void StartFetching( 105 virtual void StartFetching(
106 Callback1<const std::vector<IndexedDBInfo>& >::Type* callback); 106 Callback1<const std::list<IndexedDBInfo>& >::Type* callback);
107 virtual void CancelNotification(); 107 virtual void CancelNotification();
108 virtual void DeleteIndexedDBFile(const FilePath& file_path) {} 108 virtual void DeleteIndexedDBFile(const FilePath& file_path) {}
109 109
110 private: 110 private:
111 struct PendingIndexedDBInfo { 111 struct PendingIndexedDBInfo {
112 PendingIndexedDBInfo(); 112 PendingIndexedDBInfo();
113 PendingIndexedDBInfo(const GURL& origin, const string16& description); 113 PendingIndexedDBInfo(const GURL& origin, const string16& description);
114 ~PendingIndexedDBInfo(); 114 ~PendingIndexedDBInfo();
115 115
116 GURL origin; 116 GURL origin;
117 string16 description; 117 string16 description;
118 }; 118 };
119 119
120 virtual ~CannedBrowsingDataIndexedDBHelper(); 120 virtual ~CannedBrowsingDataIndexedDBHelper();
121 121
122 // Convert the pending indexed db info to indexed db info objects. 122 // Convert the pending indexed db info to indexed db info objects.
123 void ConvertPendingInfoInWebKitThread(); 123 void ConvertPendingInfoInWebKitThread();
124 124
125 void NotifyInUIThread(); 125 void NotifyInUIThread();
126 126
127 Profile* profile_; 127 Profile* profile_;
128 128
129 // Lock to protect access to pending_indexed_db_info_; 129 // Lock to protect access to pending_indexed_db_info_;
130 mutable base::Lock lock_; 130 mutable base::Lock lock_;
131 131
132 // This may mutate on WEBKIT and UI threads. 132 // This may mutate on WEBKIT and UI threads.
133 std::vector<PendingIndexedDBInfo> pending_indexed_db_info_; 133 std::list<PendingIndexedDBInfo> pending_indexed_db_info_;
134 134
135 // This only mutates on the WEBKIT thread. 135 // This only mutates on the WEBKIT thread.
136 std::vector<IndexedDBInfo> indexed_db_info_; 136 std::list<IndexedDBInfo> indexed_db_info_;
137 137
138 // This only mutates on the UI thread. 138 // This only mutates on the UI thread.
139 scoped_ptr<Callback1<const std::vector<IndexedDBInfo>& >::Type > 139 scoped_ptr<Callback1<const std::list<IndexedDBInfo>& >::Type >
140 completion_callback_; 140 completion_callback_;
141 141
142 // Indicates whether or not we're currently fetching information: 142 // Indicates whether or not we're currently fetching information:
143 // it's true when StartFetching() is called in the UI thread, and it's reset 143 // it's true when StartFetching() is called in the UI thread, and it's reset
144 // after we notified the callback in the UI thread. 144 // after we notified the callback in the UI thread.
145 // This only mutates on the UI thread. 145 // This only mutates on the UI thread.
146 bool is_fetching_; 146 bool is_fetching_;
147 147
148 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); 148 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper);
149 }; 149 };
150 150
151 #endif // CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ 151 #endif // CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698