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

Side by Side Diff: chrome/browser/renderer_host/predictor_resource_throttle.h

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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_RENDERER_HOST_PREDICTOR_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_RENDERER_HOST_PREDICTOR_RESOURCE_THROTTLE_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "content/public/browser/resource_throttle.h"
12
13 namespace chrome_browser_net {
14 class Predictor;
15 }
16
17 namespace net {
18 struct RedirectInfo;
19 class URLRequest;
20 }
21
22 class ProfileIOData;
23
24 // This resource throttle tracks requests in order to help the predictor learn
25 // resource relationships. It notifies the predictor of redirect and referrer
26 // relationships, and populates the predictor's timed cache of ongoing
27 // navigations. It also initiates predictive actions based on subframe
28 // requests and redirects.
29 // Note: This class does not issue predictive actions off of the initial main
30 // frame request (before any redirects). That is done on the UI thread in
31 // response to navigation callbacks in predictor_tab_helper.cc.
32 // TODO(csharrison): This class shouldn't depend on chrome_browser_net. The
33 // predictor should probably be moved here (along with its dependencies).
34 // TODO(csharrison): When the PreconnectMore experiment is over, move all
35 // prediction dispatching to the tab helper.
36 class PredictorResourceThrottle : public content::ResourceThrottle {
37 public:
38 PredictorResourceThrottle(net::URLRequest* request,
39 chrome_browser_net::Predictor* predictor);
40 ~PredictorResourceThrottle() override;
41
42 static std::unique_ptr<PredictorResourceThrottle> MaybeCreate(
43 net::URLRequest* request,
44 ProfileIOData* io_data);
45
46 // content::ResourceThrottle:
47 void WillStartRequest(bool* defer) override;
48 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
49 bool* defer) override;
50 const char* GetNameForLogging() const override;
51
52 private:
53 net::URLRequest* request_;
54 chrome_browser_net::Predictor* predictor_;
55
56 DISALLOW_COPY_AND_ASSIGN(PredictorResourceThrottle);
57 };
58
59 #endif // CHROME_BROWSER_RENDERER_HOST_PREDICTOR_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698