OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 loaded_callback.Run(cookies); | 456 loaded_callback.Run(cookies); |
457 } | 457 } |
458 | 458 |
459 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { | 459 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { |
460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
461 | 461 |
462 if (initialized_) { | 462 if (initialized_) { |
463 // Return false if we were previously initialized but the DB has since been | 463 // Return false if we were previously initialized but the DB has since been |
464 // closed. | 464 // closed. |
465 return db_.get() ? true : false; | 465 return db_ != NULL; |
466 } | 466 } |
467 | 467 |
468 base::Time start = base::Time::Now(); | 468 base::Time start = base::Time::Now(); |
469 | 469 |
470 const FilePath dir = path_.DirName(); | 470 const FilePath dir = path_.DirName(); |
471 if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { | 471 if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { |
472 return false; | 472 return false; |
473 } | 473 } |
474 | 474 |
475 int64 db_size = 0; | 475 int64 db_size = 0; |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 } | 967 } |
968 | 968 |
969 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { | 969 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { |
970 if (backend_.get()) { | 970 if (backend_.get()) { |
971 backend_->Close(); | 971 backend_->Close(); |
972 // Release our reference, it will probably still have a reference if the | 972 // Release our reference, it will probably still have a reference if the |
973 // background thread has not run Close() yet. | 973 // background thread has not run Close() yet. |
974 backend_ = NULL; | 974 backend_ = NULL; |
975 } | 975 } |
976 } | 976 } |
OLD | NEW |