| 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 12 matching lines...) Expand all Loading... |
| 23 const size_t kMaxEvictedDomainCookies = 500; | 23 const size_t kMaxEvictedDomainCookies = 500; |
| 24 const size_t kPurgeEvictedDomainCookies = 100; | 24 const size_t kPurgeEvictedDomainCookies = 100; |
| 25 | 25 |
| 26 class DelegateImpl : public EvictedDomainCookieCounter::Delegate { | 26 class DelegateImpl : public EvictedDomainCookieCounter::Delegate { |
| 27 public: | 27 public: |
| 28 DelegateImpl(); | 28 DelegateImpl(); |
| 29 | 29 |
| 30 // EvictedDomainCookieCounter::Delegate implementation. | 30 // EvictedDomainCookieCounter::Delegate implementation. |
| 31 virtual void Report( | 31 virtual void Report( |
| 32 const EvictedDomainCookieCounter::EvictedCookie& evicted_cookie, | 32 const EvictedDomainCookieCounter::EvictedCookie& evicted_cookie, |
| 33 const Time& reinstatement_time) OVERRIDE; | 33 const Time& reinstatement_time) override; |
| 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 UMA_HISTOGRAM_CUSTOM_TIMES(), since it is a macro that | 44 // Need to duplicate UMA_HISTOGRAM_CUSTOM_TIMES(), since it is a macro that |
| (...skipping 153 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 |