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

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: Fix test 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
32 // in predictor_tab_helper.cc.
mmenke 2016/05/25 18:16:04 nit: Can merge lines 32 and 31
Charlie Harrison 2016/05/25 18:45:16 Done.
33 // TODO(csharrison): This class shouldn't depend on chrome_browser_net. The
34 // predictor should probably be moved here (along with its dependencies).
35 class PredictorResourceThrottle : public content::ResourceThrottle {
36 public:
37 PredictorResourceThrottle(net::URLRequest* request,
38 chrome_browser_net::Predictor* predictor);
39 ~PredictorResourceThrottle() override;
40
41 static std::unique_ptr<PredictorResourceThrottle> MaybeCreate(
42 net::URLRequest* request,
43 ProfileIOData* io_data);
44
45 // content::ResourceThrottle:
46 void WillStartRequest(bool* defer) override;
47 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
48 bool* defer) override;
49 const char* GetNameForLogging() const override;
50
51 private:
52 net::URLRequest* request_;
53 chrome_browser_net::Predictor* predictor_;
54
55 DISALLOW_COPY_AND_ASSIGN(PredictorResourceThrottle);
56 };
57
58 #endif // CHROME_BROWSER_RENDERER_HOST_PREDICTOR_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698