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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 backend_->Load(loaded_callback); | 1075 backend_->Load(loaded_callback); |
1076 } | 1076 } |
1077 | 1077 |
1078 void SQLitePersistentCookieStore::LoadCookiesForKey( | 1078 void SQLitePersistentCookieStore::LoadCookiesForKey( |
1079 const std::string& key, | 1079 const std::string& key, |
1080 const LoadedCallback& loaded_callback) { | 1080 const LoadedCallback& loaded_callback) { |
1081 backend_->LoadCookiesForKey(key, loaded_callback); | 1081 backend_->LoadCookiesForKey(key, loaded_callback); |
1082 } | 1082 } |
1083 | 1083 |
1084 void SQLitePersistentCookieStore::AddCookie(const net::CanonicalCookie& cc) { | 1084 void SQLitePersistentCookieStore::AddCookie(const net::CanonicalCookie& cc) { |
1085 if (backend_.get()) | 1085 backend_->AddCookie(cc); |
1086 backend_->AddCookie(cc); | |
1087 } | 1086 } |
1088 | 1087 |
1089 void SQLitePersistentCookieStore::UpdateCookieAccessTime( | 1088 void SQLitePersistentCookieStore::UpdateCookieAccessTime( |
1090 const net::CanonicalCookie& cc) { | 1089 const net::CanonicalCookie& cc) { |
1091 if (backend_.get()) | 1090 backend_->UpdateCookieAccessTime(cc); |
1092 backend_->UpdateCookieAccessTime(cc); | |
1093 } | 1091 } |
1094 | 1092 |
1095 void SQLitePersistentCookieStore::DeleteCookie(const net::CanonicalCookie& cc) { | 1093 void SQLitePersistentCookieStore::DeleteCookie(const net::CanonicalCookie& cc) { |
1096 if (backend_.get()) | 1094 backend_->DeleteCookie(cc); |
1097 backend_->DeleteCookie(cc); | |
1098 } | 1095 } |
1099 | 1096 |
1100 void SQLitePersistentCookieStore::SetForceKeepSessionState() { | 1097 void SQLitePersistentCookieStore::SetForceKeepSessionState() { |
1101 if (backend_.get()) | 1098 backend_->SetForceKeepSessionState(); |
1102 backend_->SetForceKeepSessionState(); | |
1103 } | 1099 } |
1104 | 1100 |
1105 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { | 1101 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { |
1106 if (backend_.get()) | 1102 backend_->Flush(callback); |
1107 backend_->Flush(callback); | |
1108 else if (!callback.is_null()) | |
1109 MessageLoop::current()->PostTask(FROM_HERE, callback); | |
1110 } | 1103 } |
1111 | 1104 |
1112 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { | 1105 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { |
1113 if (backend_.get()) { | 1106 backend_->Close(); |
1114 backend_->Close(); | 1107 // We release our reference to the Backend, though it will probably still have |
1115 // Release our reference, it will probably still have a reference if the | 1108 // a reference if the background thread has not run Close() yet. |
1116 // background thread has not run Close() yet. | |
1117 backend_ = NULL; | |
1118 } | |
1119 } | 1109 } |
OLD | NEW |