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/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "content/browser/loader/upload_data_stream_builder.h" | 64 #include "content/browser/loader/upload_data_stream_builder.h" |
65 #include "content/browser/resource_context_impl.h" | 65 #include "content/browser/resource_context_impl.h" |
66 #include "content/browser/service_worker/foreign_fetch_request_handler.h" | 66 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
67 #include "content/browser/service_worker/link_header_support.h" | 67 #include "content/browser/service_worker/link_header_support.h" |
68 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 68 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
69 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" | 69 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" |
70 #include "content/browser/service_worker/service_worker_request_handler.h" | 70 #include "content/browser/service_worker/service_worker_request_handler.h" |
71 #include "content/browser/streams/stream.h" | 71 #include "content/browser/streams/stream.h" |
72 #include "content/browser/streams/stream_context.h" | 72 #include "content/browser/streams/stream_context.h" |
73 #include "content/browser/streams/stream_registry.h" | 73 #include "content/browser/streams/stream_registry.h" |
| 74 #include "content/common/net/url_request_devtools_user_data.h" |
74 #include "content/common/net/url_request_service_worker_data.h" | 75 #include "content/common/net/url_request_service_worker_data.h" |
75 #include "content/common/resource_messages.h" | 76 #include "content/common/resource_messages.h" |
76 #include "content/common/resource_request.h" | 77 #include "content/common/resource_request.h" |
77 #include "content/common/resource_request_body_impl.h" | 78 #include "content/common/resource_request_body_impl.h" |
78 #include "content/common/resource_request_completion_status.h" | 79 #include "content/common/resource_request_completion_status.h" |
79 #include "content/common/view_messages.h" | 80 #include "content/common/view_messages.h" |
80 #include "content/public/browser/browser_thread.h" | 81 #include "content/public/browser/browser_thread.h" |
81 #include "content/public/browser/global_request_id.h" | 82 #include "content/public/browser/global_request_id.h" |
82 #include "content/public/browser/navigation_ui_data.h" | 83 #include "content/public/browser/navigation_ui_data.h" |
83 #include "content/public/browser/plugin_service.h" | 84 #include "content/public/browser/plugin_service.h" |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 // Request takes ownership. | 1366 // Request takes ownership. |
1366 extra_info->AssociateWithRequest(new_request.get()); | 1367 extra_info->AssociateWithRequest(new_request.get()); |
1367 | 1368 |
1368 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 1369 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
1369 // Hang on to a reference to ensure the blob is not released prior | 1370 // Hang on to a reference to ensure the blob is not released prior |
1370 // to the job being started. | 1371 // to the job being started. |
1371 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1372 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
1372 new_request.get(), requester_info->blob_storage_context() | 1373 new_request.get(), requester_info->blob_storage_context() |
1373 ->context() | 1374 ->context() |
1374 ->GetBlobDataFromPublicURL(new_request->url())); | 1375 ->GetBlobDataFromPublicURL(new_request->url())); |
| 1376 } else if (!request_data.devtools_agent_host_id.empty()) { |
| 1377 new_request->SetUserData(URLRequestDevtoolsUserData::kUserDataKey, |
| 1378 base::MakeUnique<URLRequestDevtoolsUserData>( |
| 1379 request_data.devtools_agent_host_id, |
| 1380 request_data.devtools_request_id)); |
1375 } | 1381 } |
1376 | 1382 |
1377 // Initialize the service worker handler for the request. We don't use | 1383 // Initialize the service worker handler for the request. We don't use |
1378 // ServiceWorker for synchronous loads to avoid renderer deadlocks. | 1384 // ServiceWorker for synchronous loads to avoid renderer deadlocks. |
1379 const ServiceWorkerMode service_worker_mode = | 1385 const ServiceWorkerMode service_worker_mode = |
1380 is_sync_load ? ServiceWorkerMode::NONE : request_data.service_worker_mode; | 1386 is_sync_load ? ServiceWorkerMode::NONE : request_data.service_worker_mode; |
1381 ServiceWorkerRequestHandler::InitializeHandler( | 1387 ServiceWorkerRequestHandler::InitializeHandler( |
1382 new_request.get(), requester_info->service_worker_context(), blob_context, | 1388 new_request.get(), requester_info->service_worker_context(), blob_context, |
1383 child_id, request_data.service_worker_provider_id, | 1389 child_id, request_data.service_worker_provider_id, |
1384 service_worker_mode != ServiceWorkerMode::ALL, | 1390 service_worker_mode != ServiceWorkerMode::ALL, |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 | 2056 |
2051 // Request takes ownership. | 2057 // Request takes ownership. |
2052 extra_info->AssociateWithRequest(new_request.get()); | 2058 extra_info->AssociateWithRequest(new_request.get()); |
2053 | 2059 |
2054 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2060 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
2055 // Hang on to a reference to ensure the blob is not released prior | 2061 // Hang on to a reference to ensure the blob is not released prior |
2056 // to the job being started. | 2062 // to the job being started. |
2057 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2063 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
2058 new_request.get(), | 2064 new_request.get(), |
2059 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2065 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
| 2066 } else if (!info.devtools_agent_host_id.empty()) { |
| 2067 // Keep in sync with IdentifiersFactory::requestId. We don't necessarily |
| 2068 // know the renderer PID yet so just specify zero. |
| 2069 std::string devtools_request_id = |
| 2070 base::StringPrintf("0.%d", info.devtools_request_id); |
| 2071 new_request->SetUserData( |
| 2072 URLRequestDevtoolsUserData::kUserDataKey, |
| 2073 base::MakeUnique<URLRequestDevtoolsUserData>( |
| 2074 info.devtools_agent_host_id, devtools_request_id)); |
2060 } | 2075 } |
2061 | 2076 |
2062 RequestContextFrameType frame_type = | 2077 RequestContextFrameType frame_type = |
2063 info.is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL | 2078 info.is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL |
2064 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; | 2079 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; |
2065 ServiceWorkerRequestHandler::InitializeForNavigation( | 2080 ServiceWorkerRequestHandler::InitializeForNavigation( |
2066 new_request.get(), service_worker_handle_core, blob_context, | 2081 new_request.get(), service_worker_handle_core, blob_context, |
2067 info.begin_params.skip_service_worker, resource_type, | 2082 info.begin_params.skip_service_worker, resource_type, |
2068 info.begin_params.request_context_type, frame_type, | 2083 info.begin_params.request_context_type, frame_type, |
2069 info.are_ancestors_secure, info.common_params.post_data, | 2084 info.are_ancestors_secure, info.common_params.post_data, |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 &throttles); | 2632 &throttles); |
2618 if (!throttles.empty()) { | 2633 if (!throttles.empty()) { |
2619 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2634 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2620 std::move(throttles))); | 2635 std::move(throttles))); |
2621 } | 2636 } |
2622 } | 2637 } |
2623 return handler; | 2638 return handler; |
2624 } | 2639 } |
2625 | 2640 |
2626 } // namespace content | 2641 } // namespace content |
OLD | NEW |