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

Side by Side Diff: net/cookies/cookie_monster.cc

Issue 1569673002: [NOT FOR LANDING] Detailed loading traces Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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 // Portions of this code based on Mozilla: 5 // Portions of this code based on Mozilla:
6 // (netwerk/cookie/src/nsCookieService.cpp) 6 // (netwerk/cookie/src/nsCookieService.cpp)
7 /* ***** BEGIN LICENSE BLOCK ***** 7 /* ***** BEGIN LICENSE BLOCK *****
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9 * 9 *
10 * The contents of this file are subject to the Mozilla Public License Version 10 * The contents of this file are subject to the Mozilla Public License Version
(...skipping 29 matching lines...) Expand all
40 * the provisions above, a recipient may use your version of this file under 40 * the provisions above, a recipient may use your version of this file under
41 * the terms of any one of the MPL, the GPL or the LGPL. 41 * the terms of any one of the MPL, the GPL or the LGPL.
42 * 42 *
43 * ***** END LICENSE BLOCK ***** */ 43 * ***** END LICENSE BLOCK ***** */
44 44
45 #include "net/cookies/cookie_monster.h" 45 #include "net/cookies/cookie_monster.h"
46 46
47 #include <algorithm> 47 #include <algorithm>
48 #include <functional> 48 #include <functional>
49 #include <set> 49 #include <set>
50 50 #include "base/trace_event/trace_event.h"
51 #include "base/bind.h" 51 #include "base/bind.h"
52 #include "base/callback.h" 52 #include "base/callback.h"
53 #include "base/location.h" 53 #include "base/location.h"
54 #include "base/logging.h" 54 #include "base/logging.h"
55 #include "base/macros.h" 55 #include "base/macros.h"
56 #include "base/memory/scoped_ptr.h" 56 #include "base/memory/scoped_ptr.h"
57 #include "base/metrics/field_trial.h" 57 #include "base/metrics/field_trial.h"
58 #include "base/metrics/histogram.h" 58 #include "base/metrics/histogram.h"
59 #include "base/profiler/scoped_tracker.h" 59 #include "base/profiler/scoped_tracker.h"
60 #include "base/single_thread_task_runner.h" 60 #include "base/single_thread_task_runner.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 private: 527 private:
528 GURL url_; 528 GURL url_;
529 CookieOptions options_; 529 CookieOptions options_;
530 GetCookieListCallback callback_; 530 GetCookieListCallback callback_;
531 531
532 DISALLOW_COPY_AND_ASSIGN(GetCookieListWithOptionsTask); 532 DISALLOW_COPY_AND_ASSIGN(GetCookieListWithOptionsTask);
533 }; 533 };
534 534
535 void CookieMonster::GetCookieListWithOptionsTask::Run() { 535 void CookieMonster::GetCookieListWithOptionsTask::Run() {
536 TRACE_EVENT0("toplevel", "CookieMonster::GetCookieListWithOptionsTask::Run");
536 if (!callback_.is_null()) { 537 if (!callback_.is_null()) {
537 CookieList cookies = 538 CookieList cookies =
538 this->cookie_monster()->GetCookieListWithOptions(url_, options_); 539 this->cookie_monster()->GetCookieListWithOptions(url_, options_);
539 this->InvokeCallback(base::Bind(&GetCookieListCallback::Run, 540 this->InvokeCallback(base::Bind(&GetCookieListCallback::Run,
540 base::Unretained(&callback_), cookies)); 541 base::Unretained(&callback_), cookies));
541 } 542 }
542 } 543 }
543 544
544 template <typename Result> 545 template <typename Result>
545 struct CallbackType { 546 struct CallbackType {
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); 1123 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin();
1123 it != cookie_ptrs.end(); ++it) 1124 it != cookie_ptrs.end(); ++it)
1124 cookie_list.push_back(**it); 1125 cookie_list.push_back(**it);
1125 1126
1126 return cookie_list; 1127 return cookie_list;
1127 } 1128 }
1128 1129
1129 CookieList CookieMonster::GetCookieListWithOptions( 1130 CookieList CookieMonster::GetCookieListWithOptions(
1130 const GURL& url, 1131 const GURL& url,
1131 const CookieOptions& options) { 1132 const CookieOptions& options) {
1133 TRACE_EVENT0("toplevel", "CookieMonster::GetAllCookiesForURLWithOptions");
1132 base::AutoLock autolock(lock_); 1134 base::AutoLock autolock(lock_);
1133 1135
1134 CookieList cookies; 1136 CookieList cookies;
1135 if (!HasCookieableScheme(url)) 1137 if (!HasCookieableScheme(url))
1136 return cookies; 1138 return cookies;
1137 1139
1138 std::vector<CanonicalCookie*> cookie_ptrs; 1140 std::vector<CanonicalCookie*> cookie_ptrs;
1139 FindCookiesForHostAndDomain(url, options, &cookie_ptrs); 1141 FindCookiesForHostAndDomain(url, options, &cookie_ptrs);
1140 std::sort(cookie_ptrs.begin(), cookie_ptrs.end(), CookieSorter); 1142 std::sort(cookie_ptrs.begin(), cookie_ptrs.end(), CookieSorter);
1141 1143
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 } 1318 }
1317 1319
1318 return num_deleted; 1320 return num_deleted;
1319 } 1321 }
1320 1322
1321 void CookieMonster::MarkCookieStoreAsInitialized() { 1323 void CookieMonster::MarkCookieStoreAsInitialized() {
1322 initialized_ = true; 1324 initialized_ = true;
1323 } 1325 }
1324 1326
1325 void CookieMonster::FetchAllCookiesIfNecessary() { 1327 void CookieMonster::FetchAllCookiesIfNecessary() {
1328 TRACE_EVENT0("toplevel", "CookieMonster::FetchAllCookiesIfNecessary");
1329
1326 if (store_.get() && !started_fetching_all_cookies_) { 1330 if (store_.get() && !started_fetching_all_cookies_) {
1327 started_fetching_all_cookies_ = true; 1331 started_fetching_all_cookies_ = true;
1328 FetchAllCookies(); 1332 FetchAllCookies();
1329 } 1333 }
1330 } 1334 }
1331 1335
1332 void CookieMonster::FetchAllCookies() { 1336 void CookieMonster::FetchAllCookies() {
1333 DCHECK(store_.get()) << "Store must exist to initialize"; 1337 DCHECK(store_.get()) << "Store must exist to initialize";
1334 DCHECK(!finished_fetching_all_cookies_) 1338 DCHECK(!finished_fetching_all_cookies_)
1335 << "All cookies have already been fetched."; 1339 << "All cookies have already been fetched.";
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 it != hook_map_.end(); ++it) { 2432 it != hook_map_.end(); ++it) {
2429 std::pair<GURL, std::string> key = it->first; 2433 std::pair<GURL, std::string> key = it->first;
2430 if (cookie.IncludeForRequestURL(key.first, opts) && 2434 if (cookie.IncludeForRequestURL(key.first, opts) &&
2431 cookie.Name() == key.second) { 2435 cookie.Name() == key.second) {
2432 it->second->Notify(cookie, removed); 2436 it->second->Notify(cookie, removed);
2433 } 2437 }
2434 } 2438 }
2435 } 2439 }
2436 2440
2437 } // namespace net 2441 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_openssl.cc ('k') | net/extras/sqlite/sqlite_persistent_cookie_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698