OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 DCHECK(store_) << "Store must exist to initialize"; | 1490 DCHECK(store_) << "Store must exist to initialize"; |
1491 | 1491 |
1492 // We bind in the current time so that we can report the wall-clock time for | 1492 // We bind in the current time so that we can report the wall-clock time for |
1493 // loading cookies. | 1493 // loading cookies. |
1494 store_->Load(base::Bind(&CookieMonster::OnLoaded, this, TimeTicks::Now())); | 1494 store_->Load(base::Bind(&CookieMonster::OnLoaded, this, TimeTicks::Now())); |
1495 } | 1495 } |
1496 | 1496 |
1497 void CookieMonster::OnLoaded(TimeTicks beginning_time, | 1497 void CookieMonster::OnLoaded(TimeTicks beginning_time, |
1498 const std::vector<CanonicalCookie*>& cookies) { | 1498 const std::vector<CanonicalCookie*>& cookies) { |
1499 StoreLoadedCookies(cookies); | 1499 StoreLoadedCookies(cookies); |
1500 histogram_time_load_->AddTime(TimeTicks::Now() - beginning_time); | 1500 histogram_time_blocked_on_load_->AddTime(TimeTicks::Now() - beginning_time); |
1501 | 1501 |
1502 // Invoke the task queue of cookie request. | 1502 // Invoke the task queue of cookie request. |
1503 InvokeQueue(); | 1503 InvokeQueue(); |
1504 } | 1504 } |
1505 | 1505 |
1506 void CookieMonster::OnKeyLoaded(const std::string& key, | 1506 void CookieMonster::OnKeyLoaded(const std::string& key, |
1507 const std::vector<CanonicalCookie*>& cookies) { | 1507 const std::vector<CanonicalCookie*>& cookies) { |
1508 // This function does its own separate locking. | 1508 // This function does its own separate locking. |
1509 StoreLoadedCookies(cookies); | 1509 StoreLoadedCookies(cookies); |
1510 | 1510 |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 DELETE_COOKIE_LAST_ENTRY - 1, DELETE_COOKIE_LAST_ENTRY, | 2291 DELETE_COOKIE_LAST_ENTRY - 1, DELETE_COOKIE_LAST_ENTRY, |
2292 base::Histogram::kUmaTargetedHistogramFlag); | 2292 base::Histogram::kUmaTargetedHistogramFlag); |
2293 | 2293 |
2294 // From UMA_HISTOGRAM_{CUSTOM_,}TIMES | 2294 // From UMA_HISTOGRAM_{CUSTOM_,}TIMES |
2295 histogram_time_get_ = base::Histogram::FactoryTimeGet("Cookie.TimeGet", | 2295 histogram_time_get_ = base::Histogram::FactoryTimeGet("Cookie.TimeGet", |
2296 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), | 2296 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), |
2297 50, base::Histogram::kUmaTargetedHistogramFlag); | 2297 50, base::Histogram::kUmaTargetedHistogramFlag); |
2298 histogram_time_mac_ = base::Histogram::FactoryTimeGet("Cookie.TimeGetMac", | 2298 histogram_time_mac_ = base::Histogram::FactoryTimeGet("Cookie.TimeGetMac", |
2299 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), | 2299 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), |
2300 50, base::Histogram::kUmaTargetedHistogramFlag); | 2300 50, base::Histogram::kUmaTargetedHistogramFlag); |
2301 histogram_time_load_ = base::Histogram::FactoryTimeGet("Cookie.TimeLoad", | 2301 histogram_time_blocked_on_load_ = base::Histogram::FactoryTimeGet( |
| 2302 "Cookie.TimeBlockedOnLoad", |
2302 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), | 2303 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), |
2303 50, base::Histogram::kUmaTargetedHistogramFlag); | 2304 50, base::Histogram::kUmaTargetedHistogramFlag); |
2304 } | 2305 } |
2305 | 2306 |
2306 | 2307 |
2307 // The system resolution is not high enough, so we can have multiple | 2308 // The system resolution is not high enough, so we can have multiple |
2308 // set cookies that result in the same system time. When this happens, we | 2309 // set cookies that result in the same system time. When this happens, we |
2309 // increment by one Time unit. Let's hope computers don't get too fast. | 2310 // increment by one Time unit. Let's hope computers don't get too fast. |
2310 Time CookieMonster::CurrentTime() { | 2311 Time CookieMonster::CurrentTime() { |
2311 return std::max(Time::Now(), | 2312 return std::max(Time::Now(), |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2826 std::string CookieMonster::CanonicalCookie::DebugString() const { | 2827 std::string CookieMonster::CanonicalCookie::DebugString() const { |
2827 return base::StringPrintf( | 2828 return base::StringPrintf( |
2828 "name: %s value: %s domain: %s path: %s creation: %" | 2829 "name: %s value: %s domain: %s path: %s creation: %" |
2829 PRId64, | 2830 PRId64, |
2830 name_.c_str(), value_.c_str(), | 2831 name_.c_str(), value_.c_str(), |
2831 domain_.c_str(), path_.c_str(), | 2832 domain_.c_str(), path_.c_str(), |
2832 static_cast<int64>(creation_date_.ToTimeT())); | 2833 static_cast<int64>(creation_date_.ToTimeT())); |
2833 } | 2834 } |
2834 | 2835 |
2835 } // namespace | 2836 } // namespace |
OLD | NEW |