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 1264 matching lines...) Loading... | |
1275 if (IsRequestIDInUse(GlobalRequestID(child_id, request_id))) { | 1275 if (IsRequestIDInUse(GlobalRequestID(child_id, request_id))) { |
1276 bad_message::ReceivedBadMessage(filter_, | 1276 bad_message::ReceivedBadMessage(filter_, |
1277 bad_message::RDH_INVALID_REQUEST_ID); | 1277 bad_message::RDH_INVALID_REQUEST_ID); |
1278 return; | 1278 return; |
1279 } | 1279 } |
1280 | 1280 |
1281 // PlzNavigate: reject invalid renderer main resource request. | 1281 // PlzNavigate: reject invalid renderer main resource request. |
1282 bool is_navigation_stream_request = | 1282 bool is_navigation_stream_request = |
1283 IsBrowserSideNavigationEnabled() && | 1283 IsBrowserSideNavigationEnabled() && |
1284 IsResourceTypeFrame(request_data.resource_type); | 1284 IsResourceTypeFrame(request_data.resource_type); |
1285 if (is_navigation_stream_request && | 1285 if ((process_type == PROCESS_TYPE_RENDERER) && is_navigation_stream_request |
clamy
2016/08/25 22:17:55
Could you add a comment explaining that this is du
ananta
2016/08/25 22:49:15
Done.
| |
1286 !request_data.resource_body_stream_url.SchemeIs(url::kBlobScheme)) { | 1286 && !request_data.resource_body_stream_url.SchemeIs(url::kBlobScheme)) { |
1287 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_URL); | 1287 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_URL); |
1288 return; | 1288 return; |
1289 } | 1289 } |
1290 | 1290 |
1291 // Reject invalid priority. | 1291 // Reject invalid priority. |
1292 if (request_data.priority < net::MINIMUM_PRIORITY || | 1292 if (request_data.priority < net::MINIMUM_PRIORITY || |
1293 request_data.priority > net::MAXIMUM_PRIORITY) { | 1293 request_data.priority > net::MAXIMUM_PRIORITY) { |
1294 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_PRIORITY); | 1294 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_PRIORITY); |
1295 return; | 1295 return; |
1296 } | 1296 } |
(...skipping 94 matching lines...) Loading... | |
1391 AbortRequestBeforeItStarts(filter_, sync_result, request_id, | 1391 AbortRequestBeforeItStarts(filter_, sync_result, request_id, |
1392 std::move(url_loader_client)); | 1392 std::move(url_loader_client)); |
1393 return; | 1393 return; |
1394 } | 1394 } |
1395 | 1395 |
1396 int process_type = filter_->process_type(); | 1396 int process_type = filter_->process_type(); |
1397 int child_id = filter_->child_id(); | 1397 int child_id = filter_->child_id(); |
1398 | 1398 |
1399 bool is_navigation_stream_request = | 1399 bool is_navigation_stream_request = |
1400 IsBrowserSideNavigationEnabled() && | 1400 IsBrowserSideNavigationEnabled() && |
1401 IsResourceTypeFrame(request_data.resource_type); | 1401 IsResourceTypeFrame(request_data.resource_type) && |
1402 process_type == PROCESS_TYPE_RENDERER; | |
1402 | 1403 |
1403 ResourceContext* resource_context = NULL; | 1404 ResourceContext* resource_context = NULL; |
1404 net::URLRequestContext* request_context = NULL; | 1405 net::URLRequestContext* request_context = NULL; |
1405 filter_->GetContexts(request_data.resource_type, &resource_context, | 1406 filter_->GetContexts(request_data.resource_type, &resource_context, |
1406 &request_context); | 1407 &request_context); |
1407 | 1408 |
1408 // Allow the observer to block/handle the request. | 1409 // Allow the observer to block/handle the request. |
1409 if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method, | 1410 if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method, |
1410 request_data.url, | 1411 request_data.url, |
1411 request_data.resource_type, | 1412 request_data.resource_type, |
(...skipping 268 matching lines...) Loading... | |
1680 ResourceType resource_type, | 1681 ResourceType resource_type, |
1681 ResourceContext* resource_context, | 1682 ResourceContext* resource_context, |
1682 RequestContextType fetch_request_context_type, | 1683 RequestContextType fetch_request_context_type, |
1683 AppCacheService* appcache_service, | 1684 AppCacheService* appcache_service, |
1684 int child_id, | 1685 int child_id, |
1685 int route_id, | 1686 int route_id, |
1686 std::unique_ptr<ResourceHandler> handler) { | 1687 std::unique_ptr<ResourceHandler> handler) { |
1687 // PlzNavigate: do not add ResourceThrottles for main resource requests from | 1688 // PlzNavigate: do not add ResourceThrottles for main resource requests from |
1688 // the renderer. Decisions about the navigation should have been done in the | 1689 // the renderer. Decisions about the navigation should have been done in the |
1689 // initial request. | 1690 // initial request. |
1690 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && | 1691 if ((filter_->process_type() == PROCESS_TYPE_RENDERER) && |
1692 IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && | |
1691 child_id != -1) { | 1693 child_id != -1) { |
1692 DCHECK(request->url().SchemeIs(url::kBlobScheme)); | 1694 DCHECK(request->url().SchemeIs(url::kBlobScheme)); |
1693 return handler; | 1695 return handler; |
1694 } | 1696 } |
1695 | 1697 |
1696 PluginService* plugin_service = nullptr; | 1698 PluginService* plugin_service = nullptr; |
1697 #if defined(ENABLE_PLUGINS) | 1699 #if defined(ENABLE_PLUGINS) |
1698 plugin_service = PluginService::GetInstance(); | 1700 plugin_service = PluginService::GetInstance(); |
1699 #endif | 1701 #endif |
1700 // Insert a buffered event handler before the actual one. | 1702 // Insert a buffered event handler before the actual one. |
(...skipping 1018 matching lines...) Loading... | |
2719 << iter->filesystem_url().spec(); | 2721 << iter->filesystem_url().spec(); |
2720 return false; | 2722 return false; |
2721 } | 2723 } |
2722 } | 2724 } |
2723 } | 2725 } |
2724 } | 2726 } |
2725 return true; | 2727 return true; |
2726 } | 2728 } |
2727 | 2729 |
2728 } // namespace content | 2730 } // namespace content |
OLD | NEW |