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 <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "chrome/browser/cert_store.h" | 18 #include "chrome/browser/cert_store.h" |
19 #include "chrome/browser/child_process_security_policy.h" | 19 #include "chrome/browser/child_process_security_policy.h" |
| 20 #include "chrome/browser/chrome_blob_storage_context.h" |
20 #include "chrome/browser/cross_site_request_manager.h" | 21 #include "chrome/browser/cross_site_request_manager.h" |
21 #include "chrome/browser/download/download_file_manager.h" | 22 #include "chrome/browser/download/download_file_manager.h" |
22 #include "chrome/browser/download/download_manager.h" | 23 #include "chrome/browser/download/download_manager.h" |
23 #include "chrome/browser/download/download_request_limiter.h" | 24 #include "chrome/browser/download/download_request_limiter.h" |
24 #include "chrome/browser/download/save_file_manager.h" | 25 #include "chrome/browser/download/save_file_manager.h" |
25 #include "chrome/browser/extensions/user_script_listener.h" | 26 #include "chrome/browser/extensions/user_script_listener.h" |
26 #include "chrome/browser/external_protocol_handler.h" | 27 #include "chrome/browser/external_protocol_handler.h" |
27 #include "chrome/browser/in_process_webkit/webkit_thread.h" | 28 #include "chrome/browser/in_process_webkit/webkit_thread.h" |
28 #include "chrome/browser/login_prompt.h" | 29 #include "chrome/browser/login_prompt.h" |
29 #include "chrome/browser/net/chrome_url_request_context.h" | 30 #include "chrome/browser/net/chrome_url_request_context.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "net/base/mime_util.h" | 62 #include "net/base/mime_util.h" |
62 #include "net/base/net_errors.h" | 63 #include "net/base/net_errors.h" |
63 #include "net/base/request_priority.h" | 64 #include "net/base/request_priority.h" |
64 #include "net/base/ssl_cert_request_info.h" | 65 #include "net/base/ssl_cert_request_info.h" |
65 #include "net/base/upload_data.h" | 66 #include "net/base/upload_data.h" |
66 #include "net/http/http_response_headers.h" | 67 #include "net/http/http_response_headers.h" |
67 #include "net/url_request/url_request.h" | 68 #include "net/url_request/url_request.h" |
68 #include "net/url_request/url_request_context.h" | 69 #include "net/url_request/url_request_context.h" |
69 #include "webkit/appcache/appcache_interceptor.h" | 70 #include "webkit/appcache/appcache_interceptor.h" |
70 #include "webkit/appcache/appcache_interfaces.h" | 71 #include "webkit/appcache/appcache_interfaces.h" |
| 72 #include "webkit/blob/blob_storage_controller.h" |
71 | 73 |
72 // TODO(oshima): Enable this for other platforms. | 74 // TODO(oshima): Enable this for other platforms. |
73 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
74 #include "chrome/browser/renderer_host/offline_resource_handler.h" | 76 #include "chrome/browser/renderer_host/offline_resource_handler.h" |
75 #endif | 77 #endif |
76 | 78 |
77 // Uncomment to enable logging of request traffic. | 79 // Uncomment to enable logging of request traffic. |
78 // #define LOG_RESOURCE_DISPATCHER_REQUESTS | 80 // #define LOG_RESOURCE_DISPATCHER_REQUESTS |
79 | 81 |
80 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS | 82 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 receiver_->GetRequestContext(request_id, request_data)); | 366 receiver_->GetRequestContext(request_id, request_data)); |
365 if (!context) { | 367 if (!context) { |
366 URLRequestContextGetter* context_getter = | 368 URLRequestContextGetter* context_getter = |
367 Profile::GetDefaultRequestContext(); | 369 Profile::GetDefaultRequestContext(); |
368 if (context_getter) { | 370 if (context_getter) { |
369 context = static_cast<ChromeURLRequestContext*>( | 371 context = static_cast<ChromeURLRequestContext*>( |
370 context_getter->GetURLRequestContext()); | 372 context_getter->GetURLRequestContext()); |
371 } | 373 } |
372 } | 374 } |
373 | 375 |
| 376 // Might need to resolve the blob references in the upload data. |
| 377 if (request_data.upload_data) { |
| 378 context->blob_storage_context()->controller()-> |
| 379 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); |
| 380 } |
| 381 |
374 if (is_shutdown_ || | 382 if (is_shutdown_ || |
375 !ShouldServiceRequest(process_type, child_id, request_data)) { | 383 !ShouldServiceRequest(process_type, child_id, request_data)) { |
376 URLRequestStatus status(URLRequestStatus::FAILED, net::ERR_ABORTED); | 384 URLRequestStatus status(URLRequestStatus::FAILED, net::ERR_ABORTED); |
377 if (sync_result) { | 385 if (sync_result) { |
378 SyncLoadResult result; | 386 SyncLoadResult result; |
379 result.status = status; | 387 result.status = status; |
380 ViewHostMsg_SyncLoad::WriteReplyParams(sync_result, result); | 388 ViewHostMsg_SyncLoad::WriteReplyParams(sync_result, result); |
381 receiver_->Send(sync_result); | 389 receiver_->Send(sync_result); |
382 } else { | 390 } else { |
383 // Tell the renderer that this request was disallowed. | 391 // Tell the renderer that this request was disallowed. |
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 return is_prefetch_enabled_; | 1876 return is_prefetch_enabled_; |
1869 } | 1877 } |
1870 | 1878 |
1871 // static | 1879 // static |
1872 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1880 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1873 is_prefetch_enabled_ = value; | 1881 is_prefetch_enabled_ = value; |
1874 } | 1882 } |
1875 | 1883 |
1876 // static | 1884 // static |
1877 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1885 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |