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

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 void Load(const LoadedCallback& loaded_callback);
48
49 // Load cookies for the domain key (eTLD+1).
50 void LoadCookiesForKey(const std::string& domain,
51 const LoadedCallback& loaded_callback);
49 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
(...skipping 34 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. It triggers the callback and passes it all cookies
113 // that have been loaded from DB since last IO notification.
104 void NotifyOnIOThread( 114 void NotifyOnIOThread(
105 const LoadedCallback& loaded_callback, 115 const LoadedCallback& loaded_callback,
106 bool load_success, 116 bool load_success);
107 const std::vector<net::CookieMonster::CanonicalCookie*>& cookies);
108 // Initialize the data base. 117 // Initialize the data base.
118
109 bool InitializeDatabase(); 119 bool InitializeDatabase();
110 // Load cookies to the data base, and read cookies. 120
111 bool LoadInternal(std::vector<net::CookieMonster::CanonicalCookie*>* cookies); 121 // Chain load cookies from DB by domain key.
122 void ChainLoadCookies(const LoadedCallback& loaded_callback);
123
124 // Load all cookies for a set of domains/hosts
125 bool LoadCookiesForDomains(const std::set<std::string>& key);
112 126
113 // Batch a cookie operation (add or delete) 127 // Batch a cookie operation (add or delete)
114 void BatchOperation(PendingOperation::OperationType op, 128 void BatchOperation(PendingOperation::OperationType op,
115 const net::CookieMonster::CanonicalCookie& cc); 129 const net::CookieMonster::CanonicalCookie& cc);
116 // Commit our pending operations to the database. 130 // Commit our pending operations to the database.
117 void Commit(); 131 void Commit();
118 // Close() executed on the background thread. 132 // Close() executed on the background thread.
119 void InternalBackgroundClose(); 133 void InternalBackgroundClose();
120 134
121 FilePath path_; 135 FilePath path_;
122 scoped_ptr<sql::Connection> db_; 136 scoped_ptr<sql::Connection> db_;
123 sql::MetaTable meta_table_; 137 sql::MetaTable meta_table_;
124 138
125 typedef std::list<PendingOperation*> PendingOperationsList; 139 typedef std::list<PendingOperation*> PendingOperationsList;
126 PendingOperationsList pending_; 140 PendingOperationsList pending_;
127 PendingOperationsList::size_type num_pending_; 141 PendingOperationsList::size_type num_pending_;
128 // True if the persistent store should be deleted upon destruction. 142 // True if the persistent store should be deleted upon destruction.
129 bool clear_local_state_on_exit_; 143 bool clear_local_state_on_exit_;
130 // Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|. 144 // Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|.
131 base::Lock lock_; 145 base::Lock lock_;
132 146
147 // Temporary buffer for cookies loaded from DB.
148 std::vector<net::CookieMonster::CanonicalCookie*> cookies_;
149
150 // Map of domain keys(eTLD+1) to domains/hosts that are to be loaded from DB.
151 std::map<std::string, std::set<std::string>> keys_to_load_;
152
153 // Indicates if DB has been initialized.
154 bool initialized_;
155
133 DISALLOW_COPY_AND_ASSIGN(Backend); 156 DISALLOW_COPY_AND_ASSIGN(Backend);
134 }; 157 };
135 158
136 // Version number of the database. In version 4, we migrated the time epoch. 159 // 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 160 // 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 161 // look wonky, but the file will likely be usable. On Windows version 3 and 4
139 // are the same. 162 // are the same.
140 // 163 //
141 // Version 3 updated the database to include the last access time, so we can 164 // 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 165 // expire them in decreasing order of use when we've reached the maximum
(...skipping 17 matching lines...) Expand all
160 "secure INTEGER NOT NULL," 183 "secure INTEGER NOT NULL,"
161 "httponly INTEGER NOT NULL," 184 "httponly INTEGER NOT NULL,"
162 "last_access_utc INTEGER NOT NULL)")) 185 "last_access_utc INTEGER NOT NULL)"))
163 return false; 186 return false;
164 } 187 }
165 188
166 // Try to create the index every time. Older versions did not have this index, 189 // 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. 190 // 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" 191 db->Execute("CREATE INDEX IF NOT EXISTS cookie_times ON cookies"
169 " (creation_utc)"); 192 " (creation_utc)");
193
194 db->Execute("CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)");
195
170 return true; 196 return true;
171 } 197 }
172 198
173 } // namespace 199 } // namespace
174 200
175 bool SQLitePersistentCookieStore::Backend::Load( 201 void SQLitePersistentCookieStore::Backend::Load(
176 const LoadedCallback& loaded_callback) { 202 const LoadedCallback& loaded_callback) {
177 // This function should be called only once per instance. 203 // This function should be called only once per instance.
178 DCHECK(!db_.get()); 204 DCHECK(!db_.get());
179 BrowserThread::PostTask( 205 BrowserThread::PostTask(
180 BrowserThread::DB, FROM_HERE, 206 BrowserThread::DB, FROM_HERE,
181 base::Bind(&Backend::LoadAndNotifyOnDBThread, base::Unretained(this), 207 base::Bind(&Backend::LoadAndNotifyOnDBThread, this, loaded_callback));
182 loaded_callback)); 208 }
183 return true; 209
210 void SQLitePersistentCookieStore::Backend::LoadCookiesForKey(
211 const std::string& key,
212 const LoadedCallback& loaded_callback) {
213 BrowserThread::PostTask(
214 BrowserThread::DB, FROM_HERE,
215 base::Bind(&Backend::LoadKeyAndNotifyOnDBThread, this,
216 key,
217 loaded_callback));
184 } 218 }
185 219
186 void SQLitePersistentCookieStore::Backend::LoadAndNotifyOnDBThread( 220 void SQLitePersistentCookieStore::Backend::LoadAndNotifyOnDBThread(
187 const LoadedCallback& loaded_callback) { 221 const LoadedCallback& loaded_callback) {
188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
189 std::vector<net::CookieMonster::CanonicalCookie*> cookies;
190 223
191 bool load_success = LoadInternal(&cookies); 224 if (!InitializeDatabase()) {
225 BrowserThread::PostTask(
226 BrowserThread::IO, FROM_HERE,
227 base::Bind(&SQLitePersistentCookieStore::Backend::NotifyOnIOThread,
228 this, loaded_callback, false));
229 } else {
230 ChainLoadCookies(loaded_callback);
231 }
232 }
192 233
193 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 234 void SQLitePersistentCookieStore::Backend::LoadKeyAndNotifyOnDBThread(
194 &SQLitePersistentCookieStore::Backend::NotifyOnIOThread, 235 const std::string& key,
195 base::Unretained(this), loaded_callback, load_success, cookies)); 236 const LoadedCallback& loaded_callback) {
237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
238
239 bool success = false;
240 if (InitializeDatabase()) {
241 std::map<std::string, std::set<std::string> >::iterator
242 it = keys_to_load_.find(key);
243 if (it != keys_to_load_.end()) {
244 success = LoadCookiesForDomains(it->second);
245 keys_to_load_.erase(it);
246 } else {
247 success = true;
248 }
249 }
250
251 BrowserThread::PostTask(
252 BrowserThread::IO, FROM_HERE,
253 base::Bind(&SQLitePersistentCookieStore::Backend::NotifyOnIOThread,
254 this, loaded_callback, success));
196 } 255 }
197 256
198 void SQLitePersistentCookieStore::Backend::NotifyOnIOThread( 257 void SQLitePersistentCookieStore::Backend::NotifyOnIOThread(
199 const LoadedCallback& loaded_callback, 258 const LoadedCallback& loaded_callback,
200 bool load_success, 259 bool load_success) {
201 const std::vector<net::CookieMonster::CanonicalCookie*>& cookies) {
202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
261
262 std::vector<net::CookieMonster::CanonicalCookie*> cookies;
263 {
264 base::AutoLock locked(lock_);
265 cookies = cookies_;
266 cookies_.clear();
267 }
268
203 loaded_callback.Run(cookies); 269 loaded_callback.Run(cookies);
204 } 270 }
205 271
206 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { 272 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() {
273 if (initialized_) {
274 return true;
275 }
276
207 const FilePath dir = path_.DirName(); 277 const FilePath dir = path_.DirName();
208 if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { 278 if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) {
209 return false; 279 return false;
210 } 280 }
211 281
212 db_.reset(new sql::Connection); 282 db_.reset(new sql::Connection);
213 if (!db_->Open(path_)) { 283 if (!db_->Open(path_)) {
214 NOTREACHED() << "Unable to open cookie DB."; 284 NOTREACHED() << "Unable to open cookie DB.";
215 db_.reset(); 285 db_.reset();
216 return false; 286 return false;
217 } 287 }
218 288
219 db_->set_error_delegate(GetErrorHandlerForCookieDb()); 289 db_->set_error_delegate(GetErrorHandlerForCookieDb());
220 290
221 if (!EnsureDatabaseVersion() || !InitTable(db_.get())) { 291 if (!EnsureDatabaseVersion() || !InitTable(db_.get())) {
222 NOTREACHED() << "Unable to open cookie DB."; 292 NOTREACHED() << "Unable to open cookie DB.";
223 db_.reset(); 293 db_.reset();
224 return false; 294 return false;
225 } 295 }
226 296
227 db_->Preload(); 297 db_->Preload();
228 return true;
229 }
230 298
231 bool SQLitePersistentCookieStore::Backend::LoadInternal( 299 // Retrieve all the domains
232 std::vector<net::CookieMonster::CanonicalCookie*>* cookies) { 300 sql::Statement smt(db_->GetUniqueStatement(
233 if (!InitializeDatabase()) { 301 "SELECT DISTINCT host_key FROM cookies"));
234 return false;
235 }
236 302
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) { 303 if (!smt) {
242 NOTREACHED() << "select statement prep failed"; 304 NOTREACHED() << "select statement prep failed";
243 db_.reset(); 305 db_.reset();
244 return false; 306 return false;
245 } 307 }
246 308
309 // Build a map of domain keys (eTLD+1) to domains.
247 while (smt.Step()) { 310 while (smt.Step()) {
248 scoped_ptr<net::CookieMonster::CanonicalCookie> cc( 311 std::string domain = smt.ColumnString(0);
249 new net::CookieMonster::CanonicalCookie( 312 std::string key =
250 // The "source" URL is not used with persisted cookies. 313 net::RegistryControlledDomainService::GetDomainAndRegistry(domain);
251 GURL(), // Source 314
252 smt.ColumnString(2), // name 315 std::map<std::string, std::set<std::string> >::iterator it =
253 smt.ColumnString(3), // value 316 keys_to_load_.find(key);
254 smt.ColumnString(1), // domain 317 if (it == keys_to_load_.end()) {
255 smt.ColumnString(4), // path 318 std::set<std::string> domains;
256 std::string(), // TODO(abarth): Persist mac_key 319 domains.insert(domain);
257 std::string(), // TODO(abarth): Persist mac_algorithm 320 keys_to_load_.insert(
258 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc 321 std::pair<std::string, std::set<std::string> >(key, domains));
259 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc 322 } else {
260 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc 323 it->second.insert(domain);
261 smt.ColumnInt(6) != 0, // secure 324 }
262 smt.ColumnInt(7) != 0, // httponly 325 }
263 true)); // has_expires 326
264 DLOG_IF(WARNING, 327 // Reserve space for the maximum amount of cookies a database should have.
265 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; 328 // This prevents multiple vector growth / copies as we append cookies.
266 cookies->push_back(cc.release()); 329 const size_t kMaxCookies = 3300;
erikwright (departed) 2011/09/16 18:58:57 This code (lines 329 to 332) was removed in my CL
330 cookies_.reserve(kMaxCookies);
331
332 initialized_ = true;
333 return true;
334 }
335
336 void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
337 const LoadedCallback& loaded_callback) {
338 bool load_success = true;
339
340 if (keys_to_load_.size() > 0) {
341 // Load cookies for the first domain key.
342 std::map<std::string, std::set<std::string> >::iterator
343 it = keys_to_load_.begin();
344 load_success = LoadCookiesForDomains(it->second);
345 keys_to_load_.erase(it);
346 }
347
348 // If load is successful and there are more domain keys to be loaded,
349 // then post a DB task to continue chain-load;
350 // Otherwise notify on IO thread.
351 if (load_success && keys_to_load_.size() > 0) {
352 BrowserThread::PostTask(
353 BrowserThread::DB, FROM_HERE,
354 base::Bind(&Backend::ChainLoadCookies, this, loaded_callback));
355 } else {
356 BrowserThread::PostTask(
357 BrowserThread::IO, FROM_HERE,
358 base::Bind(&SQLitePersistentCookieStore::Backend::NotifyOnIOThread,
359 this, loaded_callback, load_success));
360 }
361 }
362
363 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains(
364 const std::set<std::string>& domains) {
365 base::AutoLock locked(lock_);
366
367 sql::Statement smt(db_->GetCachedStatement(SQL_FROM_HERE,
368 "SELECT creation_utc, host_key, name, value, path, expires_utc, secure, "
369 "httponly, last_access_utc FROM cookies WHERE host_key = ?"));
370 if (!smt) {
371 NOTREACHED() << "select statement prep failed";
372 db_.reset();
373 return false;
374 }
375
376 std::set<std::string>::const_iterator it = domains.begin();
377 for (; it != domains.end(); ++it) {
378 smt.BindString(0, *it);
379 while (smt.Step()) {
380 scoped_ptr<net::CookieMonster::CanonicalCookie> cc(
381 new net::CookieMonster::CanonicalCookie(
382 // The "source" URL is not used with persisted cookies.
383 GURL(), // Source
384 smt.ColumnString(2), // name
385 smt.ColumnString(3), // value
386 smt.ColumnString(1), // domain
387 smt.ColumnString(4), // path
388 std::string(), // TODO(abarth): Persist mac_key
389 std::string(), // TODO(abarth): Persist mac_algorithm
390 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc
391 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc
392 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
393 smt.ColumnInt(6) != 0, // secure
394 smt.ColumnInt(7) != 0, // httponly
395 true)); // has_expires
396 DLOG_IF(WARNING,
397 cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
398 cookies_.push_back(cc.release());
399 }
400 smt.Reset();
267 } 401 }
268 402
269 return true; 403 return true;
270 } 404 }
271 405
272 bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() { 406 bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
273 // Version check. 407 // Version check.
274 if (!meta_table_.Init( 408 if (!meta_table_.Init(
275 db_.get(), kCurrentVersionNumber, kCompatibleVersionNumber)) { 409 db_.get(), kCurrentVersionNumber, kCompatibleVersionNumber)) {
276 return false; 410 return false;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 661
528 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { 662 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
529 if (backend_.get()) { 663 if (backend_.get()) {
530 backend_->Close(); 664 backend_->Close();
531 // Release our reference, it will probably still have a reference if the 665 // Release our reference, it will probably still have a reference if the
532 // background thread has not run Close() yet. 666 // background thread has not run Close() yet.
533 backend_ = NULL; 667 backend_ = NULL;
534 } 668 }
535 } 669 }
536 670
537 bool SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) { 671 void SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
538 return backend_->Load(loaded_callback); 672 backend_->Load(loaded_callback);
673 }
674
675 void SQLitePersistentCookieStore::LoadCookiesForKey(
676 const std::string& key,
677 const LoadedCallback& loaded_callback) {
678 backend_->LoadCookiesForKey(key, loaded_callback);
539 } 679 }
540 680
541 void SQLitePersistentCookieStore::AddCookie( 681 void SQLitePersistentCookieStore::AddCookie(
542 const net::CookieMonster::CanonicalCookie& cc) { 682 const net::CookieMonster::CanonicalCookie& cc) {
543 if (backend_.get()) 683 if (backend_.get())
544 backend_->AddCookie(cc); 684 backend_->AddCookie(cc);
545 } 685 }
546 686
547 void SQLitePersistentCookieStore::UpdateCookieAccessTime( 687 void SQLitePersistentCookieStore::UpdateCookieAccessTime(
548 const net::CookieMonster::CanonicalCookie& cc) { 688 const net::CookieMonster::CanonicalCookie& cc) {
(...skipping 12 matching lines...) Expand all
561 if (backend_.get()) 701 if (backend_.get())
562 backend_->SetClearLocalStateOnExit(clear_local_state); 702 backend_->SetClearLocalStateOnExit(clear_local_state);
563 } 703 }
564 704
565 void SQLitePersistentCookieStore::Flush(Task* completion_task) { 705 void SQLitePersistentCookieStore::Flush(Task* completion_task) {
566 if (backend_.get()) 706 if (backend_.get())
567 backend_->Flush(completion_task); 707 backend_->Flush(completion_task);
568 else if (completion_task) 708 else if (completion_task)
569 MessageLoop::current()->PostTask(FROM_HERE, completion_task); 709 MessageLoop::current()->PostTask(FROM_HERE, completion_task);
570 } 710 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698