OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/net/evicted_domain_cookie_counter.h" | 5 #include "chrome/browser/net/evicted_domain_cookie_counter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 virtual Time CurrentTime() const OVERRIDE; | 34 virtual Time CurrentTime() const OVERRIDE; |
35 }; | 35 }; |
36 | 36 |
37 DelegateImpl::DelegateImpl() {} | 37 DelegateImpl::DelegateImpl() {} |
38 | 38 |
39 void DelegateImpl::Report( | 39 void DelegateImpl::Report( |
40 const EvictedDomainCookieCounter::EvictedCookie& evicted_cookie, | 40 const EvictedDomainCookieCounter::EvictedCookie& evicted_cookie, |
41 const Time& reinstatement_time) { | 41 const Time& reinstatement_time) { |
42 TimeDelta reinstatement_delay( | 42 TimeDelta reinstatement_delay( |
43 reinstatement_time - evicted_cookie.eviction_time); | 43 reinstatement_time - evicted_cookie.eviction_time); |
44 // Need to duplicate HISTOGRAM_CUSTOM_TIMES(), since it is a macro that | 44 // Need to duplicate UMA_HISTOGRAM_CUSTOM_TIMES(), since it is a macro that |
45 // defines a static variable. | 45 // defines a static variable. |
46 if (evicted_cookie.is_google) { | 46 if (evicted_cookie.is_google) { |
47 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.ReinstatedCookiesGoogle", | 47 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.ReinstatedCookiesGoogle", |
48 reinstatement_delay, | 48 reinstatement_delay, |
49 TimeDelta::FromSeconds(1), | 49 TimeDelta::FromSeconds(1), |
50 TimeDelta::FromDays(7), | 50 TimeDelta::FromDays(7), |
51 50); | 51 50); |
52 } else { | 52 } else { |
53 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.ReinstatedCookiesOther", | 53 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.ReinstatedCookiesOther", |
54 reinstatement_delay, | 54 reinstatement_delay, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 EvictedCookieMap::iterator it = evicted_cookies_.find(key); | 198 EvictedCookieMap::iterator it = evicted_cookies_.find(key); |
199 if (it != evicted_cookies_.end()) { | 199 if (it != evicted_cookies_.end()) { |
200 if (!it->second->is_expired(current_time)) // Reinstatement. | 200 if (!it->second->is_expired(current_time)) // Reinstatement. |
201 cookie_counter_delegate_->Report(*it->second, current_time); | 201 cookie_counter_delegate_->Report(*it->second, current_time); |
202 delete it->second; | 202 delete it->second; |
203 evicted_cookies_.erase(it); | 203 evicted_cookies_.erase(it); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 } // namespace chrome_browser_net | 207 } // namespace chrome_browser_net |
OLD | NEW |