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

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

Issue 1857383002: Refactor net predictor to use ResourceThrottles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on #396550 Created 4 years, 6 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 <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 13 matching lines...) Expand all
24 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" 24 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h"
25 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" 25 #include "chrome/browser/net/resource_prefetch_predictor_observer.h"
26 #include "chrome/browser/plugins/plugin_prefs.h" 26 #include "chrome/browser/plugins/plugin_prefs.h"
27 #include "chrome/browser/prerender/prerender_manager.h" 27 #include "chrome/browser/prerender/prerender_manager.h"
28 #include "chrome/browser/prerender/prerender_manager_factory.h" 28 #include "chrome/browser/prerender/prerender_manager_factory.h"
29 #include "chrome/browser/prerender/prerender_resource_throttle.h" 29 #include "chrome/browser/prerender/prerender_resource_throttle.h"
30 #include "chrome/browser/prerender/prerender_util.h" 30 #include "chrome/browser/prerender/prerender_util.h"
31 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/profiles/profile_io_data.h" 32 #include "chrome/browser/profiles/profile_io_data.h"
33 #include "chrome/browser/renderer_host/chrome_navigation_data.h" 33 #include "chrome/browser/renderer_host/chrome_navigation_data.h"
34 #include "chrome/browser/renderer_host/predictor_resource_throttle.h"
34 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" 35 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h"
35 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" 36 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h"
36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 37 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
37 #include "chrome/browser/search/search.h" 38 #include "chrome/browser/search/search.h"
38 #include "chrome/browser/search_engines/template_url_service_factory.h" 39 #include "chrome/browser/search_engines/template_url_service_factory.h"
39 #include "chrome/browser/signin/chrome_signin_helper.h" 40 #include "chrome/browser/signin/chrome_signin_helper.h"
40 #include "chrome/browser/tab_contents/tab_util.h" 41 #include "chrome/browser/tab_contents/tab_util.h"
41 #include "chrome/browser/ui/login/login_handler.h" 42 #include "chrome/browser/ui/login/login_handler.h"
42 #include "chrome/common/chrome_switches.h" 43 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/features.h" 44 #include "chrome/common/features.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 612 }
612 #endif 613 #endif
613 614
614 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 615 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
615 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { 616 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) {
616 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); 617 throttles->push_back(new prerender::PrerenderResourceThrottle(request));
617 } 618 }
618 619
619 if (ThreadHopResourceThrottle::IsEnabled()) 620 if (ThreadHopResourceThrottle::IsEnabled())
620 throttles->push_back(new ThreadHopResourceThrottle); 621 throttles->push_back(new ThreadHopResourceThrottle);
622
623 std::unique_ptr<PredictorResourceThrottle> predictor_throttle =
624 PredictorResourceThrottle::MaybeCreate(request, io_data);
625 if (predictor_throttle)
626 throttles->push_back(predictor_throttle.release());
621 } 627 }
622 628
623 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( 629 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource(
624 const GURL& url, const std::string& mime_type) { 630 const GURL& url, const std::string& mime_type) {
625 #if defined(ENABLE_EXTENSIONS) 631 #if defined(ENABLE_EXTENSIONS)
626 // Special-case user scripts to get downloaded instead of viewed. 632 // Special-case user scripts to get downloaded instead of viewed.
627 return extensions::UserScript::IsURLUserScript(url, mime_type); 633 return extensions::UserScript::IsURLUserScript(url, mime_type);
628 #else 634 #else
629 return false; 635 return false;
630 #endif 636 #endif
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = 843 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data =
838 data_reduction_proxy::DataReductionProxyData::GetData(*request); 844 data_reduction_proxy::DataReductionProxyData::GetData(*request);
839 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the 845 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the
840 // URLRequest and DataReductionProxyData from both having ownership of the 846 // URLRequest and DataReductionProxyData from both having ownership of the
841 // same object. This copy will be shortlived as it will be deep copied again 847 // same object. This copy will be shortlived as it will be deep copied again
842 // when content makes a clone of NavigationData for the UI thread. 848 // when content makes a clone of NavigationData for the UI thread.
843 if (data_reduction_proxy_data) 849 if (data_reduction_proxy_data)
844 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); 850 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy());
845 return data; 851 return data;
846 } 852 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/renderer_host/predictor_resource_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698