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

Side by Side Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 7864008: Split initial load of cookies by domains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" 5 #include "chrome/browser/net/sqlite_persistent_cookie_store.h"
6 6
7 #include <list>
8
9 #include "base/basictypes.h" 7 #include "base/basictypes.h"
10 #include "base/bind.h" 8 #include "base/bind.h"
11 #include "base/file_path.h" 9 #include "base/file_path.h"
12 #include "base/file_util.h" 10 #include "base/file_util.h"
13 #include "base/logging.h" 11 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
16 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
17 #include "base/string_util.h" 15 #include "base/string_util.h"
18 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
19 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
20 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" 18 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
21 #include "content/browser/browser_thread.h" 19 #include "content/browser/browser_thread.h"
22 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "net/base/registry_controlled_domain.h"
23 #include "sql/meta_table.h" 22 #include "sql/meta_table.h"
24 #include "sql/statement.h" 23 #include "sql/statement.h"
25 #include "sql/transaction.h" 24 #include "sql/transaction.h"
26 25
27 using base::Time; 26 using base::Time;
28 27
29 // This class is designed to be shared between any calling threads and the 28 // This class is designed to be shared between any calling threads and the
30 // database thread. It batches operations and commits them on a timer. 29 // database thread. It batches operations and commits them on a timer.
31 // This class expects to be Load()'ed once on any thread. Loading occurs 30 // This class expects to be Load()'ed once on any thread. Loading occurs
32 // asynchronously on the DB thread and the caller will be notified on the IO 31 // asynchronously on the DB thread and the caller will be notified on the IO
33 // thread. Subsequent to loading, mutations may be queued by any thread using 32 // thread. Subsequent to loading, mutations may be queued by any thread using
34 // AddCookie, UpdateCookieAccessTime, and DeleteCookie. These are flushed to 33 // AddCookie, UpdateCookieAccessTime, and DeleteCookie. These are flushed to
35 // disk on the DB thread every 30 seconds, 512 operations, or call to Flush(), 34 // disk on the DB thread every 30 seconds, 512 operations, or call to Flush(),
36 // whichever occurs first. 35 // whichever occurs first.
37 class SQLitePersistentCookieStore::Backend 36 class SQLitePersistentCookieStore::Backend
38 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { 37 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> {
39 public: 38 public:
40 explicit Backend(const FilePath& path) 39 explicit Backend(const FilePath& path)
41 : path_(path), 40 : path_(path),
42 db_(NULL), 41 db_(NULL),
43 num_pending_(0), 42 num_pending_(0),
44 clear_local_state_on_exit_(false) { 43 clear_local_state_on_exit_(false) {
45 } 44 }
46 45
47 // Creates or load the SQLite database. 46 // Creates or load the SQLite database.
48 bool Load(const LoadedCallback& loaded_callback); 47 bool Load(const LoadedCallback& loaded_callback);
49 48
49 // Load cookies for the domain key (eTLD+1).
50 bool LoadCookiesForKey(const std::string& domain,
51 const LoadedCallback& loaded_callback);
52
50 // Batch a cookie addition. 53 // Batch a cookie addition.
51 void AddCookie(const net::CookieMonster::CanonicalCookie& cc); 54 void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
52 55
53 // Batch a cookie access time update. 56 // Batch a cookie access time update.
54 void UpdateCookieAccessTime(const net::CookieMonster::CanonicalCookie& cc); 57 void UpdateCookieAccessTime(const net::CookieMonster::CanonicalCookie& cc);
55 58
56 // Batch a cookie deletion. 59 // Batch a cookie deletion.
57 void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc); 60 void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc);
58 61
59 // Commit pending operations as soon as possible. 62 // Commit pending operations as soon as possible.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const net::CookieMonster::CanonicalCookie& cc() const { return cc_; } 96 const net::CookieMonster::CanonicalCookie& cc() const { return cc_; }
94 97
95 private: 98 private:
96 OperationType op_; 99 OperationType op_;
97 net::CookieMonster::CanonicalCookie cc_; 100 net::CookieMonster::CanonicalCookie cc_;
98 }; 101 };
99 102
100 private: 103 private:
101 // Creates or load the SQLite database on DB thread. 104 // Creates or load the SQLite database on DB thread.
102 void LoadAndNotifyOnDBThread(const LoadedCallback& loaded_callback); 105 void LoadAndNotifyOnDBThread(const LoadedCallback& loaded_callback);
103 // Notify the CookieMonster when loading complete. 106
107 // Load cookies for the domain key (eTLD+1) on DB thread.
108 void LoadKeyAndNotifyOnDBThread(const std::string& domains,
109 const LoadedCallback& loaded_callback);
110
111 // Notify the CookieMonster when loading complete for a specific domain key
112 // or for all domain keys.
104 void NotifyOnIOThread( 113 void NotifyOnIOThread(
105 const LoadedCallback& loaded_callback, 114 const LoadedCallback& loaded_callback,
106 bool load_success, 115 bool load_success);
107 const std::vector<net::CookieMonster::CanonicalCookie*>& cookies);
108 // Initialize the data base. 116 // Initialize the data base.
117
109 bool InitializeDatabase(); 118 bool InitializeDatabase();
110 // Load cookies to the data base, and read cookies. 119
111 bool LoadInternal(std::vector<net::CookieMonster::CanonicalCookie*>* cookies); 120 // Chain load cookies from DB by domain key.
121 void ChainLoadCookies(const LoadedCallback& loaded_callback);
122
123 // Load all cookies for a set of domains/hosts
124 bool LoadCookiesForDomains(const std::set<std::string>& key);
112 125
113 // Batch a cookie operation (add or delete) 126 // Batch a cookie operation (add or delete)
114 void BatchOperation(PendingOperation::OperationType op, 127 void BatchOperation(PendingOperation::OperationType op,
115 const net::CookieMonster::CanonicalCookie& cc); 128 const net::CookieMonster::CanonicalCookie& cc);
116 // Commit our pending operations to the database. 129 // Commit our pending operations to the database.
117 void Commit(); 130 void Commit();
118 // Close() executed on the background thread. 131 // Close() executed on the background thread.
119 void InternalBackgroundClose(); 132 void InternalBackgroundClose();
120 133
121 FilePath path_; 134 FilePath path_;
122 scoped_ptr<sql::Connection> db_; 135 scoped_ptr<sql::Connection> db_;
123 sql::MetaTable meta_table_; 136 sql::MetaTable meta_table_;
124 137
125 typedef std::list<PendingOperation*> PendingOperationsList; 138 typedef std::list<PendingOperation*> PendingOperationsList;
126 PendingOperationsList pending_; 139 PendingOperationsList pending_;
127 PendingOperationsList::size_type num_pending_; 140 PendingOperationsList::size_type num_pending_;
128 // True if the persistent store should be deleted upon destruction. 141 // True if the persistent store should be deleted upon destruction.
129 bool clear_local_state_on_exit_; 142 bool clear_local_state_on_exit_;
130 // Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|. 143 // Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|.
131 base::Lock lock_; 144 base::Lock lock_;
132 145
146 // Temporary buffer for cookies loaded from DB.
147 std::vector<net::CookieMonster::CanonicalCookie*> cookies_;
148
149 // List of domain keys(eTLD+1) to be loaded from DB.
erikwright (departed) 2011/09/15 20:56:27 Correct comment to indicate the meaning of the key
150 std::map<std::string, std::set<std::string>> keys_to_load_;
151
152 // Indicates if DB has been initialized.
153 bool initialized_;
154
133 DISALLOW_COPY_AND_ASSIGN(Backend); 155 DISALLOW_COPY_AND_ASSIGN(Backend);
134 }; 156 };
135 157
136 // Version number of the database. In version 4, we migrated the time epoch. 158 // Version number of the database. In version 4, we migrated the time epoch.
137 // If you open the DB with an older version on Mac or Linux, the times will 159 // If you open the DB with an older version on Mac or Linux, the times will
138 // look wonky, but the file will likely be usable. On Windows version 3 and 4 160 // look wonky, but the file will likely be usable. On Windows version 3 and 4
139 // are the same. 161 // are the same.
140 // 162 //
141 // Version 3 updated the database to include the last access time, so we can 163 // Version 3 updated the database to include the last access time, so we can
142 // expire them in decreasing order of use when we've reached the maximum 164 // expire them in decreasing order of use when we've reached the maximum
(...skipping 17 matching lines...) Expand all
160 "secure INTEGER NOT NULL," 182 "secure INTEGER NOT NULL,"
161 "httponly INTEGER NOT NULL," 183 "httponly INTEGER NOT NULL,"
162 "last_access_utc INTEGER NOT NULL)")) 184 "last_access_utc INTEGER NOT NULL)"))
163 return false; 185 return false;
164 } 186 }
165 187
166 // Try to create the index every time. Older versions did not have this index, 188 // Try to create the index every time. Older versions did not have this index,
167 // so we want those people to get it. Ignore errors, since it may exist. 189 // so we want those people to get it. Ignore errors, since it may exist.
168 db->Execute("CREATE INDEX IF NOT EXISTS cookie_times ON cookies" 190 db->Execute("CREATE INDEX IF NOT EXISTS cookie_times ON cookies"
169 " (creation_utc)"); 191 " (creation_utc)");
192
193 db->Execute("CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)");
194
170 return true; 195 return true;
171 } 196 }
172 197
173 } // namespace 198 } // namespace
174 199
175 bool SQLitePersistentCookieStore::Backend::Load( 200 bool SQLitePersistentCookieStore::Backend::Load(
176 const LoadedCallback& loaded_callback) { 201 const LoadedCallback& loaded_callback) {
177 // This function should be called only once per instance. 202 // This function should be called only once per instance.
178 DCHECK(!db_.get()); 203 DCHECK(!db_.get());
179 BrowserThread::PostTask( 204 BrowserThread::PostTask(
180 BrowserThread::DB, FROM_HERE, 205 BrowserThread::DB, FROM_HERE,
181 base::Bind(&Backend::LoadAndNotifyOnDBThread, base::Unretained(this), 206 base::Bind(&Backend::LoadAndNotifyOnDBThread, base::Unretained(this),
erikwright (departed) 2011/09/15 20:56:27 The base::Unretained here is erroneous and dangero
guohui 2011/09/16 18:21:09 Done.
182 loaded_callback)); 207 loaded_callback));
183 return true; 208 return true;
erikwright (departed) 2011/09/15 20:56:27 These 'return true' statements are now useless (li
guohui 2011/09/16 18:21:09 Done.
184 } 209 }
185 210
211 bool SQLitePersistentCookieStore::Backend::LoadCookiesForKey(
212 const std::string& key,
213 const LoadedCallback& loaded_callback) {
214 BrowserThread::PostTask(
215 BrowserThread::DB, FROM_HERE,
216 base::Bind(&Backend::LoadKeyAndNotifyOnDBThread, this,
217 key,
218 loaded_callback));
219 return true;
220 }
221
186 void SQLitePersistentCookieStore::Backend::LoadAndNotifyOnDBThread( 222 void SQLitePersistentCookieStore::Backend::LoadAndNotifyOnDBThread(
187 const LoadedCallback& loaded_callback) { 223 const LoadedCallback& loaded_callback) {
188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
189 std::vector<net::CookieMonster::CanonicalCookie*> cookies;
190 225
191 bool load_success = LoadInternal(&cookies); 226 if (!InitializeDatabase()) {
227 BrowserThread::PostTask(
228 BrowserThread::IO, FROM_HERE,
229 base::Bind(&SQLitePersistentCookieStore::Backend::NotifyOnIOThread,
230 this, loaded_callback, false));
231 } else {
232 ChainLoadCookies(loaded_callback);
233 }
234 }
192 235
193 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 236 void SQLitePersistentCookieStore::Backend::LoadKeyAndNotifyOnDBThread(
194 &SQLitePersistentCookieStore::Backend::NotifyOnIOThread, 237 const std::string& key,
195 base::Unretained(this), loaded_callback, load_success, cookies)); 238 const LoadedCallback& loaded_callback) {
239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
240
241 bool success = false;
242 if (InitializeDatabase()) {
243 std::map<std::string, std::set<std::string> >::iterator
244 it = keys_to_load_.find(key);
245 if (it != keys_to_load_.end()) {
246 success = LoadCookiesForDomains(it->second);
247 keys_to_load_.erase(it);
248 } else {
249 success = true;
250 }
251 }
252
253 BrowserThread::PostTask(
254 BrowserThread::IO, FROM_HERE,
255 base::Bind(&SQLitePersistentCookieStore::Backend::NotifyOnIOThread,
256 this, loaded_callback, success));
196 } 257 }
197 258
198 void SQLitePersistentCookieStore::Backend::NotifyOnIOThread( 259 void SQLitePersistentCookieStore::Backend::NotifyOnIOThread(
199 const LoadedCallback& loaded_callback, 260 const LoadedCallback& loaded_callback,
200 bool load_success, 261 bool load_success) {
201 const std::vector<net::CookieMonster::CanonicalCookie*>& cookies) {
202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
263
264 std::vector<net::CookieMonster::CanonicalCookie*> cookies;
265 {
266 base::AutoLock locked(lock_);
267 cookies = cookies_;
268 cookies_.clear();
269 }
270
203 loaded_callback.Run(cookies); 271 loaded_callback.Run(cookies);
204 } 272 }
205 273
206 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { 274 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() {
275 if (initialized_) {
276 return true;
277 }
278
207 const FilePath dir = path_.DirName(); 279 const FilePath dir = path_.DirName();
208 if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { 280 if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) {
209 return false; 281 return false;
210 } 282 }
211 283
212 db_.reset(new sql::Connection); 284 db_.reset(new sql::Connection);
213 if (!db_->Open(path_)) { 285 if (!db_->Open(path_)) {
214 NOTREACHED() << "Unable to open cookie DB."; 286 NOTREACHED() << "Unable to open cookie DB.";
215 db_.reset(); 287 db_.reset();
216 return false; 288 return false;
217 } 289 }
218 290
219 db_->set_error_delegate(GetErrorHandlerForCookieDb()); 291 db_->set_error_delegate(GetErrorHandlerForCookieDb());
220 292
221 if (!EnsureDatabaseVersion() || !InitTable(db_.get())) { 293 if (!EnsureDatabaseVersion() || !InitTable(db_.get())) {
222 NOTREACHED() << "Unable to open cookie DB."; 294 NOTREACHED() << "Unable to open cookie DB.";
223 db_.reset(); 295 db_.reset();
224 return false; 296 return false;
225 } 297 }
226 298
227 db_->Preload(); 299 db_->Preload();
228 return true;
229 }
230 300
231 bool SQLitePersistentCookieStore::Backend::LoadInternal( 301 // Retrieve all the domains
232 std::vector<net::CookieMonster::CanonicalCookie*>* cookies) { 302 sql::Statement smt(db_->GetUniqueStatement(
233 if (!InitializeDatabase()) { 303 "SELECT DISTINCT host_key FROM cookies"));
234 return false;
235 }
236 304
237 // Slurp all the cookies into the out-vector.
238 sql::Statement smt(db_->GetUniqueStatement(
239 "SELECT creation_utc, host_key, name, value, path, expires_utc, secure, "
240 "httponly, last_access_utc FROM cookies"));
241 if (!smt) { 305 if (!smt) {
242 NOTREACHED() << "select statement prep failed"; 306 NOTREACHED() << "select statement prep failed";
243 db_.reset(); 307 db_.reset();
244 return false; 308 return false;
245 } 309 }
246 310
311 // Build a map of domain keys (eTLD+1) to domains.
247 while (smt.Step()) { 312 while (smt.Step()) {
248 scoped_ptr<net::CookieMonster::CanonicalCookie> cc( 313 std::string domain = smt.ColumnString(0);
249 new net::CookieMonster::CanonicalCookie( 314 std::string key =
250 // The "source" URL is not used with persisted cookies. 315 net::RegistryControlledDomainService::GetDomainAndRegistry(domain);
251 GURL(), // Source 316
252 smt.ColumnString(2), // name 317 std::map<std::string, std::set<std::string> >::iterator it =
253 smt.ColumnString(3), // value 318 keys_to_load_.find(key);
254 smt.ColumnString(1), // domain 319 if (it == keys_to_load_.end()) {
255 smt.ColumnString(4), // path 320 std::set<std::string> domains;
256 std::string(), // TODO(abarth): Persist mac_key 321 domains.insert(domain);
257 std::string(), // TODO(abarth): Persist mac_algorithm 322 keys_to_load_.insert(
258 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc 323 std::pair<std::string, std::set<std::string> >(key, domains));
259 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc 324 } else {
260 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc 325 it->second.insert(domain);
261 smt.ColumnInt(6) != 0, // secure 326 }
262 smt.ColumnInt(7) != 0, // httponly 327 }
263 true)); // has_expires 328
264 DLOG_IF(WARNING, 329 // Reserve space for the maximum amount of cookies a database should have.
265 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; 330 // This prevents multiple vector growth / copies as we append cookies.
266 cookies->push_back(cc.release()); 331 const size_t kMaxCookies = 3300;
erikwright (departed) 2011/09/15 20:56:27 This code (lines 329 to 332) was removed in my CL
332 cookies_.reserve(kMaxCookies);
333
334 initialized_ = true;
335 return true;
336 }
337
338 void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
339 const LoadedCallback& loaded_callback) {
340 bool load_success = true;
341
342 if (keys_to_load_.size() > 0) {
343 // Load cookies for the first domain key.
344 std::map<std::string, std::set<std::string> >::iterator
345 it = keys_to_load_.begin();
346 load_success = LoadCookiesForDomains(it->second);
347 keys_to_load_.erase(it);
348 }
349
350 // If load is successful and there are more domain keys to be loaded,
351 // then post a DB task to continue chain-load;
352 // Otherwise notify on IO thread.
353 if (load_success && keys_to_load_.size() > 0) {
354 BrowserThread::PostTask(
355 BrowserThread::DB, FROM_HERE,
356 base::Bind(&Backend::ChainLoadCookies, this, loaded_callback));
357 } else {
358 BrowserThread::PostTask(
359 BrowserThread::IO, FROM_HERE,
360 base::Bind(&SQLitePersistentCookieStore::Backend::NotifyOnIOThread,
361 this, loaded_callback, load_success));
362 }
363 }
364
365 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains(
366 const std::set<std::string>& domains) {
367 base::AutoLock locked(lock_);
368
369 sql::Statement smt(db_->GetCachedStatement(SQL_FROM_HERE,
370 "SELECT creation_utc, host_key, name, value, path, expires_utc, secure, "
371 "httponly, last_access_utc FROM cookies WHERE host_key = ?"));
372 if (!smt) {
373 NOTREACHED() << "select statement prep failed";
374 db_.reset();
375 return false;
376 }
377
378 std::set<std::string>::const_iterator it = domains.begin();
379 for (; it != domains.end(); ++it) {
380 smt.BindString(0, *it);
381 while (smt.Step()) {
382 scoped_ptr<net::CookieMonster::CanonicalCookie> cc(
383 new net::CookieMonster::CanonicalCookie(
384 // The "source" URL is not used with persisted cookies.
385 GURL(), // Source
386 smt.ColumnString(2), // name
387 smt.ColumnString(3), // value
388 smt.ColumnString(1), // domain
389 smt.ColumnString(4), // path
390 std::string(), // TODO(abarth): Persist mac_key
391 std::string(), // TODO(abarth): Persist mac_algorithm
392 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc
393 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc
394 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
395 smt.ColumnInt(6) != 0, // secure
396 smt.ColumnInt(7) != 0, // httponly
397 true)); // has_expires
398 DLOG_IF(WARNING,
399 cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
400 cookies_.push_back(cc.release());
401 }
402 smt.Reset();
267 } 403 }
268 404
269 return true; 405 return true;
270 } 406 }
271 407
272 bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() { 408 bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
273 // Version check. 409 // Version check.
274 if (!meta_table_.Init( 410 if (!meta_table_.Init(
275 db_.get(), kCurrentVersionNumber, kCompatibleVersionNumber)) { 411 db_.get(), kCurrentVersionNumber, kCompatibleVersionNumber)) {
276 return false; 412 return false;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // Release our reference, it will probably still have a reference if the 667 // Release our reference, it will probably still have a reference if the
532 // background thread has not run Close() yet. 668 // background thread has not run Close() yet.
533 backend_ = NULL; 669 backend_ = NULL;
534 } 670 }
535 } 671 }
536 672
537 bool SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) { 673 bool SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
538 return backend_->Load(loaded_callback); 674 return backend_->Load(loaded_callback);
539 } 675 }
540 676
677 bool SQLitePersistentCookieStore::LoadCookiesForKey(
678 const std::string& key,
679 const LoadedCallback& loaded_callback) {
680 return backend_->LoadCookiesForKey(key, loaded_callback);
681 }
682
541 void SQLitePersistentCookieStore::AddCookie( 683 void SQLitePersistentCookieStore::AddCookie(
542 const net::CookieMonster::CanonicalCookie& cc) { 684 const net::CookieMonster::CanonicalCookie& cc) {
543 if (backend_.get()) 685 if (backend_.get())
544 backend_->AddCookie(cc); 686 backend_->AddCookie(cc);
545 } 687 }
546 688
547 void SQLitePersistentCookieStore::UpdateCookieAccessTime( 689 void SQLitePersistentCookieStore::UpdateCookieAccessTime(
548 const net::CookieMonster::CanonicalCookie& cc) { 690 const net::CookieMonster::CanonicalCookie& cc) {
549 if (backend_.get()) 691 if (backend_.get())
550 backend_->UpdateCookieAccessTime(cc); 692 backend_->UpdateCookieAccessTime(cc);
(...skipping 10 matching lines...) Expand all
561 if (backend_.get()) 703 if (backend_.get())
562 backend_->SetClearLocalStateOnExit(clear_local_state); 704 backend_->SetClearLocalStateOnExit(clear_local_state);
563 } 705 }
564 706
565 void SQLitePersistentCookieStore::Flush(Task* completion_task) { 707 void SQLitePersistentCookieStore::Flush(Task* completion_task) {
566 if (backend_.get()) 708 if (backend_.get())
567 backend_->Flush(completion_task); 709 backend_->Flush(completion_task);
568 else if (completion_task) 710 else if (completion_task)
569 MessageLoop::current()->PostTask(FROM_HERE, completion_task); 711 MessageLoop::current()->PostTask(FROM_HERE, completion_task);
570 } 712 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698