OLD | NEW |
---|---|
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 #include "chrome/browser/prerender/prerender_tracker.h" | 5 #include "chrome/browser/prerender/prerender_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" | 9 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 it->second->default_cookie_monster()); | 159 it->second->default_cookie_monster()); |
160 | 160 |
161 prerender_cookie_store_map_.erase(it); | 161 prerender_cookie_store_map_.erase(it); |
162 | 162 |
163 // For each cookie updated by ApplyChanges, we need to call | 163 // For each cookie updated by ApplyChanges, we need to call |
164 // OnCookieChangedForURL so that any potentially conflicting prerenders | 164 // OnCookieChangedForURL so that any potentially conflicting prerenders |
165 // will be aborted. | 165 // will be aborted. |
166 for (std::vector<GURL>::const_iterator url_it = cookie_change_urls.begin(); | 166 for (std::vector<GURL>::const_iterator url_it = cookie_change_urls.begin(); |
167 url_it != cookie_change_urls.end(); | 167 url_it != cookie_change_urls.end(); |
168 ++url_it) { | 168 ++url_it) { |
169 OnCookieChangedForURL(process_id, cookie_monster, *url_it); | 169 OnCookieChangedForURL(process_id, cookie_monster.get(), *url_it); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void PrerenderTracker::AddPrerenderCookieStoreOnIOThread( | 173 void PrerenderTracker::AddPrerenderCookieStoreOnIOThread( |
174 int process_id, | 174 int process_id, |
175 scoped_refptr<net::URLRequestContextGetter> request_context, | 175 scoped_refptr<net::URLRequestContextGetter> request_context, |
176 const base::Closure& cookie_conflict_cb) { | 176 const base::Closure& cookie_conflict_cb) { |
177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
178 DCHECK(request_context != NULL); | 178 DCHECK(request_context.get() != NULL); |
gavinp
2014/08/27 17:30:21
Nit: DCHECK_NE?
dcheng
2014/08/27 17:57:34
DCHECK_NE(foo, NULL) actually doesn't compile, sin
| |
179 net::CookieMonster* cookie_monster = | 179 net::CookieMonster* cookie_monster = |
180 request_context->GetURLRequestContext()->cookie_store()-> | 180 request_context->GetURLRequestContext()->cookie_store()-> |
181 GetCookieMonster(); | 181 GetCookieMonster(); |
182 DCHECK(cookie_monster != NULL); | 182 DCHECK(cookie_monster != NULL); |
183 bool exists = (prerender_cookie_store_map_.find(process_id) != | 183 bool exists = (prerender_cookie_store_map_.find(process_id) != |
184 prerender_cookie_store_map_.end()); | 184 prerender_cookie_store_map_.end()); |
185 DCHECK(!exists); | 185 DCHECK(!exists); |
186 if (exists) | 186 if (exists) |
187 return; | 187 return; |
188 prerender_cookie_store_map_[process_id] = | 188 prerender_cookie_store_map_[process_id] = |
189 new PrerenderCookieStore(make_scoped_refptr(cookie_monster), | 189 new PrerenderCookieStore(make_scoped_refptr(cookie_monster), |
190 cookie_conflict_cb); | 190 cookie_conflict_cb); |
191 } | 191 } |
192 | 192 |
193 } // namespace prerender | 193 } // namespace prerender |
OLD | NEW |