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

Side by Side Diff: chrome/browser/content_settings/local_shared_objects_container.cc

Issue 454623003: Store in memory cookies in a hash set instead of a list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix total ordering. Created 6 years, 4 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 | « chrome/browser/browsing_data/canonical_cookie_hash.cc ('k') | chrome/chrome_browser.gypi » ('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 "chrome/browser/content_settings/local_shared_objects_container.h" 5 #include "chrome/browser/content_settings/local_shared_objects_container.h"
6 6
7 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" 7 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
8 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 8 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
11 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 11 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
12 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" 12 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
13 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 13 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
14 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h"
15 #include "chrome/browser/browsing_data/canonical_cookie_hash.h"
15 #include "chrome/browser/browsing_data/cookies_tree_model.h" 16 #include "chrome/browser/browsing_data/cookies_tree_model.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "content/public/browser/storage_partition.h" 18 #include "content/public/browser/storage_partition.h"
18 #include "content/public/common/url_constants.h" 19 #include "content/public/common/url_constants.h"
19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 20 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
20 #include "net/cookies/canonical_cookie.h" 21 #include "net/cookies/canonical_cookie.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 namespace { 24 namespace {
24 25
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 size_t LocalSharedObjectsContainer::GetObjectCountForDomain( 81 size_t LocalSharedObjectsContainer::GetObjectCountForDomain(
81 const GURL& origin) const { 82 const GURL& origin) const {
82 size_t count = 0; 83 size_t count = 0;
83 84
84 // Count all cookies that have the same domain as the provided |origin|. This 85 // Count all cookies that have the same domain as the provided |origin|. This
85 // means count all cookies that has been set by a host that is not considered 86 // means count all cookies that has been set by a host that is not considered
86 // to be a third party regarding the domain of the provided |origin|. 87 // to be a third party regarding the domain of the provided |origin|.
87 // E.g. if the origin is "http://foo.com" then all cookies with domain foo.com , 88 // E.g. if the origin is "http://foo.com" then all cookies with domain foo.com ,
88 // a.foo.com, b.a.foo.com or *.foo.com will be counted. 89 // a.foo.com, b.a.foo.com or *.foo.com will be counted.
89 typedef CannedBrowsingDataCookieHelper::OriginCookieListMap 90 typedef CannedBrowsingDataCookieHelper::OriginCookieSetMap OriginCookieSetMap;
90 OriginCookieListMap; 91 const OriginCookieSetMap& origin_cookies_set_map =
91 const OriginCookieListMap& origin_cookies_list_map = 92 cookies()->origin_cookie_set_map();
92 cookies()->origin_cookie_list_map(); 93 for (OriginCookieSetMap::const_iterator it = origin_cookies_set_map.begin();
93 for (OriginCookieListMap::const_iterator it = 94 it != origin_cookies_set_map.end();
94 origin_cookies_list_map.begin(); 95 ++it) {
95 it != origin_cookies_list_map.end(); 96 const canonical_cookie::CookieHashSet* cookie_list = it->second;
96 ++it) { 97 for (canonical_cookie::CookieHashSet::const_iterator cookie =
97 const net::CookieList* cookie_list = it->second; 98 cookie_list->begin();
98 for (net::CookieList::const_iterator cookie = cookie_list->begin();
99 cookie != cookie_list->end(); 99 cookie != cookie_list->end();
100 ++cookie) { 100 ++cookie) {
101 // Strip leading '.'s. 101 // Strip leading '.'s.
102 std::string cookie_domain = cookie->Domain(); 102 std::string cookie_domain = cookie->Domain();
103 if (cookie_domain[0] == '.') 103 if (cookie_domain[0] == '.')
104 cookie_domain = cookie_domain.substr(1); 104 cookie_domain = cookie_domain.substr(1);
105 // The |domain_url| is only created in order to use the 105 // The |domain_url| is only created in order to use the
106 // SameDomainOrHost method below. It does not matter which scheme is 106 // SameDomainOrHost method below. It does not matter which scheme is
107 // used as the scheme is ignored by the SameDomainOrHost method. 107 // used as the scheme is ignored by the SameDomainOrHost method.
108 GURL domain_url(std::string(url::kHttpScheme) + 108 GURL domain_url(std::string(url::kHttpScheme) +
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 appcaches(), 210 appcaches(),
211 indexed_dbs(), 211 indexed_dbs(),
212 file_systems(), 212 file_systems(),
213 NULL, 213 NULL,
214 channel_ids(), 214 channel_ids(),
215 service_workers(), 215 service_workers(),
216 NULL); 216 NULL);
217 217
218 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); 218 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true));
219 } 219 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/canonical_cookie_hash.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698