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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2807163002: [Prerender] Restore request priorities when swapped in (Closed)
Patch Set: Fix test: default image priority can be LOWEST or MEDIUM Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 void ChromeResourceDispatcherHostDelegate::RequestBeginning( 436 void ChromeResourceDispatcherHostDelegate::RequestBeginning(
437 net::URLRequest* request, 437 net::URLRequest* request,
438 content::ResourceContext* resource_context, 438 content::ResourceContext* resource_context,
439 content::AppCacheService* appcache_service, 439 content::AppCacheService* appcache_service,
440 ResourceType resource_type, 440 ResourceType resource_type,
441 std::vector<std::unique_ptr<content::ResourceThrottle>>* throttles) { 441 std::vector<std::unique_ptr<content::ResourceThrottle>>* throttles) {
442 if (safe_browsing_.get()) 442 if (safe_browsing_.get())
443 safe_browsing_->OnResourceRequest(request); 443 safe_browsing_->OnResourceRequest(request);
444 444
445 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 445 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
446
447 // The lowering of request priority causes issues with scheduling, since
448 // content::ResourceScheduler uses it to delay and throttle requests. This is
449 // disabled only on Android, as the prerenders are not likely to compete with
450 // page loads there.
451 // See https://crbug.com/652746 for details.
452 // TODO(lizeb,droger): Fix the issue on all platforms.
453 #if !defined(OS_ANDROID)
454 bool is_prerendering =
455 info->GetVisibilityState() == blink::kWebPageVisibilityStatePrerender;
456 if (is_prerendering) {
457 // Requests with the IGNORE_LIMITS flag set (i.e., sync XHRs)
458 // should remain at MAXIMUM_PRIORITY.
459 if (request->load_flags() & net::LOAD_IGNORE_LIMITS) {
460 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY);
461 } else {
462 request->SetPriority(net::IDLE);
463 }
464 }
465 #endif // OS_ANDROID
466
467 ProfileIOData* io_data = ProfileIOData::FromResourceContext( 446 ProfileIOData* io_data = ProfileIOData::FromResourceContext(
468 resource_context); 447 resource_context);
469 448
470 #if defined(OS_ANDROID) 449 #if defined(OS_ANDROID)
471 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) 450 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME)
472 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); 451 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request);
473 #endif 452 #endif
474 453
475 #if defined(OS_CHROMEOS) 454 #if defined(OS_CHROMEOS)
476 // Check if we need to add merge session throttle. This throttle will postpone 455 // Check if we need to add merge session throttle. This throttle will postpone
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 912 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
934 base::Unretained(this), url, request_loading_time)); 913 base::Unretained(this), url, request_loading_time));
935 return; 914 return;
936 } 915 }
937 916
938 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 917 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
939 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 918 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
940 rappor::SampleDomainAndRegistryFromGURL( 919 rappor::SampleDomainAndRegistryFromGURL(
941 g_browser_process->rappor_service(), metric_name, url); 920 g_browser_process->rappor_service(), metric_name, url);
942 } 921 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698