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

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: 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 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 // requets that have the ignore limits flag set. 1232 // requets that have the ignore limits flag set.
1233 if (is_sync_load) { 1233 if (is_sync_load) {
1234 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); 1234 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY);
1235 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1235 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1236 } else { 1236 } else {
1237 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1237 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1238 } 1238 }
1239 new_request->SetLoadFlags(load_flags); 1239 new_request->SetLoadFlags(load_flags);
1240 1240
1241 // Make extra info and read footer (contains request ID). 1241 // Make extra info and read footer (contains request ID).
1242 ResourceRequestInfoImpl* extra_info = 1242 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
1243 new ResourceRequestInfoImpl( 1243 process_type, child_id, route_id,
1244 process_type, 1244 -1, // frame_tree_node_id
1245 child_id, 1245 request_data.origin_pid,
1246 route_id, 1246 request_id,
1247 request_data.origin_pid, 1247 request_data.render_frame_id,
1248 request_id, 1248 request_data.is_main_frame,
1249 request_data.render_frame_id, 1249 request_data.parent_is_main_frame,
1250 request_data.is_main_frame, 1250 request_data.parent_render_frame_id,
1251 request_data.parent_is_main_frame, 1251 request_data.resource_type,
1252 request_data.parent_render_frame_id, 1252 request_data.transition_type,
1253 request_data.resource_type, 1253 request_data.should_replace_current_entry,
1254 request_data.transition_type, 1254 false, // is download
1255 request_data.should_replace_current_entry, 1255 false, // is stream
1256 false, // is download 1256 allow_download,
1257 false, // is stream 1257 request_data.has_user_gesture,
1258 allow_download, 1258 request_data.enable_load_timing,
1259 request_data.has_user_gesture, 1259 request_data.enable_upload_progress,
1260 request_data.enable_load_timing, 1260 do_not_prompt_for_login,
1261 request_data.enable_upload_progress, 1261 request_data.referrer_policy,
1262 do_not_prompt_for_login, 1262 request_data.visiblity_state,
1263 request_data.referrer_policy, 1263 resource_context, filter_->GetWeakPtr(),
1264 request_data.visiblity_state, 1264 !is_sync_load);
1265 resource_context,
1266 filter_->GetWeakPtr(),
1267 !is_sync_load);
1268 // Request takes ownership. 1265 // Request takes ownership.
1269 extra_info->AssociateWithRequest(new_request.get()); 1266 extra_info->AssociateWithRequest(new_request.get());
1270 1267
1271 if (new_request->url().SchemeIs(url::kBlobScheme)) { 1268 if (new_request->url().SchemeIs(url::kBlobScheme)) {
1272 // Hang on to a reference to ensure the blob is not released prior 1269 // Hang on to a reference to ensure the blob is not released prior
1273 // to the job being started. 1270 // to the job being started.
1274 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 1271 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
1275 new_request.get(), 1272 new_request.get(),
1276 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( 1273 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL(
1277 new_request->url())); 1274 new_request->url()));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 1494
1498 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( 1495 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo(
1499 int child_id, 1496 int child_id,
1500 int route_id, 1497 int route_id,
1501 bool download, 1498 bool download,
1502 ResourceContext* context) { 1499 ResourceContext* context) {
1503 return new ResourceRequestInfoImpl( 1500 return new ResourceRequestInfoImpl(
1504 PROCESS_TYPE_RENDERER, 1501 PROCESS_TYPE_RENDERER,
1505 child_id, 1502 child_id,
1506 route_id, 1503 route_id,
1504 -1, // frame_tree_node_id
1507 0, 1505 0,
1508 request_id_, 1506 request_id_,
1509 MSG_ROUTING_NONE, // render_frame_id 1507 MSG_ROUTING_NONE, // render_frame_id
1510 false, // is_main_frame 1508 false, // is_main_frame
1511 false, // parent_is_main_frame 1509 false, // parent_is_main_frame
1512 -1, // parent_render_frame_id 1510 -1, // parent_render_frame_id
1513 RESOURCE_TYPE_SUB_RESOURCE, 1511 RESOURCE_TYPE_SUB_RESOURCE,
1514 ui::PAGE_TRANSITION_LINK, 1512 ui::PAGE_TRANSITION_LINK,
1515 false, // should_replace_current_entry 1513 false, // should_replace_current_entry
1516 download, // is_download 1514 download, // is_download
1517 false, // is_stream 1515 false, // is_stream
1518 download, // allow_download 1516 download, // allow_download
1519 false, // has_user_gesture 1517 false, // has_user_gesture
1520 false, // enable_load_timing 1518 false, // enable_load_timing
1521 false, // enable_upload_progress 1519 false, // enable_upload_progress
1522 false, // do_not_prompt_for_login 1520 false, // do_not_prompt_for_login
1523 blink::WebReferrerPolicyDefault, 1521 blink::WebReferrerPolicyDefault,
1524 blink::WebPageVisibilityStateVisible, 1522 blink::WebPageVisibilityStateVisible,
1525 context, 1523 context,
1526 base::WeakPtr<ResourceMessageFilter>(), // filter 1524 base::WeakPtr<ResourceMessageFilter>(), // filter
1527 true); // is_async 1525 true); // is_async
1528 } 1526 }
1529 1527
1530 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, 1528 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
1531 int route_id, 1529 int route_id,
1532 bool is_visible, 1530 bool is_visible,
1533 bool is_audible) { 1531 bool is_audible) {
1534 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); 1532 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
1535 } 1533 }
1536 1534
1537 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( 1535 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 1938 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
1941 .get())); 1939 .get()));
1942 } 1940 }
1943 1941
1944 request_id_--; 1942 request_id_--;
1945 1943
1946 // Make extra info and read footer (contains request ID). 1944 // Make extra info and read footer (contains request ID).
1947 // 1945 //
1948 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so 1946 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so
1949 // that IO thread -> UI thread hops will work. 1947 // that IO thread -> UI thread hops will work.
1950 ResourceRequestInfoImpl* extra_info = 1948 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
1951 new ResourceRequestInfoImpl( 1949 PROCESS_TYPE_BROWSER,
1952 PROCESS_TYPE_BROWSER, 1950 -1, // child_id
1953 -1, // child_id 1951 -1, // route_id
1954 -1, // route_id 1952 info.frame_tree_node_id,
1955 -1, // request_data.origin_pid, 1953 -1, // request_data.origin_pid,
1956 request_id_, 1954 request_id_,
1957 -1, // request_data.render_frame_id, 1955 -1, // request_data.render_frame_id,
1958 info.is_main_frame, 1956 info.is_main_frame,
1959 info.parent_is_main_frame, 1957 info.parent_is_main_frame,
1960 -1, // request_data.parent_render_frame_id, 1958 -1, // request_data.parent_render_frame_id,
1961 resource_type, 1959 resource_type,
1962 info.common_params.transition, 1960 info.common_params.transition,
1963 // should_replace_current_entry. This was only maintained at layer for 1961 // should_replace_current_entry. This was only maintained at layer for
1964 // request transfers and isn't needed for browser-side navigations. 1962 // request transfers and isn't needed for browser-side navigations.
1965 false, 1963 false,
1966 false, // is download 1964 false, // is download
1967 false, // is stream 1965 false, // is stream
1968 info.common_params.allow_download, 1966 info.common_params.allow_download,
1969 info.begin_params.has_user_gesture, 1967 info.begin_params.has_user_gesture,
1970 true, // enable_load_timing 1968 true, // enable_load_timing
1971 false, // enable_upload_progress 1969 false, // enable_upload_progress
1972 false, // do_not_prompt_for_login 1970 false, // do_not_prompt_for_login
1973 info.common_params.referrer.policy, 1971 info.common_params.referrer.policy,
1974 // TODO(davidben): This is only used for prerenders. Replace 1972 // TODO(davidben): This is only used for prerenders. Replace
1975 // is_showing with something for that. Or maybe it just comes from the 1973 // is_showing with something for that. Or maybe it just comes from the
1976 // same mechanism as the cookie one. 1974 // same mechanism as the cookie one.
1977 blink::WebPageVisibilityStateVisible, 1975 blink::WebPageVisibilityStateVisible,
1978 resource_context, 1976 resource_context,
1979 base::WeakPtr<ResourceMessageFilter>(), // filter 1977 base::WeakPtr<ResourceMessageFilter>(), // filter
1980 true); 1978 true);
1981 // Request takes ownership. 1979 // Request takes ownership.
1982 extra_info->AssociateWithRequest(new_request.get()); 1980 extra_info->AssociateWithRequest(new_request.get());
1983 1981
1984 if (new_request->url().SchemeIs(url::kBlobScheme)) { 1982 if (new_request->url().SchemeIs(url::kBlobScheme)) {
1985 // Hang on to a reference to ensure the blob is not released prior 1983 // Hang on to a reference to ensure the blob is not released prior
1986 // to the job being started. 1984 // to the job being started.
1987 ChromeBlobStorageContext* blob_context = 1985 ChromeBlobStorageContext* blob_context =
1988 GetChromeBlobStorageContextForResourceContext(resource_context); 1986 GetChromeBlobStorageContextForResourceContext(resource_context);
1989 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 1987 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
1990 new_request.get(), 1988 new_request.get(),
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 2342
2345 // Add a flag to selectively bypass the data reduction proxy if the resource 2343 // Add a flag to selectively bypass the data reduction proxy if the resource
2346 // type is not an image. 2344 // type is not an image.
2347 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) 2345 if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
2348 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; 2346 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
2349 2347
2350 return load_flags; 2348 return load_flags;
2351 } 2349 }
2352 2350
2353 } // namespace content 2351 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698