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

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

Issue 9125017: Merge 113575 - SQLitePersistentCookieStore fix: Don't abuse SQL_FROM_HERE. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 years, 11 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 | « no previous file | no next file » | 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) 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> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 this, loaded_callback, load_success)); 519 this, loaded_callback, load_success));
520 if (!restore_old_session_cookies_) 520 if (!restore_old_session_cookies_)
521 DeleteSessionCookies(); 521 DeleteSessionCookies();
522 } 522 }
523 } 523 }
524 524
525 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains( 525 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains(
526 const std::set<std::string>& domains) { 526 const std::set<std::string>& domains) {
527 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 527 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
528 528
529 const char* sql; 529 sql::Statement smt;
530 if (restore_old_session_cookies_) { 530 if (restore_old_session_cookies_) {
531 sql = 531 smt.Assign(db_->GetCachedStatement(
532 "SELECT creation_utc, host_key, name, value, path, expires_utc, " 532 SQL_FROM_HERE,
533 "secure, httponly, last_access_utc, has_expires, persistent " 533 "SELECT creation_utc, host_key, name, value, path, expires_utc, "
534 "FROM cookies WHERE host_key = ?"; 534 "secure, httponly, last_access_utc, has_expires, persistent "
535 "FROM cookies WHERE host_key = ?"));
535 } else { 536 } else {
536 sql = 537 smt.Assign(db_->GetCachedStatement(
537 "SELECT creation_utc, host_key, name, value, path, expires_utc, " 538 SQL_FROM_HERE,
538 "secure, httponly, last_access_utc, has_expires, persistent " 539 "SELECT creation_utc, host_key, name, value, path, expires_utc, "
539 "FROM cookies WHERE host_key = ? AND persistent == 1"; 540 "secure, httponly, last_access_utc, has_expires, persistent "
541 "FROM cookies WHERE host_key = ? AND persistent = 1"));
540 } 542 }
541 sql::Statement smt(db_->GetCachedStatement(SQL_FROM_HERE, sql));
542 if (!smt) { 543 if (!smt) {
543 NOTREACHED() << "select statement prep failed"; 544 NOTREACHED() << "select statement prep failed";
544 db_.reset(); 545 db_.reset();
545 return false; 546 return false;
546 } 547 }
547 548
548 std::vector<net::CookieMonster::CanonicalCookie*> cookies; 549 std::vector<net::CookieMonster::CanonicalCookie*> cookies;
549 std::set<std::string>::const_iterator it = domains.begin(); 550 std::set<std::string>::const_iterator it = domains.begin();
550 for (; it != domains.end(); ++it) { 551 for (; it != domains.end(); ++it) {
551 smt.BindString(0, *it); 552 smt.BindString(0, *it);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 if (backend_.get()) 912 if (backend_.get())
912 backend_->SetClearLocalStateOnExit(clear_local_state); 913 backend_->SetClearLocalStateOnExit(clear_local_state);
913 } 914 }
914 915
915 void SQLitePersistentCookieStore::Flush(Task* completion_task) { 916 void SQLitePersistentCookieStore::Flush(Task* completion_task) {
916 if (backend_.get()) 917 if (backend_.get())
917 backend_->Flush(completion_task); 918 backend_->Flush(completion_task);
918 else if (completion_task) 919 else if (completion_task)
919 MessageLoop::current()->PostTask(FROM_HERE, completion_task); 920 MessageLoop::current()->PostTask(FROM_HERE, completion_task);
920 } 921 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698