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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 6901128: Cancel prerenders that spawn post requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 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
« no previous file with comments | « chrome/test/data/prerender/prerender_xhr_post.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 std::make_pair(child_id, route_id), 416 std::make_pair(child_id, route_id),
417 request_data.url, 417 request_data.url,
418 referrer, 418 referrer,
419 is_prerendering)); 419 is_prerendering));
420 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); 420 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
421 return; 421 return;
422 } 422 }
423 // Otherwise, treat like a normal request, and fall-through. 423 // Otherwise, treat like a normal request, and fall-through.
424 } 424 }
425 425
426 // Abort any prerenders that spawn requests that are not GET methods.
427 if (is_prerendering && request_data.method != "GET") {
cbentzel 2011/04/29 20:00:30 HEAD should be allowed. OPTIONS could probably b
dominich 2011/04/29 21:13:52 Done.
428 CHECK(IsPrerenderingChildRoutePair(child_id, route_id));
cbentzel 2011/04/29 20:00:30 This CHECK is not necessary - is_prerendering is s
dominich 2011/04/29 21:13:52 Done.
429 BrowserThread::PostTask(
430 BrowserThread::UI, FROM_HERE,
431 NewRunnableFunction(
432 prerender::DestroyPreloadForChildRouteIdPairOnUIThread,
433 resource_context.prerender_manager(),
434 std::make_pair(child_id, route_id),
435 prerender::FINAL_STATUS_NOT_GET));
436 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
437 return;
438 }
426 439
427 // Construct the event handler. 440 // Construct the event handler.
428 scoped_refptr<ResourceHandler> handler; 441 scoped_refptr<ResourceHandler> handler;
429 if (sync_result) { 442 if (sync_result) {
430 handler = new SyncResourceHandler( 443 handler = new SyncResourceHandler(
431 filter_, request_data.url, sync_result, this); 444 filter_, request_data.url, sync_result, this);
432 } else { 445 } else {
433 handler = new AsyncResourceHandler( 446 handler = new AsyncResourceHandler(
434 filter_, route_id, request_data.url, 447 filter_, route_id, request_data.url,
435 resource_context.host_zoom_map(), 448 resource_context.host_zoom_map(),
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 return is_prefetch_enabled_; 2002 return is_prefetch_enabled_;
1990 } 2003 }
1991 2004
1992 // static 2005 // static
1993 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { 2006 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) {
1994 is_prefetch_enabled_ = value; 2007 is_prefetch_enabled_ = value;
1995 } 2008 }
1996 2009
1997 // static 2010 // static
1998 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; 2011 bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
OLDNEW
« no previous file with comments | « chrome/test/data/prerender/prerender_xhr_post.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698