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

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: comments + code cleanup 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 "base/macros.h"
9 #include "content/public/browser/resource_throttle.h"
10
11 namespace chrome_browser_net {
12 class Predictor;
13 }
14
15 namespace net {
16 struct RedirectInfo;
17 class URLRequest;
18 }
19
20 // This resource throttle tracks requests starting/redirecting and notifies the
21 // predictor, which learns referrer/redirect relationships. The throttle also
22 // notifies the predictor of subframe / redirect requests to fire off
Charlie Harrison 2016/05/23 14:16:21 Rewrite the paragraph.
23 // preconnect/preresolves from.
24 // Note: This class does not issue predictive actions off of main frame
25 // requests. That is done on the UI thread in response to navigation callbacks
26 // in predictor_tab_helper.cc.
27 // TODO(csharrison): The predictor does not really belong in /net, and should be
28 // moved here (along with all its dependencies).
29 class PredictorResourceThrottle : public content::ResourceThrottle {
30 public:
31 PredictorResourceThrottle(net::URLRequest* request,
32 chrome_browser_net::Predictor* predictor);
33 ~PredictorResourceThrottle() override;
34
35 // content::ResourceThrottle:
36 void WillStartRequest(bool* defer) override;
37 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
38 bool* defer) override;
39 const char* GetNameForLogging() const override;
40
41 private:
42 net::URLRequest* request_;
43 chrome_browser_net::Predictor* predictor_;
44
45 DISALLOW_COPY_AND_ASSIGN(PredictorResourceThrottle);
46 };
47
48 #endif // CHROME_BROWSER_RENDERER_HOST_PREDICTOR_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698