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

Unified Diff: trunk/src/chrome/browser/prerender/prerender_tracker.cc

Issue 280383002: Revert 269855 "Only commit cookie changes in prerenders after a ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/prerender/prerender_tracker.cc
===================================================================
--- trunk/src/chrome/browser/prerender/prerender_tracker.cc (revision 269877)
+++ trunk/src/chrome/browser/prerender/prerender_tracker.cc (working copy)
@@ -8,9 +8,6 @@
#include "base/logging.h"
#include "chrome/browser/prerender/prerender_pending_swap_throttle.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_process_host.h"
-#include "net/url_request/url_request_context.h"
-#include "net/url_request/url_request_context_getter.h"
using content::BrowserThread;
@@ -106,88 +103,4 @@
PrerenderTracker::PendingSwapThrottleData::~PendingSwapThrottleData() {
}
-scoped_refptr<PrerenderCookieStore>
-PrerenderTracker::GetPrerenderCookieStoreForRenderProcess(
- int process_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- PrerenderCookieStoreMap::const_iterator it =
- prerender_cookie_store_map_.find(process_id);
-
- if (it == prerender_cookie_store_map_.end())
- return NULL;
-
- return it->second;
-}
-
-void PrerenderTracker::OnCookieChangedForURL(
- int process_id,
- net::CookieMonster* cookie_monster,
- const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- // We only care about cookie changes by non-prerender tabs, since only those
- // get applied to the underlying cookie store. Therefore, if a cookie change
- // originated from a prerender, there is nothing to do.
- if (ContainsKey(prerender_cookie_store_map_, process_id))
- return;
-
- // Since the cookie change did not come from a prerender, broadcast it too
- // all prerenders so that they can be cancelled if there is a conflict.
- for (PrerenderCookieStoreMap::iterator it =
- prerender_cookie_store_map_.begin();
- it != prerender_cookie_store_map_.end();
- ++it) {
- it->second->OnCookieChangedForURL(cookie_monster, url);
- }
-}
-
-void PrerenderTracker::RemovePrerenderCookieStoreOnIOThread(int process_id,
- bool was_swapped) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- PrerenderCookieStoreMap::iterator it =
- prerender_cookie_store_map_.find(process_id);
-
- if (it == prerender_cookie_store_map_.end())
- return;
-
- std::vector<GURL> cookie_change_urls;
- if (was_swapped)
- it->second->ApplyChanges(&cookie_change_urls);
-
- scoped_refptr<net::CookieMonster> cookie_monster(
- it->second->default_cookie_monster());
-
- prerender_cookie_store_map_.erase(it);
-
- // For each cookie updated by ApplyChanges, we need to call
- // OnCookieChangedForURL so that any potentially conflicting prerenders
- // will be aborted.
- for (std::vector<GURL>::const_iterator url_it = cookie_change_urls.begin();
- url_it != cookie_change_urls.end();
- ++url_it) {
- OnCookieChangedForURL(process_id, cookie_monster, *url_it);
- }
-}
-
-void PrerenderTracker::AddPrerenderCookieStoreOnIOThread(
- int process_id,
- scoped_refptr<net::URLRequestContextGetter> request_context,
- const base::Closure& cookie_conflict_cb) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(request_context != NULL);
- net::CookieMonster* cookie_monster =
- request_context->GetURLRequestContext()->cookie_store()->
- GetCookieMonster();
- DCHECK(cookie_monster != NULL);
- bool exists = (prerender_cookie_store_map_.find(process_id) !=
- prerender_cookie_store_map_.end());
- DCHECK(!exists);
- if (exists)
- return;
- prerender_cookie_store_map_[process_id] =
- new PrerenderCookieStore(make_scoped_refptr(cookie_monster),
- cookie_conflict_cb);
-}
-
} // namespace prerender
« no previous file with comments | « trunk/src/chrome/browser/prerender/prerender_tracker.h ('k') | trunk/src/chrome/browser/prerender/prerender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698