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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 request->set_context(context); | 438 request->set_context(context); |
438 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 439 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
439 | 440 |
440 // Set upload data. | 441 // Set upload data. |
441 uint64 upload_size = 0; | 442 uint64 upload_size = 0; |
442 if (request_data.upload_data) { | 443 if (request_data.upload_data) { |
443 request->set_upload(request_data.upload_data); | 444 request->set_upload(request_data.upload_data); |
444 upload_size = request_data.upload_data->GetContentLength(); | 445 upload_size = request_data.upload_data->GetContentLength(); |
445 } | 446 } |
446 | 447 |
| 448 // Install a PrerenderResourceHandler if the requested URL could |
| 449 // be prerendered. This should be in front of the [a]syncResourceHandler, |
| 450 // but after the BufferedResourceHandler since it depends on the MIME |
| 451 // sniffing capabilities in the BufferedResourceHandler. |
| 452 PrerenderResourceHandler* pre_handler = PrerenderResourceHandler::MaybeCreate( |
| 453 *request, context, handler); |
| 454 if (pre_handler) |
| 455 handler = pre_handler; |
| 456 |
447 // Install a CrossSiteResourceHandler if this request is coming from a | 457 // Install a CrossSiteResourceHandler if this request is coming from a |
448 // RenderViewHost with a pending cross-site request. We only check this for | 458 // RenderViewHost with a pending cross-site request. We only check this for |
449 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do | 459 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do |
450 // not count as cross-site, otherwise it gets blocked indefinitely. | 460 // not count as cross-site, otherwise it gets blocked indefinitely. |
451 if (request_data.resource_type == ResourceType::MAIN_FRAME && | 461 if (request_data.resource_type == ResourceType::MAIN_FRAME && |
452 process_type == ChildProcessInfo::RENDER_PROCESS && | 462 process_type == ChildProcessInfo::RENDER_PROCESS && |
453 CrossSiteRequestManager::GetInstance()-> | 463 CrossSiteRequestManager::GetInstance()-> |
454 HasPendingCrossSiteRequest(child_id, route_id)) { | 464 HasPendingCrossSiteRequest(child_id, route_id)) { |
455 // Wrap the event handler to be sure the current page's onunload handler | 465 // Wrap the event handler to be sure the current page's onunload handler |
456 // has a chance to run before we render the new page. | 466 // has a chance to run before we render the new page. |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 return is_prefetch_enabled_; | 1923 return is_prefetch_enabled_; |
1914 } | 1924 } |
1915 | 1925 |
1916 // static | 1926 // static |
1917 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1927 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1918 is_prefetch_enabled_ = value; | 1928 is_prefetch_enabled_ = value; |
1919 } | 1929 } |
1920 | 1930 |
1921 // static | 1931 // static |
1922 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1932 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |