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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 #include "content/browser/loader/upload_data_stream_builder.h" | 63 #include "content/browser/loader/upload_data_stream_builder.h" |
64 #include "content/browser/resource_context_impl.h" | 64 #include "content/browser/resource_context_impl.h" |
65 #include "content/browser/service_worker/foreign_fetch_request_handler.h" | 65 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
66 #include "content/browser/service_worker/link_header_support.h" | 66 #include "content/browser/service_worker/link_header_support.h" |
67 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 67 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
68 #include "content/browser/service_worker/service_worker_navigation_handle_core.h " | 68 #include "content/browser/service_worker/service_worker_navigation_handle_core.h " |
69 #include "content/browser/service_worker/service_worker_request_handler.h" | 69 #include "content/browser/service_worker/service_worker_request_handler.h" |
70 #include "content/browser/streams/stream.h" | 70 #include "content/browser/streams/stream.h" |
71 #include "content/browser/streams/stream_context.h" | 71 #include "content/browser/streams/stream_context.h" |
72 #include "content/browser/streams/stream_registry.h" | 72 #include "content/browser/streams/stream_registry.h" |
73 #include "content/common/net/url_request_devtools_user_data.h" | |
73 #include "content/common/net/url_request_service_worker_data.h" | 74 #include "content/common/net/url_request_service_worker_data.h" |
74 #include "content/common/resource_messages.h" | 75 #include "content/common/resource_messages.h" |
75 #include "content/common/resource_request.h" | 76 #include "content/common/resource_request.h" |
76 #include "content/common/resource_request_body_impl.h" | 77 #include "content/common/resource_request_body_impl.h" |
77 #include "content/common/resource_request_completion_status.h" | 78 #include "content/common/resource_request_completion_status.h" |
78 #include "content/common/view_messages.h" | 79 #include "content/common/view_messages.h" |
79 #include "content/public/browser/browser_thread.h" | 80 #include "content/public/browser/browser_thread.h" |
80 #include "content/public/browser/global_request_id.h" | 81 #include "content/public/browser/global_request_id.h" |
81 #include "content/public/browser/navigation_ui_data.h" | 82 #include "content/public/browser/navigation_ui_data.h" |
82 #include "content/public/browser/plugin_service.h" | 83 #include "content/public/browser/plugin_service.h" |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1360 // Request takes ownership. | 1361 // Request takes ownership. |
1361 extra_info->AssociateWithRequest(new_request.get()); | 1362 extra_info->AssociateWithRequest(new_request.get()); |
1362 | 1363 |
1363 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 1364 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
1364 // Hang on to a reference to ensure the blob is not released prior | 1365 // Hang on to a reference to ensure the blob is not released prior |
1365 // to the job being started. | 1366 // to the job being started. |
1366 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1367 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
1367 new_request.get(), requester_info->blob_storage_context() | 1368 new_request.get(), requester_info->blob_storage_context() |
1368 ->context() | 1369 ->context() |
1369 ->GetBlobDataFromPublicURL(new_request->url())); | 1370 ->GetBlobDataFromPublicURL(new_request->url())); |
1371 } else if (!request_data.devtools_agent_host_id.empty()) { | |
1372 new_request->SetUserData(URLRequestDevtoolsUserData::kUserDataKey, | |
1373 base::MakeUnique<URLRequestDevtoolsUserData>( | |
1374 request_data.devtools_agent_host_id, | |
1375 request_data.devtools_request_id)); | |
1370 } | 1376 } |
1371 | 1377 |
1372 // Initialize the service worker handler for the request. We don't use | 1378 // Initialize the service worker handler for the request. We don't use |
1373 // ServiceWorker for synchronous loads to avoid renderer deadlocks. | 1379 // ServiceWorker for synchronous loads to avoid renderer deadlocks. |
1374 const ServiceWorkerMode service_worker_mode = | 1380 const ServiceWorkerMode service_worker_mode = |
1375 is_sync_load ? ServiceWorkerMode::NONE : request_data.service_worker_mode; | 1381 is_sync_load ? ServiceWorkerMode::NONE : request_data.service_worker_mode; |
1376 ServiceWorkerRequestHandler::InitializeHandler( | 1382 ServiceWorkerRequestHandler::InitializeHandler( |
1377 new_request.get(), requester_info->service_worker_context(), blob_context, | 1383 new_request.get(), requester_info->service_worker_context(), blob_context, |
1378 child_id, request_data.service_worker_provider_id, | 1384 child_id, request_data.service_worker_provider_id, |
1379 service_worker_mode != ServiceWorkerMode::ALL, | 1385 service_worker_mode != ServiceWorkerMode::ALL, |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2045 | 2051 |
2046 // Request takes ownership. | 2052 // Request takes ownership. |
2047 extra_info->AssociateWithRequest(new_request.get()); | 2053 extra_info->AssociateWithRequest(new_request.get()); |
2048 | 2054 |
2049 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2055 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
2050 // Hang on to a reference to ensure the blob is not released prior | 2056 // Hang on to a reference to ensure the blob is not released prior |
2051 // to the job being started. | 2057 // to the job being started. |
2052 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2058 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
2053 new_request.get(), | 2059 new_request.get(), |
2054 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2060 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
2061 } else if (!info.devtools_agent_host_id.empty()) { | |
2062 // Keep in sync with IdentifiersFactory::requestId. We don't necessarily | |
2063 // know the browser PID yet so just specify zero. | |
Sami
2017/03/29 16:41:42
Do you mean the renderer pid?
alex clarke (OOO till 29th)
2017/03/30 16:56:55
Done.
| |
2064 std::string devtools_request_id = | |
2065 base::StringPrintf("0.%u\n", info.devtools_request_id); | |
2066 new_request->SetUserData( | |
2067 URLRequestDevtoolsUserData::kUserDataKey, | |
2068 base::MakeUnique<URLRequestDevtoolsUserData>( | |
2069 info.devtools_agent_host_id, devtools_request_id)); | |
2055 } | 2070 } |
2056 | 2071 |
2057 RequestContextFrameType frame_type = | 2072 RequestContextFrameType frame_type = |
2058 info.is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL | 2073 info.is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL |
2059 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; | 2074 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; |
2060 ServiceWorkerRequestHandler::InitializeForNavigation( | 2075 ServiceWorkerRequestHandler::InitializeForNavigation( |
2061 new_request.get(), service_worker_handle_core, blob_context, | 2076 new_request.get(), service_worker_handle_core, blob_context, |
2062 info.begin_params.skip_service_worker, resource_type, | 2077 info.begin_params.skip_service_worker, resource_type, |
2063 info.begin_params.request_context_type, frame_type, | 2078 info.begin_params.request_context_type, frame_type, |
2064 info.are_ancestors_secure, info.common_params.post_data, | 2079 info.are_ancestors_secure, info.common_params.post_data, |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 &throttles); | 2628 &throttles); |
2614 if (!throttles.empty()) { | 2629 if (!throttles.empty()) { |
2615 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2630 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2616 std::move(throttles))); | 2631 std::move(throttles))); |
2617 } | 2632 } |
2618 } | 2633 } |
2619 return handler; | 2634 return handler; |
2620 } | 2635 } |
2621 | 2636 |
2622 } // namespace content | 2637 } // namespace content |
OLD | NEW |