OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/debug/alias.h" | 16 #include "base/debug/alias.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/shared_memory.h" | 21 #include "base/shared_memory.h" |
22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
23 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 23 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 24 #include "base/threading/thread_restrictions.h" |
24 #include "content/browser/appcache/chrome_appcache_service.h" | 25 #include "content/browser/appcache/chrome_appcache_service.h" |
25 #include "content/browser/cert_store.h" | 26 #include "content/browser/cert_store.h" |
26 #include "content/browser/child_process_security_policy_impl.h" | 27 #include "content/browser/child_process_security_policy_impl.h" |
27 #include "content/browser/chrome_blob_storage_context.h" | 28 #include "content/browser/chrome_blob_storage_context.h" |
28 #include "content/browser/cross_site_request_manager.h" | 29 #include "content/browser/cross_site_request_manager.h" |
29 #include "content/browser/download/download_file_manager.h" | 30 #include "content/browser/download/download_file_manager.h" |
30 #include "content/browser/download/download_resource_handler.h" | 31 #include "content/browser/download/download_resource_handler.h" |
31 #include "content/browser/download/save_file_manager.h" | 32 #include "content/browser/download/save_file_manager.h" |
32 #include "content/browser/download/save_file_resource_handler.h" | 33 #include "content/browser/download/save_file_resource_handler.h" |
33 #include "content/browser/plugin_service_impl.h" | 34 #include "content/browser/plugin_service_impl.h" |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 641 |
641 request->set_context( | 642 request->set_context( |
642 filter_->GetURLRequestContext(request_data.resource_type)); | 643 filter_->GetURLRequestContext(request_data.resource_type)); |
643 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 644 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
644 | 645 |
645 // Set upload data. | 646 // Set upload data. |
646 uint64 upload_size = 0; | 647 uint64 upload_size = 0; |
647 if (request_data.upload_data) { | 648 if (request_data.upload_data) { |
648 request->set_upload(request_data.upload_data); | 649 request->set_upload(request_data.upload_data); |
649 // This results in performing file IO. crbug.com/112607. | 650 // This results in performing file IO. crbug.com/112607. |
650 upload_size = request_data.upload_data->GetContentLength(); | 651 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 652 upload_size = request_data.upload_data->GetContentLengthSync(); |
651 } | 653 } |
652 | 654 |
653 // Install a CrossSiteResourceHandler if this request is coming from a | 655 // Install a CrossSiteResourceHandler if this request is coming from a |
654 // RenderViewHost with a pending cross-site request. We only check this for | 656 // RenderViewHost with a pending cross-site request. We only check this for |
655 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do | 657 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do |
656 // not count as cross-site, otherwise it gets blocked indefinitely. | 658 // not count as cross-site, otherwise it gets blocked indefinitely. |
657 if (request_data.resource_type == ResourceType::MAIN_FRAME && | 659 if (request_data.resource_type == ResourceType::MAIN_FRAME && |
658 process_type == content::PROCESS_TYPE_RENDERER && | 660 process_type == content::PROCESS_TYPE_RENDERER && |
659 CrossSiteRequestManager::GetInstance()-> | 661 CrossSiteRequestManager::GetInstance()-> |
660 HasPendingCrossSiteRequest(child_id, route_id)) { | 662 HasPendingCrossSiteRequest(child_id, route_id)) { |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 scoped_refptr<ResourceHandler> transferred_resource_handler( | 2302 scoped_refptr<ResourceHandler> transferred_resource_handler( |
2301 new DoomedResourceHandler(info->resource_handler())); | 2303 new DoomedResourceHandler(info->resource_handler())); |
2302 info->set_resource_handler(transferred_resource_handler.get()); | 2304 info->set_resource_handler(transferred_resource_handler.get()); |
2303 } | 2305 } |
2304 | 2306 |
2305 bool ResourceDispatcherHost::IsTransferredNavigation( | 2307 bool ResourceDispatcherHost::IsTransferredNavigation( |
2306 const content::GlobalRequestID& transferred_request_id) const { | 2308 const content::GlobalRequestID& transferred_request_id) const { |
2307 return transferred_navigations_.find(transferred_request_id) != | 2309 return transferred_navigations_.find(transferred_request_id) != |
2308 transferred_navigations_.end(); | 2310 transferred_navigations_.end(); |
2309 } | 2311 } |
OLD | NEW |