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

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: move DRP parts to https://codereview.chromium.org/1363673004/ 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_lofi;
mmenke 2015/09/29 16:35:57 Maybe is_lofi -> use_lofi / using_lofi / is_using_
megjablon 2015/09/29 21:20:07 Done.
1326 if (request_data.lofi_state == LOFI_DEFAULT &&
mmenke 2015/09/29 16:35:57 I think this code makes more sense if LOFI_DEFAULT
megjablon 2015/09/29 21:20:07 Done.
1327 (load_flags & net::LOAD_MAIN_FRAME) != 0 && delegate_) {
mmenke 2015/09/29 16:35:57 I don't see why we shouldn't call into the delegat
megjablon 2015/09/29 21:20:07 Done.
1328 is_lofi = delegate_->ShouldEnableLoFiMode(new_request.get(),
1329 resource_context);
1330 } else if (request_data.lofi_state == LOFI_ON) {
1331 is_lofi = true;
1332 } else {
1333 is_lofi = false;
mmenke 2015/09/29 16:35:57 Question: Do favicons also inherit the lofi bit f
megjablon 2015/09/29 21:20:07 The proxy has logic so that icons and button image
1334 }
1335
1325 // Make extra info and read footer (contains request ID). 1336 // Make extra info and read footer (contains request ID).
1326 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( 1337 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
1327 process_type, child_id, route_id, 1338 process_type, child_id, route_id,
1328 -1, // frame_tree_node_id 1339 -1, // frame_tree_node_id
1329 request_data.origin_pid, 1340 request_data.origin_pid,
1330 request_id, 1341 request_id,
1331 request_data.render_frame_id, 1342 request_data.render_frame_id,
1332 request_data.is_main_frame, 1343 request_data.is_main_frame,
1333 request_data.parent_is_main_frame, 1344 request_data.parent_is_main_frame,
1334 request_data.parent_render_frame_id, 1345 request_data.parent_render_frame_id,
1335 request_data.resource_type, 1346 request_data.resource_type,
1336 request_data.transition_type, 1347 request_data.transition_type,
1337 request_data.should_replace_current_entry, 1348 request_data.should_replace_current_entry,
1338 false, // is download 1349 false, // is download
1339 false, // is stream 1350 false, // is stream
1340 allow_download, 1351 allow_download,
1341 request_data.has_user_gesture, 1352 request_data.has_user_gesture,
1342 request_data.enable_load_timing, 1353 request_data.enable_load_timing,
1343 request_data.enable_upload_progress, 1354 request_data.enable_upload_progress,
1344 do_not_prompt_for_login, 1355 do_not_prompt_for_login,
1345 request_data.referrer_policy, 1356 request_data.referrer_policy,
1346 request_data.visiblity_state, 1357 request_data.visiblity_state,
1347 resource_context, filter_->GetWeakPtr(), 1358 resource_context, filter_->GetWeakPtr(),
1348 report_raw_headers, 1359 report_raw_headers,
1349 !is_sync_load); 1360 !is_sync_load,
1361 is_lofi);
1350 // Request takes ownership. 1362 // Request takes ownership.
1351 extra_info->AssociateWithRequest(new_request.get()); 1363 extra_info->AssociateWithRequest(new_request.get());
1352 1364
1353 if (new_request->url().SchemeIs(url::kBlobScheme)) { 1365 if (new_request->url().SchemeIs(url::kBlobScheme)) {
1354 // Hang on to a reference to ensure the blob is not released prior 1366 // Hang on to a reference to ensure the blob is not released prior
1355 // to the job being started. 1367 // to the job being started.
1356 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 1368 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
1357 new_request.get(), 1369 new_request.get(),
1358 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( 1370 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL(
1359 new_request->url())); 1371 new_request->url()));
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 download, // allow_download 1627 download, // allow_download
1616 false, // has_user_gesture 1628 false, // has_user_gesture
1617 false, // enable_load_timing 1629 false, // enable_load_timing
1618 false, // enable_upload_progress 1630 false, // enable_upload_progress
1619 false, // do_not_prompt_for_login 1631 false, // do_not_prompt_for_login
1620 blink::WebReferrerPolicyDefault, 1632 blink::WebReferrerPolicyDefault,
1621 blink::WebPageVisibilityStateVisible, 1633 blink::WebPageVisibilityStateVisible,
1622 context, 1634 context,
1623 base::WeakPtr<ResourceMessageFilter>(), // filter 1635 base::WeakPtr<ResourceMessageFilter>(), // filter
1624 false, // report_raw_headers 1636 false, // report_raw_headers
1625 true); // is_async 1637 true, // is_async
1638 false); // is_lofi
1626 } 1639 }
1627 1640
1628 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, 1641 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
1629 int route_id, 1642 int route_id,
1630 bool is_visible, 1643 bool is_visible,
1631 bool is_audible) { 1644 bool is_audible) {
1632 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); 1645 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
1633 } 1646 }
1634 1647
1635 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( 1648 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 new_request->set_upload(UploadDataStreamBuilder::Build( 2039 new_request->set_upload(UploadDataStreamBuilder::Build(
2027 info.request_body.get(), 2040 info.request_body.get(),
2028 blob_context, 2041 blob_context,
2029 nullptr, // file_system_context 2042 nullptr, // file_system_context
2030 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 2043 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
2031 .get())); 2044 .get()));
2032 } 2045 }
2033 2046
2034 request_id_--; 2047 request_id_--;
2035 2048
2049 bool is_lofi;
2050 if (info.common_params.lofi_state == LOFI_DEFAULT && delegate_) {
2051 is_lofi = delegate_->ShouldEnableLoFiMode(new_request.get(),
2052 resource_context);
2053 } else if (info.common_params.lofi_state == LOFI_ON) {
2054 is_lofi = true;
2055 } else {
2056 is_lofi = false;
2057 }
2058
2036 // Make extra info and read footer (contains request ID). 2059 // Make extra info and read footer (contains request ID).
2037 // 2060 //
2038 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so 2061 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so
2039 // that IO thread -> UI thread hops will work. 2062 // that IO thread -> UI thread hops will work.
2040 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( 2063 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
2041 PROCESS_TYPE_BROWSER, 2064 PROCESS_TYPE_BROWSER,
2042 -1, // child_id 2065 -1, // child_id
2043 -1, // route_id 2066 -1, // route_id
2044 info.frame_tree_node_id, 2067 info.frame_tree_node_id,
2045 -1, // request_data.origin_pid, 2068 -1, // request_data.origin_pid,
(...skipping 15 matching lines...) Expand all
2061 false, // enable_upload_progress 2084 false, // enable_upload_progress
2062 false, // do_not_prompt_for_login 2085 false, // do_not_prompt_for_login
2063 info.common_params.referrer.policy, 2086 info.common_params.referrer.policy,
2064 // TODO(davidben): This is only used for prerenders. Replace 2087 // TODO(davidben): This is only used for prerenders. Replace
2065 // is_showing with something for that. Or maybe it just comes from the 2088 // is_showing with something for that. Or maybe it just comes from the
2066 // same mechanism as the cookie one. 2089 // same mechanism as the cookie one.
2067 blink::WebPageVisibilityStateVisible, 2090 blink::WebPageVisibilityStateVisible,
2068 resource_context, 2091 resource_context,
2069 base::WeakPtr<ResourceMessageFilter>(), // filter 2092 base::WeakPtr<ResourceMessageFilter>(), // filter
2070 false, // request_data.report_raw_headers 2093 false, // request_data.report_raw_headers
2071 true); 2094 true,
2095 is_lofi);
2072 // Request takes ownership. 2096 // Request takes ownership.
2073 extra_info->AssociateWithRequest(new_request.get()); 2097 extra_info->AssociateWithRequest(new_request.get());
2074 2098
2075 if (new_request->url().SchemeIs(url::kBlobScheme)) { 2099 if (new_request->url().SchemeIs(url::kBlobScheme)) {
2076 // Hang on to a reference to ensure the blob is not released prior 2100 // Hang on to a reference to ensure the blob is not released prior
2077 // to the job being started. 2101 // to the job being started.
2078 ChromeBlobStorageContext* blob_context = 2102 ChromeBlobStorageContext* blob_context =
2079 GetChromeBlobStorageContextForResourceContext(resource_context); 2103 GetChromeBlobStorageContextForResourceContext(resource_context);
2080 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 2104 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
2081 new_request.get(), 2105 new_request.get(),
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 load_flags |= net::LOAD_PREFETCH; 2441 load_flags |= net::LOAD_PREFETCH;
2418 } 2442 }
2419 2443
2420 if (is_sync_load) 2444 if (is_sync_load)
2421 load_flags |= net::LOAD_IGNORE_LIMITS; 2445 load_flags |= net::LOAD_IGNORE_LIMITS;
2422 2446
2423 return load_flags; 2447 return load_flags;
2424 } 2448 }
2425 2449
2426 } // namespace content 2450 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698