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

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 rohit round two. 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)
436 // iOS 8.1 and older doesn't support partial indices. iOS 8.2 supports
437 // partial indices.
438 if (!db->Execute("CREATE INDEX is_transient ON cookies(persistent)")) {
439 #else
435 if (!db->Execute( 440 if (!db->Execute(
436 "CREATE INDEX is_transient ON cookies(persistent) " 441 "CREATE INDEX is_transient ON cookies(persistent) "
437 "where persistent != 1")) { 442 "where persistent != 1")) {
443 #endif
438 return false; 444 return false;
439 } 445 }
440 446
441 return true; 447 return true;
442 } 448 }
443 449
444 } // namespace 450 } // namespace
445 451
446 void SQLitePersistentCookieStore::Backend::Load( 452 void SQLitePersistentCookieStore::Backend::Load(
447 const LoadedCallback& loaded_callback) { 453 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."; 980 << "Unable to drop table cookie_times in update to version 9.";
975 return false; 981 return false;
976 } 982 }
977 983
978 if (!db_->Execute( 984 if (!db_->Execute(
979 "CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) { 985 "CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) {
980 LOG(WARNING) << "Unable to create index domain in update to version 9."; 986 LOG(WARNING) << "Unable to create index domain in update to version 9.";
981 return false; 987 return false;
982 } 988 }
983 989
990 #if defined(OS_IOS)
991 // iOS 8.1 and older doesn't support partial indices. iOS 8.2 supports
992 // partial indices.
984 if (!db_->Execute( 993 if (!db_->Execute(
985 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) " 994 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent)")) {
986 "where persistent != 1")) { 995 #else
996 if (!db_->Execute(
997 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) "
998 "where persistent != 1")) {
999 #endif
987 LOG(WARNING) 1000 LOG(WARNING)
988 << "Unable to create index is_transient in update to version 9."; 1001 << "Unable to create index is_transient in update to version 9.";
989 return false; 1002 return false;
990 } 1003 }
991 ++cur_version; 1004 ++cur_version;
992 meta_table_.SetVersionNumber(cur_version); 1005 meta_table_.SetVersionNumber(cur_version);
993 meta_table_.SetCompatibleVersionNumber( 1006 meta_table_.SetCompatibleVersionNumber(
994 std::min(cur_version, kCompatibleVersionNumber)); 1007 std::min(cur_version, kCompatibleVersionNumber));
995 transaction.Commit(); 1008 transaction.Commit();
996 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV9", 1009 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV9",
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 (config.session_cookie_mode == 1452 (config.session_cookie_mode ==
1440 CookieStoreConfig::RESTORED_SESSION_COOKIES)) { 1453 CookieStoreConfig::RESTORED_SESSION_COOKIES)) {
1441 cookie_monster->SetPersistSessionCookies(true); 1454 cookie_monster->SetPersistSessionCookies(true);
1442 } 1455 }
1443 } 1456 }
1444 1457
1445 return cookie_monster; 1458 return cookie_monster;
1446 } 1459 }
1447 1460
1448 } // namespace content 1461 } // 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