Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 | 414 |
| 415 void ChromeResourceDispatcherHostDelegate::RequestBeginning( | 415 void ChromeResourceDispatcherHostDelegate::RequestBeginning( |
| 416 net::URLRequest* request, | 416 net::URLRequest* request, |
| 417 content::ResourceContext* resource_context, | 417 content::ResourceContext* resource_context, |
| 418 content::AppCacheService* appcache_service, | 418 content::AppCacheService* appcache_service, |
| 419 ResourceType resource_type, | 419 ResourceType resource_type, |
| 420 ScopedVector<content::ResourceThrottle>* throttles) { | 420 ScopedVector<content::ResourceThrottle>* throttles) { |
| 421 if (safe_browsing_.get()) | 421 if (safe_browsing_.get()) |
| 422 safe_browsing_->OnResourceRequest(request); | 422 safe_browsing_->OnResourceRequest(request); |
| 423 | 423 |
| 424 // The lowering of request priority causes issues with scheduling, since | |
| 425 // content::ResourceScheduler uses it to delay and throttle requests. This is | |
| 426 // disabled only on Android, as the prerenders are not likely to compete wuth | |
|
droger
2016/10/07 09:08:23
s/wuth/with/
Benoit L
2016/10/07 09:27:35
Done.
| |
| 427 // page loads there. | |
| 428 // See https://crbug.com/652746 for details. | |
| 429 // TODO(lizeb,droger): Remove this hack, and fix the issue on all platforms. | |
|
droger
2016/10/07 09:08:23
Nit:
We're not quite sure that this is really a h
Benoit L
2016/10/07 09:27:35
Done.
| |
| 430 #if !defined(OS_ANDROID) | |
| 424 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 431 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 425 bool is_prerendering = | 432 bool is_prerendering = |
| 426 info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender; | 433 info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender; |
| 427 if (is_prerendering) { | 434 if (is_prerendering) { |
| 428 // Requests with the IGNORE_LIMITS flag set (i.e., sync XHRs) | 435 // Requests with the IGNORE_LIMITS flag set (i.e., sync XHRs) |
| 429 // should remain at MAXIMUM_PRIORITY. | 436 // should remain at MAXIMUM_PRIORITY. |
| 430 if (request->load_flags() & net::LOAD_IGNORE_LIMITS) { | 437 if (request->load_flags() & net::LOAD_IGNORE_LIMITS) { |
| 431 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY); | 438 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY); |
| 432 } else { | 439 } else { |
| 433 request->SetPriority(net::IDLE); | 440 request->SetPriority(net::IDLE); |
| 434 } | 441 } |
| 435 } | 442 } |
| 443 #endif // OS_ANDROID | |
| 436 | 444 |
| 437 ProfileIOData* io_data = ProfileIOData::FromResourceContext( | 445 ProfileIOData* io_data = ProfileIOData::FromResourceContext( |
| 438 resource_context); | 446 resource_context); |
| 439 | 447 |
| 440 #if defined(OS_ANDROID) | 448 #if defined(OS_ANDROID) |
| 441 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) | 449 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) |
| 442 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); | 450 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); |
| 443 #endif | 451 #endif |
| 444 | 452 |
| 445 #if defined(OS_CHROMEOS) | 453 #if defined(OS_CHROMEOS) |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 475 | 483 |
| 476 signin::FixMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, | 484 signin::FixMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, |
| 477 io_data, info->GetChildID(), | 485 io_data, info->GetChildID(), |
| 478 info->GetRouteID()); | 486 info->GetRouteID()); |
| 479 | 487 |
| 480 AppendStandardResourceThrottles(request, | 488 AppendStandardResourceThrottles(request, |
| 481 resource_context, | 489 resource_context, |
| 482 resource_type, | 490 resource_type, |
| 483 throttles); | 491 throttles); |
| 484 #if !defined(DISABLE_NACL) | 492 #if !defined(DISABLE_NACL) |
| 485 if (!is_prerendering) { | 493 if (!is_prerendering) { |
|
droger
2016/10/07 09:08:23
FYI:
|is_prerendering| is used here, compile might
Benoit L
2016/10/07 09:27:35
Done.
| |
| 486 AppendComponentUpdaterThrottles(request, | 494 AppendComponentUpdaterThrottles(request, |
| 487 resource_context, | 495 resource_context, |
| 488 resource_type, | 496 resource_type, |
| 489 throttles); | 497 throttles); |
| 490 } | 498 } |
| 491 #endif | 499 #endif |
| 492 | 500 |
| 493 if (io_data->resource_prefetch_predictor_observer()) { | 501 if (io_data->resource_prefetch_predictor_observer()) { |
| 494 io_data->resource_prefetch_predictor_observer()->OnRequestStarted( | 502 io_data->resource_prefetch_predictor_observer()->OnRequestStarted( |
| 495 request, resource_type, info->GetChildID(), info->GetRenderFrameID()); | 503 request, resource_type, info->GetChildID(), info->GetRenderFrameID()); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 869 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 862 base::Unretained(this), url, request_loading_time)); | 870 base::Unretained(this), url, request_loading_time)); |
| 863 return; | 871 return; |
| 864 } | 872 } |
| 865 | 873 |
| 866 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 874 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 867 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 875 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 868 rappor::SampleDomainAndRegistryFromGURL( | 876 rappor::SampleDomainAndRegistryFromGURL( |
| 869 g_browser_process->rappor_service(), metric_name, url); | 877 g_browser_process->rappor_service(), metric_name, url); |
| 870 } | 878 } |
| OLD | NEW |