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

Side by Side Diff: content/browser/loader/async_revalidation_driver.h

Issue 2535723005: Stop using ResourceController in ResourceThrottle (Closed)
Patch Set: Addressed #62 Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_
6 #define CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_ 6 #define CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/public/browser/resource_controller.h"
18 #include "content/public/browser/resource_throttle.h" 17 #include "content/public/browser/resource_throttle.h"
19 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
20 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
21 20
22 namespace content { 21 namespace content {
23 22
24 // This class is responsible for driving the URLRequest for an async 23 // This class is responsible for driving the URLRequest for an async
25 // revalidation. It is passed an instance of ResourceThrottle created by 24 // revalidation. It is passed an instance of ResourceThrottle created by
26 // content::ResourceScheduler to perform throttling on the request. 25 // content::ResourceScheduler to perform throttling on the request.
27 class CONTENT_EXPORT AsyncRevalidationDriver : public net::URLRequest::Delegate, 26 class CONTENT_EXPORT AsyncRevalidationDriver
28 public ResourceController { 27 : public net::URLRequest::Delegate,
28 public ResourceThrottle::Delegate {
29 public: 29 public:
30 // |completion_callback| is guaranteed to be called on completion, 30 // |completion_callback| is guaranteed to be called on completion,
31 // regardless of success or failure. 31 // regardless of success or failure.
32 AsyncRevalidationDriver(std::unique_ptr<net::URLRequest> request, 32 AsyncRevalidationDriver(std::unique_ptr<net::URLRequest> request,
33 std::unique_ptr<ResourceThrottle> throttle, 33 std::unique_ptr<ResourceThrottle> throttle,
34 const base::Closure& completion_callback); 34 const base::Closure& completion_callback);
35 ~AsyncRevalidationDriver() override; 35 ~AsyncRevalidationDriver() override;
36 36
37 void StartRequest(); 37 void StartRequest();
38 38
(...skipping 14 matching lines...) Expand all
53 53
54 // net::URLRequest::Delegate implementation: 54 // net::URLRequest::Delegate implementation:
55 void OnReceivedRedirect(net::URLRequest* request, 55 void OnReceivedRedirect(net::URLRequest* request,
56 const net::RedirectInfo& redirect_info, 56 const net::RedirectInfo& redirect_info,
57 bool* defer) override; 57 bool* defer) override;
58 void OnAuthRequired(net::URLRequest* request, 58 void OnAuthRequired(net::URLRequest* request,
59 net::AuthChallengeInfo* info) override; 59 net::AuthChallengeInfo* info) override;
60 void OnResponseStarted(net::URLRequest* request) override; 60 void OnResponseStarted(net::URLRequest* request) override;
61 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; 61 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
62 62
63 // ResourceController implementation: 63 // ResourceThrottle::Delegate implementation:
64 void Resume() override; 64 void Resume() override;
65 65
66 // For simplicity, this class assumes that ResourceScheduler never cancels 66 // For simplicity, this class assumes that ResourceScheduler never cancels
67 // requests, and so these three methods are never called. 67 // requests, and so these three methods are never called.
68 void Cancel() override; 68 void Cancel() override;
69 void CancelAndIgnore() override; 69 void CancelAndIgnore() override;
70 void CancelWithError(int error_code) override; 70 void CancelWithError(int error_code) override;
71 71
72 // Internal methods. 72 // Internal methods.
73 void StartRequestInternal(); 73 void StartRequestInternal();
(...skipping 16 matching lines...) Expand all
90 base::Closure completion_callback_; 90 base::Closure completion_callback_;
91 91
92 base::WeakPtrFactory<AsyncRevalidationDriver> weak_ptr_factory_; 92 base::WeakPtrFactory<AsyncRevalidationDriver> weak_ptr_factory_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(AsyncRevalidationDriver); 94 DISALLOW_COPY_AND_ASSIGN(AsyncRevalidationDriver);
95 }; 95 };
96 96
97 } // namespace content 97 } // namespace content
98 98
99 #endif // CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_ 99 #endif // CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698