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

Unified Diff: chrome/browser/prerender/prerender_contents.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: sync @269781 + 'autlock'->'autolock' from erik's comment that was not included before 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
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/prerender/prerender_cookie_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_contents.cc
===================================================================
--- chrome/browser/prerender/prerender_contents.cc (revision 269781)
+++ chrome/browser/prerender/prerender_contents.cc (working copy)
@@ -39,8 +39,10 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/frame_navigate_params.h"
#include "content/public/common/page_transition_types.h"
+#include "net/url_request/url_request_context_getter.h"
#include "ui/gfx/rect.h"
+using content::BrowserThread;
using content::DownloadItem;
using content::OpenURLParams;
using content::RenderViewHost;
@@ -291,7 +293,8 @@
void PrerenderContents::StartPrerendering(
int creator_child_id,
const gfx::Size& size,
- SessionStorageNamespace* session_storage_namespace) {
+ SessionStorageNamespace* session_storage_namespace,
+ net::URLRequestContextGetter* request_context) {
DCHECK(profile_ != NULL);
DCHECK(!size.IsEmpty());
DCHECK(!prerendering_has_started_);
@@ -339,6 +342,24 @@
// the event of a mismatch.
alias_session_storage_namespace->AddTransactionLogProcessId(child_id_);
+ // Add the RenderProcessHost to the Prerender Manager.
+ prerender_manager()->AddPrerenderProcessHost(
+ GetRenderViewHost()->GetProcess());
+
+ // In the prerender tracker, create a Prerender Cookie Store to keep track of
+ // cookie changes performed by the prerender. Once the prerender is shown,
+ // the cookie changes will be committed to the actual cookie store,
+ // otherwise, they will be discarded.
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&PrerenderTracker::AddPrerenderCookieStoreOnIOThread,
+ base::Unretained(prerender_manager()->prerender_tracker()),
+ GetRenderViewHost()->GetProcess()->GetID(),
+ make_scoped_refptr(request_context),
+ base::Bind(&PrerenderContents::Destroy,
+ AsWeakPtr(),
+ FINAL_STATUS_COOKIE_CONFLICT)));
+
NotifyPrerenderStart();
// Close ourselves when the application is shutting down.
@@ -796,8 +817,8 @@
NotifyPrerenderStop();
- content::BrowserThread::PostTask(
- content::BrowserThread::IO,
+ BrowserThread::PostTask(
+ BrowserThread::IO,
FROM_HERE,
base::Bind(&ResumeThrottles, resource_throttles_));
resource_throttles_.clear();
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/prerender/prerender_cookie_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698