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

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

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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
« no previous file with comments | « content/browser/media/media_internals_proxy.cc ('k') | content/browser/plugin_service_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/net/sqlite_persistent_cookie_store.h" 5 #include "content/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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return true; 617 return true;
618 } 618 }
619 619
620 void SQLitePersistentCookieStore::Backend::ChainLoadCookies( 620 void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
621 const LoadedCallback& loaded_callback) { 621 const LoadedCallback& loaded_callback) {
622 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 622 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
623 IncrementTimeDelta increment(&cookie_load_duration_); 623 IncrementTimeDelta increment(&cookie_load_duration_);
624 624
625 bool load_success = true; 625 bool load_success = true;
626 626
627 if (!db_.get()) { 627 if (!db_) {
628 // Close() has been called on this store. 628 // Close() has been called on this store.
629 load_success = false; 629 load_success = false;
630 } else if (keys_to_load_.size() > 0) { 630 } else if (keys_to_load_.size() > 0) {
631 // Load cookies for the first domain key. 631 // Load cookies for the first domain key.
632 std::map<std::string, std::set<std::string> >::iterator 632 std::map<std::string, std::set<std::string> >::iterator
633 it = keys_to_load_.begin(); 633 it = keys_to_load_.begin();
634 load_success = LoadCookiesForDomains(it->second); 634 load_success = LoadCookiesForDomains(it->second);
635 keys_to_load_.erase(it); 635 keys_to_load_.erase(it);
636 } 636 }
637 637
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 DeleteSessionCookiesOnShutdown(); 987 DeleteSessionCookiesOnShutdown();
988 } 988 }
989 989
990 meta_table_.Reset(); 990 meta_table_.Reset();
991 db_.reset(); 991 db_.reset();
992 } 992 }
993 993
994 void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnShutdown() { 994 void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnShutdown() {
995 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 995 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
996 996
997 if (!db_.get()) 997 if (!db_)
998 return; 998 return;
999 999
1000 if (!special_storage_policy_.get()) 1000 if (!special_storage_policy_)
1001 return; 1001 return;
1002 1002
1003 sql::Statement del_smt(db_->GetCachedStatement( 1003 sql::Statement del_smt(db_->GetCachedStatement(
1004 SQL_FROM_HERE, "DELETE FROM cookies WHERE host_key=? AND secure=?")); 1004 SQL_FROM_HERE, "DELETE FROM cookies WHERE host_key=? AND secure=?"));
1005 if (!del_smt.is_valid()) { 1005 if (!del_smt.is_valid()) {
1006 LOG(WARNING) << "Unable to delete cookies on shutdown."; 1006 LOG(WARNING) << "Unable to delete cookies on shutdown.";
1007 return; 1007 return;
1008 } 1008 }
1009 1009
1010 sql::Transaction transaction(db_.get()); 1010 sql::Transaction transaction(db_.get());
(...skipping 30 matching lines...) Expand all
1041 corruption_detected_ = true; 1041 corruption_detected_ = true;
1042 1042
1043 // Don't just do the close/delete here, as we are being called by |db| and 1043 // Don't just do the close/delete here, as we are being called by |db| and
1044 // that seems dangerous. 1044 // that seems dangerous.
1045 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::KillDatabase, this)); 1045 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::KillDatabase, this));
1046 } 1046 }
1047 1047
1048 void SQLitePersistentCookieStore::Backend::KillDatabase() { 1048 void SQLitePersistentCookieStore::Backend::KillDatabase() {
1049 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1049 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
1050 1050
1051 if (db_.get()) { 1051 if (db_) {
1052 // This Backend will now be in-memory only. In a future run we will recreate 1052 // This Backend will now be in-memory only. In a future run we will recreate
1053 // the database. Hopefully things go better then! 1053 // the database. Hopefully things go better then!
1054 bool success = db_->RazeAndClose(); 1054 bool success = db_->RazeAndClose();
1055 UMA_HISTOGRAM_BOOLEAN("Cookie.KillDatabaseResult", success); 1055 UMA_HISTOGRAM_BOOLEAN("Cookie.KillDatabaseResult", success);
1056 meta_table_.Reset(); 1056 meta_table_.Reset();
1057 db_.reset(); 1057 db_.reset();
1058 } 1058 }
1059 } 1059 }
1060 1060
1061 void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() { 1061 void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 path, 1145 path,
1146 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 1146 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
1147 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 1147 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
1148 BrowserThread::GetBlockingPool()->GetSequenceToken()), 1148 BrowserThread::GetBlockingPool()->GetSequenceToken()),
1149 restore_old_session_cookies, 1149 restore_old_session_cookies,
1150 storage_policy); 1150 storage_policy);
1151 return new net::CookieMonster(persistent_store, cookie_monster_delegate); 1151 return new net::CookieMonster(persistent_store, cookie_monster_delegate);
1152 } 1152 }
1153 1153
1154 } // namespace content 1154 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_internals_proxy.cc ('k') | content/browser/plugin_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698