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

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

Issue 1098883005: The SQLitePersistentCookieStore should use a non-partial index on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from rohitrao. Created 5 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
« 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) 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 "priority INTEGER NOT NULL DEFAULT %d," 425 "priority INTEGER NOT NULL DEFAULT %d,"
426 "encrypted_value BLOB DEFAULT ''," 426 "encrypted_value BLOB DEFAULT '',"
427 "firstpartyonly INTEGER NOT NULL DEFAULT 0)", 427 "firstpartyonly INTEGER NOT NULL DEFAULT 0)",
428 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); 428 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT)));
429 if (!db->Execute(stmt.c_str())) 429 if (!db->Execute(stmt.c_str()))
430 return false; 430 return false;
431 431
432 if (!db->Execute("CREATE INDEX domain ON cookies(host_key)")) 432 if (!db->Execute("CREATE INDEX domain ON cookies(host_key)"))
433 return false; 433 return false;
434 434
435 #if defined(OS_IOS)
rohitrao (ping after 24h) 2015/04/24 17:36:29 Is it worth adding a comment saying why iOS is dif
erikchen 2015/04/24 17:42:57 Done.
436 if (!db->Execute("CREATE INDEX is_transient ON cookies(persistent)")) {
437 #else
435 if (!db->Execute( 438 if (!db->Execute(
436 "CREATE INDEX is_transient ON cookies(persistent) " 439 "CREATE INDEX is_transient ON cookies(persistent) "
437 "where persistent != 1")) { 440 "where persistent != 1")) {
441 #endif
438 return false; 442 return false;
439 } 443 }
440 444
441 return true; 445 return true;
442 } 446 }
443 447
444 } // namespace 448 } // namespace
445 449
446 void SQLitePersistentCookieStore::Backend::Load( 450 void SQLitePersistentCookieStore::Backend::Load(
447 const LoadedCallback& loaded_callback) { 451 const LoadedCallback& loaded_callback) {
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 << "Unable to drop table cookie_times in update to version 9."; 978 << "Unable to drop table cookie_times in update to version 9.";
975 return false; 979 return false;
976 } 980 }
977 981
978 if (!db_->Execute( 982 if (!db_->Execute(
979 "CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) { 983 "CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) {
980 LOG(WARNING) << "Unable to create index domain in update to version 9."; 984 LOG(WARNING) << "Unable to create index domain in update to version 9.";
981 return false; 985 return false;
982 } 986 }
983 987
988 #if defined(OS_IOS)
984 if (!db_->Execute( 989 if (!db_->Execute(
985 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) " 990 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) ")) {
rohitrao (ping after 24h) 2015/04/24 17:36:29 Extra trailing whitespace in the SQL command.
erikchen 2015/04/24 17:42:57 Done.
986 "where persistent != 1")) { 991 #else
992 if (!db_->Execute(
993 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) "
994 "where persistent != 1")) {
995 #endif
987 LOG(WARNING) 996 LOG(WARNING)
988 << "Unable to create index is_transient in update to version 9."; 997 << "Unable to create index is_transient in update to version 9.";
989 return false; 998 return false;
990 } 999 }
991 ++cur_version; 1000 ++cur_version;
992 meta_table_.SetVersionNumber(cur_version); 1001 meta_table_.SetVersionNumber(cur_version);
993 meta_table_.SetCompatibleVersionNumber( 1002 meta_table_.SetCompatibleVersionNumber(
994 std::min(cur_version, kCompatibleVersionNumber)); 1003 std::min(cur_version, kCompatibleVersionNumber));
995 transaction.Commit(); 1004 transaction.Commit();
996 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV9", 1005 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV9",
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 (config.session_cookie_mode == 1448 (config.session_cookie_mode ==
1440 CookieStoreConfig::RESTORED_SESSION_COOKIES)) { 1449 CookieStoreConfig::RESTORED_SESSION_COOKIES)) {
1441 cookie_monster->SetPersistSessionCookies(true); 1450 cookie_monster->SetPersistSessionCookies(true);
1442 } 1451 }
1443 } 1452 }
1444 1453
1445 return cookie_monster; 1454 return cookie_monster;
1446 } 1455 }
1447 1456
1448 } // namespace content 1457 } // namespace content
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