OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ |
7 | 7 |
8 #include <vector> | |
9 | |
10 class GURL; | |
11 | |
12 namespace net { | 8 namespace net { |
13 struct RedirectInfo; | 9 struct RedirectInfo; |
14 } | 10 } |
15 | 11 |
16 namespace content { | 12 namespace content { |
17 | 13 |
| 14 class AsyncRevalidationDriver; |
18 class ResourceController; | 15 class ResourceController; |
| 16 class ThrottlingResourceHandler; |
19 | 17 |
20 // A ResourceThrottle gets notified at various points during the process of | 18 // A ResourceThrottle gets notified at various points during the process of |
21 // loading a resource. At each stage, it has the opportunity to defer the | 19 // loading a resource. At each stage, it has the opportunity to defer the |
22 // resource load. The ResourceController interface may be used to resume a | 20 // resource load. The ResourceController interface may be used to resume a |
23 // deferred resource load, or it may be used to cancel a resource load at any | 21 // deferred resource load, or it may be used to cancel a resource load at any |
24 // time. | 22 // time. |
25 class ResourceThrottle { | 23 class ResourceThrottle { |
26 public: | 24 public: |
27 virtual ~ResourceThrottle() {} | 25 virtual ~ResourceThrottle() {} |
28 | 26 |
(...skipping 20 matching lines...) Expand all Loading... |
49 | 47 |
50 void set_controller_for_testing(ResourceController* c) { | 48 void set_controller_for_testing(ResourceController* c) { |
51 controller_ = c; | 49 controller_ = c; |
52 } | 50 } |
53 | 51 |
54 protected: | 52 protected: |
55 ResourceThrottle() : controller_(nullptr) {} | 53 ResourceThrottle() : controller_(nullptr) {} |
56 ResourceController* controller() { return controller_; } | 54 ResourceController* controller() { return controller_; } |
57 | 55 |
58 private: | 56 private: |
| 57 friend class AsyncRevalidationDriver; |
59 friend class ThrottlingResourceHandler; | 58 friend class ThrottlingResourceHandler; |
60 void set_controller(ResourceController* c) { controller_ = c; } | 59 void set_controller(ResourceController* c) { controller_ = c; } |
61 | 60 |
62 ResourceController* controller_; | 61 ResourceController* controller_; |
63 }; | 62 }; |
64 | 63 |
65 } // namespace content | 64 } // namespace content |
66 | 65 |
67 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ | 66 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ |
OLD | NEW |