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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 MessageLoop::current()->PostTask( | 1037 MessageLoop::current()->PostTask( |
1038 FROM_HERE, base::Bind(&Backend::KillDatabase, this)); | 1038 FROM_HERE, base::Bind(&Backend::KillDatabase, this)); |
1039 } | 1039 } |
1040 | 1040 |
1041 void SQLitePersistentCookieStore::Backend::KillDatabase() { | 1041 void SQLitePersistentCookieStore::Backend::KillDatabase() { |
1042 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 1042 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
1043 | 1043 |
1044 if (db_.get()) { | 1044 if (db_.get()) { |
1045 // This Backend will now be in-memory only. In a future run we will recreate | 1045 // This Backend will now be in-memory only. In a future run we will recreate |
1046 // the database. Hopefully things go better then! | 1046 // the database. Hopefully things go better then! |
1047 bool success = db_->Raze(); | 1047 bool success = db_->RazeAndClose(); |
1048 UMA_HISTOGRAM_BOOLEAN("Cookie.KillDatabaseResult", success); | 1048 UMA_HISTOGRAM_BOOLEAN("Cookie.KillDatabaseResult", success); |
1049 db_->Close(); | |
1050 meta_table_.Reset(); | 1049 meta_table_.Reset(); |
1051 db_.reset(); | 1050 db_.reset(); |
1052 } | 1051 } |
1053 } | 1052 } |
1054 | 1053 |
1055 void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() { | 1054 void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() { |
1056 base::AutoLock locked(lock_); | 1055 base::AutoLock locked(lock_); |
1057 force_keep_session_state_ = true; | 1056 force_keep_session_state_ = true; |
1058 } | 1057 } |
1059 | 1058 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 | 1099 |
1101 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { | 1100 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { |
1102 backend_->Flush(callback); | 1101 backend_->Flush(callback); |
1103 } | 1102 } |
1104 | 1103 |
1105 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { | 1104 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { |
1106 backend_->Close(); | 1105 backend_->Close(); |
1107 // We release our reference to the Backend, though it will probably still have | 1106 // We release our reference to the Backend, though it will probably still have |
1108 // a reference if the background thread has not run Close() yet. | 1107 // a reference if the background thread has not run Close() yet. |
1109 } | 1108 } |
OLD | NEW |