Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1079163008: PlzNavigate: provide the FrameTreeNode ID to the network stack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-unittests
Patch Set: Rebase + addressed Nasko's comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 // requets that have the ignore limits flag set. 1262 // requets that have the ignore limits flag set.
1263 if (is_sync_load) { 1263 if (is_sync_load) {
1264 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); 1264 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY);
1265 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1265 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1266 } else { 1266 } else {
1267 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1267 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1268 } 1268 }
1269 new_request->SetLoadFlags(load_flags); 1269 new_request->SetLoadFlags(load_flags);
1270 1270
1271 // Make extra info and read footer (contains request ID). 1271 // Make extra info and read footer (contains request ID).
1272 ResourceRequestInfoImpl* extra_info = 1272 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
1273 new ResourceRequestInfoImpl( 1273 process_type, child_id, route_id,
1274 process_type, 1274 -1, // frame_tree_node_id
1275 child_id, 1275 request_data.origin_pid,
1276 route_id, 1276 request_id,
1277 request_data.origin_pid, 1277 request_data.render_frame_id,
1278 request_id, 1278 request_data.is_main_frame,
1279 request_data.render_frame_id, 1279 request_data.parent_is_main_frame,
1280 request_data.is_main_frame, 1280 request_data.parent_render_frame_id,
1281 request_data.parent_is_main_frame, 1281 request_data.resource_type,
1282 request_data.parent_render_frame_id, 1282 request_data.transition_type,
1283 request_data.resource_type, 1283 request_data.should_replace_current_entry,
1284 request_data.transition_type, 1284 false, // is download
1285 request_data.should_replace_current_entry, 1285 false, // is stream
1286 false, // is download 1286 allow_download,
1287 false, // is stream 1287 request_data.has_user_gesture,
1288 allow_download, 1288 request_data.enable_load_timing,
1289 request_data.has_user_gesture, 1289 request_data.enable_upload_progress,
1290 request_data.enable_load_timing, 1290 do_not_prompt_for_login,
1291 request_data.enable_upload_progress, 1291 request_data.referrer_policy,
1292 do_not_prompt_for_login, 1292 request_data.visiblity_state,
1293 request_data.referrer_policy, 1293 resource_context, filter_->GetWeakPtr(),
1294 request_data.visiblity_state, 1294 !is_sync_load);
1295 resource_context,
1296 filter_->GetWeakPtr(),
1297 !is_sync_load);
1298 // Request takes ownership. 1295 // Request takes ownership.
1299 extra_info->AssociateWithRequest(new_request.get()); 1296 extra_info->AssociateWithRequest(new_request.get());
1300 1297
1301 if (new_request->url().SchemeIs(url::kBlobScheme)) { 1298 if (new_request->url().SchemeIs(url::kBlobScheme)) {
1302 // Hang on to a reference to ensure the blob is not released prior 1299 // Hang on to a reference to ensure the blob is not released prior
1303 // to the job being started. 1300 // to the job being started.
1304 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 1301 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
1305 new_request.get(), 1302 new_request.get(),
1306 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( 1303 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL(
1307 new_request->url())); 1304 new_request->url()));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 1524
1528 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( 1525 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo(
1529 int child_id, 1526 int child_id,
1530 int route_id, 1527 int route_id,
1531 bool download, 1528 bool download,
1532 ResourceContext* context) { 1529 ResourceContext* context) {
1533 return new ResourceRequestInfoImpl( 1530 return new ResourceRequestInfoImpl(
1534 PROCESS_TYPE_RENDERER, 1531 PROCESS_TYPE_RENDERER,
1535 child_id, 1532 child_id,
1536 route_id, 1533 route_id,
1534 -1, // frame_tree_node_id
1537 0, 1535 0,
1538 request_id_, 1536 request_id_,
1539 MSG_ROUTING_NONE, // render_frame_id 1537 MSG_ROUTING_NONE, // render_frame_id
1540 false, // is_main_frame 1538 false, // is_main_frame
1541 false, // parent_is_main_frame 1539 false, // parent_is_main_frame
1542 -1, // parent_render_frame_id 1540 -1, // parent_render_frame_id
1543 RESOURCE_TYPE_SUB_RESOURCE, 1541 RESOURCE_TYPE_SUB_RESOURCE,
1544 ui::PAGE_TRANSITION_LINK, 1542 ui::PAGE_TRANSITION_LINK,
1545 false, // should_replace_current_entry 1543 false, // should_replace_current_entry
1546 download, // is_download 1544 download, // is_download
1547 false, // is_stream 1545 false, // is_stream
1548 download, // allow_download 1546 download, // allow_download
1549 false, // has_user_gesture 1547 false, // has_user_gesture
1550 false, // enable_load_timing 1548 false, // enable_load_timing
1551 false, // enable_upload_progress 1549 false, // enable_upload_progress
1552 false, // do_not_prompt_for_login 1550 false, // do_not_prompt_for_login
1553 blink::WebReferrerPolicyDefault, 1551 blink::WebReferrerPolicyDefault,
1554 blink::WebPageVisibilityStateVisible, 1552 blink::WebPageVisibilityStateVisible,
1555 context, 1553 context,
1556 base::WeakPtr<ResourceMessageFilter>(), // filter 1554 base::WeakPtr<ResourceMessageFilter>(), // filter
1557 true); // is_async 1555 true); // is_async
1558 } 1556 }
1559 1557
1560 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, 1558 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
1561 int route_id, 1559 int route_id,
1562 bool is_visible, 1560 bool is_visible,
1563 bool is_audible) { 1561 bool is_audible) {
1564 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); 1562 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
1565 } 1563 }
1566 1564
1567 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( 1565 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 1965 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
1968 .get())); 1966 .get()));
1969 } 1967 }
1970 1968
1971 request_id_--; 1969 request_id_--;
1972 1970
1973 // Make extra info and read footer (contains request ID). 1971 // Make extra info and read footer (contains request ID).
1974 // 1972 //
1975 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so 1973 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so
1976 // that IO thread -> UI thread hops will work. 1974 // that IO thread -> UI thread hops will work.
1977 ResourceRequestInfoImpl* extra_info = 1975 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
1978 new ResourceRequestInfoImpl( 1976 PROCESS_TYPE_BROWSER,
1979 PROCESS_TYPE_BROWSER, 1977 -1, // child_id
1980 -1, // child_id 1978 -1, // route_id
1981 -1, // route_id 1979 info.frame_tree_node_id,
1982 -1, // request_data.origin_pid, 1980 -1, // request_data.origin_pid,
1983 request_id_, 1981 request_id_,
1984 -1, // request_data.render_frame_id, 1982 -1, // request_data.render_frame_id,
1985 info.is_main_frame, 1983 info.is_main_frame,
1986 info.parent_is_main_frame, 1984 info.parent_is_main_frame,
1987 -1, // request_data.parent_render_frame_id, 1985 -1, // request_data.parent_render_frame_id,
1988 resource_type, 1986 resource_type,
1989 info.common_params.transition, 1987 info.common_params.transition,
1990 // should_replace_current_entry. This was only maintained at layer for 1988 // should_replace_current_entry. This was only maintained at layer for
1991 // request transfers and isn't needed for browser-side navigations. 1989 // request transfers and isn't needed for browser-side navigations.
1992 false, 1990 false,
1993 false, // is download 1991 false, // is download
1994 false, // is stream 1992 false, // is stream
1995 info.common_params.allow_download, 1993 info.common_params.allow_download,
1996 info.begin_params.has_user_gesture, 1994 info.begin_params.has_user_gesture,
1997 true, // enable_load_timing 1995 true, // enable_load_timing
1998 false, // enable_upload_progress 1996 false, // enable_upload_progress
1999 false, // do_not_prompt_for_login 1997 false, // do_not_prompt_for_login
2000 info.common_params.referrer.policy, 1998 info.common_params.referrer.policy,
2001 // TODO(davidben): This is only used for prerenders. Replace 1999 // TODO(davidben): This is only used for prerenders. Replace
2002 // is_showing with something for that. Or maybe it just comes from the 2000 // is_showing with something for that. Or maybe it just comes from the
2003 // same mechanism as the cookie one. 2001 // same mechanism as the cookie one.
2004 blink::WebPageVisibilityStateVisible, 2002 blink::WebPageVisibilityStateVisible,
2005 resource_context, 2003 resource_context,
2006 base::WeakPtr<ResourceMessageFilter>(), // filter 2004 base::WeakPtr<ResourceMessageFilter>(), // filter
2007 true); 2005 true);
2008 // Request takes ownership. 2006 // Request takes ownership.
2009 extra_info->AssociateWithRequest(new_request.get()); 2007 extra_info->AssociateWithRequest(new_request.get());
2010 2008
2011 if (new_request->url().SchemeIs(url::kBlobScheme)) { 2009 if (new_request->url().SchemeIs(url::kBlobScheme)) {
2012 // Hang on to a reference to ensure the blob is not released prior 2010 // Hang on to a reference to ensure the blob is not released prior
2013 // to the job being started. 2011 // to the job being started.
2014 ChromeBlobStorageContext* blob_context = 2012 ChromeBlobStorageContext* blob_context =
2015 GetChromeBlobStorageContextForResourceContext(resource_context); 2013 GetChromeBlobStorageContextForResourceContext(resource_context);
2016 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 2014 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
2017 new_request.get(), 2015 new_request.get(),
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 2363
2366 // Add a flag to selectively bypass the data reduction proxy if the resource 2364 // Add a flag to selectively bypass the data reduction proxy if the resource
2367 // type is not an image. 2365 // type is not an image.
2368 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) 2366 if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
2369 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; 2367 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
2370 2368
2371 return load_flags; 2369 return load_flags;
2372 } 2370 }
2373 2371
2374 } // namespace content 2372 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_unittest.cc ('k') | content/browser/loader/resource_request_info_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698