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

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

Issue 1372263002: Add a field trial to delay all resource requests by thread hops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asvitkine 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 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h " 15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h "
16 #include "chrome/browser/download/download_request_limiter.h" 16 #include "chrome/browser/download/download_request_limiter.h"
17 #include "chrome/browser/download/download_resource_throttle.h" 17 #include "chrome/browser/download/download_resource_throttle.h"
18 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" 18 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h"
19 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" 19 #include "chrome/browser/net/resource_prefetch_predictor_observer.h"
20 #include "chrome/browser/plugins/plugin_prefs.h" 20 #include "chrome/browser/plugins/plugin_prefs.h"
21 #include "chrome/browser/prefetch/prefetch.h" 21 #include "chrome/browser/prefetch/prefetch.h"
22 #include "chrome/browser/prerender/prerender_manager.h" 22 #include "chrome/browser/prerender/prerender_manager.h"
23 #include "chrome/browser/prerender/prerender_manager_factory.h" 23 #include "chrome/browser/prerender/prerender_manager_factory.h"
24 #include "chrome/browser/prerender/prerender_resource_throttle.h" 24 #include "chrome/browser/prerender/prerender_resource_throttle.h"
25 #include "chrome/browser/prerender/prerender_util.h" 25 #include "chrome/browser/prerender/prerender_util.h"
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/profiles/profile_io_data.h" 27 #include "chrome/browser/profiles/profile_io_data.h"
28 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an droid.h" 28 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an droid.h"
29 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" 29 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h"
30 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h"
30 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 31 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
31 #include "chrome/browser/signin/chrome_signin_helper.h" 32 #include "chrome/browser/signin/chrome_signin_helper.h"
32 #include "chrome/browser/tab_contents/tab_util.h" 33 #include "chrome/browser/tab_contents/tab_util.h"
33 #include "chrome/browser/ui/login/login_prompt.h" 34 #include "chrome/browser/ui/login/login_prompt.h"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
36 #include "components/content_settings/core/browser/host_content_settings_map.h" 37 #include "components/content_settings/core/browser/host_content_settings_map.h"
37 #include "components/google/core/browser/google_util.h" 38 #include "components/google/core/browser/google_util.h"
38 #include "components/variations/net/variations_http_header_provider.h" 39 #include "components/variations/net/variations_http_header_provider.h"
39 #include "content/public/browser/browser_thread.h" 40 #include "content/public/browser/browser_thread.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 extension_throttle_manager->MaybeCreateThrottle(request); 532 extension_throttle_manager->MaybeCreateThrottle(request);
532 if (extension_throttle) 533 if (extension_throttle)
533 throttles->push_back(extension_throttle.release()); 534 throttles->push_back(extension_throttle.release());
534 } 535 }
535 #endif 536 #endif
536 537
537 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 538 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
538 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { 539 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) {
539 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); 540 throttles->push_back(new prerender::PrerenderResourceThrottle(request));
540 } 541 }
542
543 if (ThreadHopResourceThrottle::IsEnabled())
544 throttles->push_back(new ThreadHopResourceThrottle);
541 } 545 }
542 546
543 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( 547 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource(
544 const GURL& url, const std::string& mime_type) { 548 const GURL& url, const std::string& mime_type) {
545 #if defined(ENABLE_EXTENSIONS) 549 #if defined(ENABLE_EXTENSIONS)
546 // Special-case user scripts to get downloaded instead of viewed. 550 // Special-case user scripts to get downloaded instead of viewed.
547 return extensions::UserScript::IsURLUserScript(url, mime_type); 551 return extensions::UserScript::IsURLUserScript(url, mime_type);
548 #else 552 #else
549 return false; 553 return false;
550 #endif 554 #endif
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 url_request->GetTotalReceivedBytes())); 724 url_request->GetTotalReceivedBytes()));
721 } 725 }
722 } 726 }
723 727
724 // static 728 // static
725 void ChromeResourceDispatcherHostDelegate:: 729 void ChromeResourceDispatcherHostDelegate::
726 SetExternalProtocolHandlerDelegateForTesting( 730 SetExternalProtocolHandlerDelegateForTesting(
727 ExternalProtocolHandler::Delegate* delegate) { 731 ExternalProtocolHandler::Delegate* delegate) {
728 g_external_protocol_handler_delegate = delegate; 732 g_external_protocol_handler_delegate = delegate;
729 } 733 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698