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

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: mmenke@ review + additional test Created 4 years, 7 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 all redirect and
mmenke 2016/05/24 20:27:34 nit: Suggest removing "all"
Charlie Harrison 2016/05/24 21:43:22 Done.
26 // referrer 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 main frame
30 // requests. That is done on the UI thread in response to navigation callbacks
mmenke 2016/05/24 20:27:34 nit: "off of main frame requests" -> "off of the i
Charlie Harrison 2016/05/24 21:43:22 Done.
31 // 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 class PredictorResourceThrottle : public content::ResourceThrottle {
35 public:
36 PredictorResourceThrottle(net::URLRequest* request,
37 chrome_browser_net::Predictor* predictor);
38 ~PredictorResourceThrottle() override;
39
40 static std::unique_ptr<PredictorResourceThrottle> MaybeCreate(
41 net::URLRequest* request,
42 ProfileIOData* io_data);
43
44 // content::ResourceThrottle:
45 void WillStartRequest(bool* defer) override;
46 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
47 bool* defer) override;
48 const char* GetNameForLogging() const override;
49
50 private:
51 net::URLRequest* request_;
52 chrome_browser_net::Predictor* predictor_;
53
54 DISALLOW_COPY_AND_ASSIGN(PredictorResourceThrottle);
55 };
56
57 #endif // CHROME_BROWSER_RENDERER_HOST_PREDICTOR_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698