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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 request->set_context(context); | 437 request->set_context(context); |
437 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 438 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
438 | 439 |
439 // Set upload data. | 440 // Set upload data. |
440 uint64 upload_size = 0; | 441 uint64 upload_size = 0; |
441 if (request_data.upload_data) { | 442 if (request_data.upload_data) { |
442 request->set_upload(request_data.upload_data); | 443 request->set_upload(request_data.upload_data); |
443 upload_size = request_data.upload_data->GetContentLength(); | 444 upload_size = request_data.upload_data->GetContentLength(); |
444 } | 445 } |
445 | 446 |
447 // Install a PrerenderResourceHandler if the requested URL could | |
448 // be prerendered. This should be in front of the [a]syncResourceHandler, | |
449 // but after the BufferedResourceHandler since it depends on the MIME | |
450 // sniffing capabilities in the BufferedResourceHandler. | |
451 if (context && context->prerender_manager() && | |
452 PrerenderResourceHandler::CouldPrerender(request)) { | |
453 handler = new PrerenderResourceHandler(handler, | |
454 context->prerender_manager()); | |
gavinp
2010/12/17 16:15:33
An idea, not sure if it's the right thing: how abo
cbentzel
2010/12/17 16:23:21
I'm not sure I understand what you are asking for
| |
455 } | |
456 | |
446 // Install a CrossSiteResourceHandler if this request is coming from a | 457 // Install a CrossSiteResourceHandler if this request is coming from a |
447 // 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 |
448 // 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 |
449 // not count as cross-site, otherwise it gets blocked indefinitely. | 460 // not count as cross-site, otherwise it gets blocked indefinitely. |
450 if (request_data.resource_type == ResourceType::MAIN_FRAME && | 461 if (request_data.resource_type == ResourceType::MAIN_FRAME && |
451 process_type == ChildProcessInfo::RENDER_PROCESS && | 462 process_type == ChildProcessInfo::RENDER_PROCESS && |
452 CrossSiteRequestManager::GetInstance()-> | 463 CrossSiteRequestManager::GetInstance()-> |
453 HasPendingCrossSiteRequest(child_id, route_id)) { | 464 HasPendingCrossSiteRequest(child_id, route_id)) { |
454 // 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 |
455 // has a chance to run before we render the new page. | 466 // has a chance to run before we render the new page. |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1904 return is_prefetch_enabled_; | 1915 return is_prefetch_enabled_; |
1905 } | 1916 } |
1906 | 1917 |
1907 // static | 1918 // static |
1908 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1919 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1909 is_prefetch_enabled_ = value; | 1920 is_prefetch_enabled_ = value; |
1910 } | 1921 } |
1911 | 1922 |
1912 // static | 1923 // static |
1913 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1924 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |