OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/download/download_file_manager.h" | 24 #include "chrome/browser/download/download_file_manager.h" |
25 #include "chrome/browser/download/download_manager.h" | 25 #include "chrome/browser/download/download_manager.h" |
26 #include "chrome/browser/download/download_request_limiter.h" | 26 #include "chrome/browser/download/download_request_limiter.h" |
27 #include "chrome/browser/download/save_file_manager.h" | 27 #include "chrome/browser/download/save_file_manager.h" |
28 #include "chrome/browser/extensions/user_script_listener.h" | 28 #include "chrome/browser/extensions/user_script_listener.h" |
29 #include "chrome/browser/external_protocol_handler.h" | 29 #include "chrome/browser/external_protocol_handler.h" |
30 #include "chrome/browser/in_process_webkit/webkit_thread.h" | 30 #include "chrome/browser/in_process_webkit/webkit_thread.h" |
31 #include "chrome/browser/net/chrome_url_request_context.h" | 31 #include "chrome/browser/net/chrome_url_request_context.h" |
32 #include "chrome/browser/net/url_request_tracking.h" | 32 #include "chrome/browser/net/url_request_tracking.h" |
33 #include "chrome/browser/plugin_service.h" | 33 #include "chrome/browser/plugin_service.h" |
| 34 #include "chrome/browser/prerender/prerender_resource_handler.h" |
34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/renderer_host/async_resource_handler.h" | 36 #include "chrome/browser/renderer_host/async_resource_handler.h" |
36 #include "chrome/browser/renderer_host/buffered_resource_handler.h" | 37 #include "chrome/browser/renderer_host/buffered_resource_handler.h" |
37 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" | 38 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" |
38 #include "chrome/browser/renderer_host/download_resource_handler.h" | 39 #include "chrome/browser/renderer_host/download_resource_handler.h" |
39 #include "chrome/browser/renderer_host/global_request_id.h" | 40 #include "chrome/browser/renderer_host/global_request_id.h" |
40 #include "chrome/browser/renderer_host/redirect_to_file_resource_handler.h" | 41 #include "chrome/browser/renderer_host/redirect_to_file_resource_handler.h" |
41 #include "chrome/browser/renderer_host/render_view_host.h" | 42 #include "chrome/browser/renderer_host/render_view_host.h" |
42 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 43 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
43 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" | 44 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 request->set_context(context); | 458 request->set_context(context); |
458 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 459 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
459 | 460 |
460 // Set upload data. | 461 // Set upload data. |
461 uint64 upload_size = 0; | 462 uint64 upload_size = 0; |
462 if (request_data.upload_data) { | 463 if (request_data.upload_data) { |
463 request->set_upload(request_data.upload_data); | 464 request->set_upload(request_data.upload_data); |
464 upload_size = request_data.upload_data->GetContentLength(); | 465 upload_size = request_data.upload_data->GetContentLength(); |
465 } | 466 } |
466 | 467 |
| 468 // Install a PrerenderResourceHandler if the requested URL could |
| 469 // be prerendered. This should be in front of the [a]syncResourceHandler, |
| 470 // but after the BufferedResourceHandler since it depends on the MIME |
| 471 // sniffing capabilities in the BufferedResourceHandler. |
| 472 PrerenderResourceHandler* pre_handler = PrerenderResourceHandler::MaybeCreate( |
| 473 *request, context, handler); |
| 474 if (pre_handler) |
| 475 handler = pre_handler; |
| 476 |
467 // Install a CrossSiteResourceHandler if this request is coming from a | 477 // Install a CrossSiteResourceHandler if this request is coming from a |
468 // RenderViewHost with a pending cross-site request. We only check this for | 478 // RenderViewHost with a pending cross-site request. We only check this for |
469 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do | 479 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do |
470 // not count as cross-site, otherwise it gets blocked indefinitely. | 480 // not count as cross-site, otherwise it gets blocked indefinitely. |
471 if (request_data.resource_type == ResourceType::MAIN_FRAME && | 481 if (request_data.resource_type == ResourceType::MAIN_FRAME && |
472 process_type == ChildProcessInfo::RENDER_PROCESS && | 482 process_type == ChildProcessInfo::RENDER_PROCESS && |
473 CrossSiteRequestManager::GetInstance()-> | 483 CrossSiteRequestManager::GetInstance()-> |
474 HasPendingCrossSiteRequest(child_id, route_id)) { | 484 HasPendingCrossSiteRequest(child_id, route_id)) { |
475 // Wrap the event handler to be sure the current page's onunload handler | 485 // Wrap the event handler to be sure the current page's onunload handler |
476 // has a chance to run before we render the new page. | 486 // has a chance to run before we render the new page. |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 return is_prefetch_enabled_; | 1945 return is_prefetch_enabled_; |
1936 } | 1946 } |
1937 | 1947 |
1938 // static | 1948 // static |
1939 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1949 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1940 is_prefetch_enabled_ = value; | 1950 is_prefetch_enabled_ = value; |
1941 } | 1951 } |
1942 | 1952 |
1943 // static | 1953 // static |
1944 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1954 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |