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

Side by Side Diff: net/extras/sqlite/sqlite_persistent_cookie_store.cc

Issue 2874843002: Shifted creation of unvalidated CanonicalCookies over to a constructor. (Closed)
Patch Set: Merged to top of dependent CL. Created 3 years, 7 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
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 "net/extras/sqlite/sqlite_persistent_cookie_store.h" 5 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h"
19 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
20 #include "base/metrics/histogram_macros.h" 21 #include "base/metrics/histogram_macros.h"
21 #include "base/profiler/scoped_tracker.h" 22 #include "base/profiler/scoped_tracker.h"
22 #include "base/sequenced_task_runner.h" 23 #include "base/sequenced_task_runner.h"
23 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
25 #include "base/synchronization/lock.h" 26 #include "base/synchronization/lock.h"
26 #include "base/threading/sequenced_worker_pool.h" 27 #include "base/threading/sequenced_worker_pool.h"
27 #include "base/time/time.h" 28 #include "base/time/time.h"
28 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 29 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 sql::Statement& smt = *statement; 809 sql::Statement& smt = *statement;
809 while (smt.Step()) { 810 while (smt.Step()) {
810 std::string value; 811 std::string value;
811 std::string encrypted_value = smt.ColumnString(4); 812 std::string encrypted_value = smt.ColumnString(4);
812 if (!encrypted_value.empty() && crypto_) { 813 if (!encrypted_value.empty() && crypto_) {
813 if (!crypto_->DecryptString(encrypted_value, &value)) 814 if (!crypto_->DecryptString(encrypted_value, &value))
814 continue; 815 continue;
815 } else { 816 } else {
816 value = smt.ColumnString(3); 817 value = smt.ColumnString(3);
817 } 818 }
818 std::unique_ptr<CanonicalCookie> cc(CanonicalCookie::Create( 819 std::unique_ptr<CanonicalCookie> cc(base::MakeUnique<CanonicalCookie>(
819 smt.ColumnString(2), // name 820 smt.ColumnString(2), // name
820 value, // value 821 value, // value
821 smt.ColumnString(1), // domain 822 smt.ColumnString(1), // domain
822 smt.ColumnString(5), // path 823 smt.ColumnString(5), // path
823 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc 824 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc
824 Time::FromInternalValue(smt.ColumnInt64(6)), // expires_utc 825 Time::FromInternalValue(smt.ColumnInt64(6)), // expires_utc
825 Time::FromInternalValue(smt.ColumnInt64(10)), // last_access_utc 826 Time::FromInternalValue(smt.ColumnInt64(10)), // last_access_utc
826 smt.ColumnInt(7) != 0, // secure 827 smt.ColumnInt(7) != 0, // secure
827 smt.ColumnInt(8) != 0, // http_only 828 smt.ColumnInt(8) != 0, // http_only
828 DBCookieSameSiteToCookieSameSite( 829 DBCookieSameSiteToCookieSameSite(
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { 1435 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) {
1435 if (backend_) 1436 if (backend_)
1436 backend_->Flush(callback); 1437 backend_->Flush(callback);
1437 } 1438 }
1438 1439
1439 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { 1440 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
1440 Close(base::Closure()); 1441 Close(base::Closure());
1441 } 1442 }
1442 1443
1443 } // namespace net 1444 } // namespace net
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698