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

Side by Side Diff: chrome/browser/net/evicted_domain_cookie_counter.cc

Issue 233353003: Only commit cookie changes in prerenders after a prerender is shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add browser tests, fix a bug in what was changed yesterday. Created 6 years, 7 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
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (cause == net::CookieMonster::Delegate::CHANGE_COOKIE_EVICTED) 104 if (cause == net::CookieMonster::Delegate::CHANGE_COOKIE_EVICTED)
105 StoreEvictedCookie(key, cookie, current_time); 105 StoreEvictedCookie(key, cookie, current_time);
106 } else { // Includes adds or updates. 106 } else { // Includes adds or updates.
107 ProcessNewCookie(key, cookie, current_time); 107 ProcessNewCookie(key, cookie, current_time);
108 } 108 }
109 109
110 if (next_cookie_monster_delegate_.get()) 110 if (next_cookie_monster_delegate_.get())
111 next_cookie_monster_delegate_->OnCookieChanged(cookie, removed, cause); 111 next_cookie_monster_delegate_->OnCookieChanged(cookie, removed, cause);
112 } 112 }
113 113
114 void EvictedDomainCookieCounter::OnLoaded() {
115 if (next_cookie_monster_delegate_.get())
116 next_cookie_monster_delegate_->OnLoaded();
117 }
118
114 // static 119 // static
115 EvictedDomainCookieCounter::EvictedCookieKey 120 EvictedDomainCookieCounter::EvictedCookieKey
116 EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) { 121 EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) {
117 return cookie.Domain() + ";" + cookie.Path() + ";" + cookie.Name(); 122 return cookie.Domain() + ";" + cookie.Path() + ";" + cookie.Name();
118 } 123 }
119 124
120 // static 125 // static
121 bool EvictedDomainCookieCounter::CompareEvictedCookie( 126 bool EvictedDomainCookieCounter::CompareEvictedCookie(
122 const EvictedCookieMap::iterator evicted_cookie1, 127 const EvictedCookieMap::iterator evicted_cookie1,
123 const EvictedCookieMap::iterator evicted_cookie2) { 128 const EvictedCookieMap::iterator evicted_cookie2) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 EvictedCookieMap::iterator it = evicted_cookies_.find(key); 198 EvictedCookieMap::iterator it = evicted_cookies_.find(key);
194 if (it != evicted_cookies_.end()) { 199 if (it != evicted_cookies_.end()) {
195 if (!it->second->is_expired(current_time)) // Reinstatement. 200 if (!it->second->is_expired(current_time)) // Reinstatement.
196 cookie_counter_delegate_->Report(*it->second, current_time); 201 cookie_counter_delegate_->Report(*it->second, current_time);
197 delete it->second; 202 delete it->second;
198 evicted_cookies_.erase(it); 203 evicted_cookies_.erase(it);
199 } 204 }
200 } 205 }
201 206
202 } // namespace chrome_browser_net 207 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698