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

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

Issue 1310743003: Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke comments Created 5 years, 2 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 // Sync loads should have maximum priority and should be the only 1315 // Sync loads should have maximum priority and should be the only
1316 // requets that have the ignore limits flag set. 1316 // requets that have the ignore limits flag set.
1317 if (is_sync_load) { 1317 if (is_sync_load) {
1318 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); 1318 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY);
1319 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1319 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1320 } else { 1320 } else {
1321 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1321 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1322 } 1322 }
1323 new_request->SetLoadFlags(load_flags); 1323 new_request->SetLoadFlags(load_flags);
1324 1324
1325 bool is_using_lofi;
1326 if (request_data.lofi_state == LOFI_UNSPECIFIED && delegate_) {
1327 is_using_lofi =
1328 delegate_->ShouldEnableLoFiMode(new_request.get(), resource_context);
1329 } else if (request_data.lofi_state == LOFI_ON) {
1330 is_using_lofi = true;
1331 } else {
1332 is_using_lofi = false;
1333 }
1334
1325 // Make extra info and read footer (contains request ID). 1335 // Make extra info and read footer (contains request ID).
1326 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( 1336 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
1327 process_type, child_id, route_id, 1337 process_type, child_id, route_id,
1328 -1, // frame_tree_node_id 1338 -1, // frame_tree_node_id
1329 request_data.origin_pid, 1339 request_data.origin_pid,
1330 request_id, 1340 request_id,
1331 request_data.render_frame_id, 1341 request_data.render_frame_id,
1332 request_data.is_main_frame, 1342 request_data.is_main_frame,
1333 request_data.parent_is_main_frame, 1343 request_data.parent_is_main_frame,
1334 request_data.parent_render_frame_id, 1344 request_data.parent_render_frame_id,
1335 request_data.resource_type, 1345 request_data.resource_type,
1336 request_data.transition_type, 1346 request_data.transition_type,
1337 request_data.should_replace_current_entry, 1347 request_data.should_replace_current_entry,
1338 false, // is download 1348 false, // is download
1339 false, // is stream 1349 false, // is stream
1340 allow_download, 1350 allow_download,
1341 request_data.has_user_gesture, 1351 request_data.has_user_gesture,
1342 request_data.enable_load_timing, 1352 request_data.enable_load_timing,
1343 request_data.enable_upload_progress, 1353 request_data.enable_upload_progress,
1344 do_not_prompt_for_login, 1354 do_not_prompt_for_login,
1345 request_data.referrer_policy, 1355 request_data.referrer_policy,
1346 request_data.visiblity_state, 1356 request_data.visiblity_state,
1347 resource_context, filter_->GetWeakPtr(), 1357 resource_context, filter_->GetWeakPtr(),
1348 report_raw_headers, 1358 report_raw_headers,
1349 !is_sync_load); 1359 !is_sync_load,
1360 is_using_lofi);
1350 // Request takes ownership. 1361 // Request takes ownership.
1351 extra_info->AssociateWithRequest(new_request.get()); 1362 extra_info->AssociateWithRequest(new_request.get());
1352 1363
1353 if (new_request->url().SchemeIs(url::kBlobScheme)) { 1364 if (new_request->url().SchemeIs(url::kBlobScheme)) {
1354 // 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
1355 // to the job being started. 1366 // to the job being started.
1356 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 1367 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
1357 new_request.get(), 1368 new_request.get(),
1358 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( 1369 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL(
1359 new_request->url())); 1370 new_request->url()));
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 download, // allow_download 1636 download, // allow_download
1626 false, // has_user_gesture 1637 false, // has_user_gesture
1627 false, // enable_load_timing 1638 false, // enable_load_timing
1628 false, // enable_upload_progress 1639 false, // enable_upload_progress
1629 false, // do_not_prompt_for_login 1640 false, // do_not_prompt_for_login
1630 blink::WebReferrerPolicyDefault, 1641 blink::WebReferrerPolicyDefault,
1631 blink::WebPageVisibilityStateVisible, 1642 blink::WebPageVisibilityStateVisible,
1632 context, 1643 context,
1633 base::WeakPtr<ResourceMessageFilter>(), // filter 1644 base::WeakPtr<ResourceMessageFilter>(), // filter
1634 false, // report_raw_headers 1645 false, // report_raw_headers
1635 true); // is_async 1646 true, // is_async
1647 false); // is_using_lofi
1636 } 1648 }
1637 1649
1638 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, 1650 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
1639 int route_id, 1651 int route_id,
1640 bool is_visible, 1652 bool is_visible,
1641 bool is_audible) { 1653 bool is_audible) {
1642 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); 1654 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
1643 } 1655 }
1644 1656
1645 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( 1657 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 new_request->set_upload(UploadDataStreamBuilder::Build( 2048 new_request->set_upload(UploadDataStreamBuilder::Build(
2037 info.request_body.get(), 2049 info.request_body.get(),
2038 blob_context, 2050 blob_context,
2039 nullptr, // file_system_context 2051 nullptr, // file_system_context
2040 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 2052 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
2041 .get())); 2053 .get()));
2042 } 2054 }
2043 2055
2044 request_id_--; 2056 request_id_--;
2045 2057
2058 bool is_using_lofi;
2059 if (info.common_params.lofi_state == LOFI_UNSPECIFIED && delegate_) {
2060 is_using_lofi =
2061 delegate_->ShouldEnableLoFiMode(new_request.get(), resource_context);
2062 } else if (info.common_params.lofi_state == LOFI_ON) {
2063 is_using_lofi = true;
2064 } else {
2065 is_using_lofi = false;
2066 }
2067
2046 // Make extra info and read footer (contains request ID). 2068 // Make extra info and read footer (contains request ID).
2047 // 2069 //
2048 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so 2070 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so
2049 // that IO thread -> UI thread hops will work. 2071 // that IO thread -> UI thread hops will work.
2050 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( 2072 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
2051 PROCESS_TYPE_BROWSER, 2073 PROCESS_TYPE_BROWSER,
2052 -1, // child_id 2074 -1, // child_id
2053 -1, // route_id 2075 -1, // route_id
2054 info.frame_tree_node_id, 2076 info.frame_tree_node_id,
2055 -1, // request_data.origin_pid, 2077 -1, // request_data.origin_pid,
(...skipping 15 matching lines...) Expand all
2071 false, // enable_upload_progress 2093 false, // enable_upload_progress
2072 false, // do_not_prompt_for_login 2094 false, // do_not_prompt_for_login
2073 info.common_params.referrer.policy, 2095 info.common_params.referrer.policy,
2074 // TODO(davidben): This is only used for prerenders. Replace 2096 // TODO(davidben): This is only used for prerenders. Replace
2075 // is_showing with something for that. Or maybe it just comes from the 2097 // is_showing with something for that. Or maybe it just comes from the
2076 // same mechanism as the cookie one. 2098 // same mechanism as the cookie one.
2077 blink::WebPageVisibilityStateVisible, 2099 blink::WebPageVisibilityStateVisible,
2078 resource_context, 2100 resource_context,
2079 base::WeakPtr<ResourceMessageFilter>(), // filter 2101 base::WeakPtr<ResourceMessageFilter>(), // filter
2080 false, // request_data.report_raw_headers 2102 false, // request_data.report_raw_headers
2081 true); 2103 true,
2104 is_using_lofi);
2082 // Request takes ownership. 2105 // Request takes ownership.
2083 extra_info->AssociateWithRequest(new_request.get()); 2106 extra_info->AssociateWithRequest(new_request.get());
2084 2107
2085 if (new_request->url().SchemeIs(url::kBlobScheme)) { 2108 if (new_request->url().SchemeIs(url::kBlobScheme)) {
2086 // Hang on to a reference to ensure the blob is not released prior 2109 // Hang on to a reference to ensure the blob is not released prior
2087 // to the job being started. 2110 // to the job being started.
2088 ChromeBlobStorageContext* blob_context = 2111 ChromeBlobStorageContext* blob_context =
2089 GetChromeBlobStorageContextForResourceContext(resource_context); 2112 GetChromeBlobStorageContextForResourceContext(resource_context);
2090 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 2113 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
2091 new_request.get(), 2114 new_request.get(),
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 load_flags |= net::LOAD_PREFETCH; 2450 load_flags |= net::LOAD_PREFETCH;
2428 } 2451 }
2429 2452
2430 if (is_sync_load) 2453 if (is_sync_load)
2431 load_flags |= net::LOAD_IGNORE_LIMITS; 2454 load_flags |= net::LOAD_IGNORE_LIMITS;
2432 2455
2433 return load_flags; 2456 return load_flags;
2434 } 2457 }
2435 2458
2436 } // namespace content 2459 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698