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

Unified Diff: net/base/network_throttle_manager.h

Issue 2130493002: Implement THROTTLED priority semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NetworkStreamThrottler
Patch Set: Added (currently failing) URLRequest unit test. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/network_throttle_manager.cc » ('j') | net/base/network_throttle_manager_impl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_throttle_manager.h
diff --git a/net/base/network_throttle_manager.h b/net/base/network_throttle_manager.h
index 4fde0f245d249efcd1820247b54dfaf7d1d78e27..6cff50de4aead4aff3a6b57385bbfa4288c1e0aa 100644
--- a/net/base/network_throttle_manager.h
+++ b/net/base/network_throttle_manager.h
@@ -24,12 +24,14 @@ namespace net {
// Methods are virtual to allow for test mocks.
class NET_EXPORT_PRIVATE NetworkThrottleManager {
public:
+ class Throttle;
+
// Abstract base class other classes can inherit from to get
// notifications from throttle state changes.
class NET_EXPORT_PRIVATE ThrottleDelegate {
public:
- // Called whenever the throttle state of this stream has changed.
- // The new state can be determined through Throttle::IsThrottled().
+ // Called whenever the blocked state of this throttle has changed.
+ // The new state can be determined through Throttle::IsBlocked().
//
// Note that this call may occur as the result of either a call to
// Throttle::SetPriority (on the throttle related to this delegate
@@ -37,7 +39,7 @@ class NET_EXPORT_PRIVATE NetworkThrottleManager {
// so will occur synchronously during those events. It will not
// be called from the destructor of the Throttle associated with
// the ThrottleDelegate.
- virtual void OnThrottleStateChanged() = 0;
+ virtual void OnThrottleStateChanged(Throttle* throttle) = 0;
protected:
virtual ~ThrottleDelegate() {}
@@ -45,17 +47,19 @@ class NET_EXPORT_PRIVATE NetworkThrottleManager {
// Class owned by external stream representations that
// routes notifications. It may be constructed in either the
- // throttled or unthrottled state according to the state of the
- // NetworkThrottleManager; if it's constructed in the throttled
- // state, it will only make a single transition to unthrottled,
- // which will be signaled by delegate->OnThrottleStateChanged().
- // If it's constructed in the unthrottled state, it will remain
+ // blocked or unblocked state according to the state of the
+ // NetworkThrottleManager; if it's constructed in the unblocked
+ // state, it will only make a single transition to unblocked,
+ // which will be signaled by delegate->OnThrottleStateChanged(this).
+ // If it's constructed in the unblocked state, it will remain
// there.
class NET_EXPORT_PRIVATE Throttle {
public:
virtual ~Throttle() {}
- virtual bool IsThrottled() const = 0;
+ virtual bool IsBlocked() const = 0;
+
+ virtual RequestPriority Priority() const = 0;
// Note that this may result in a possibly reentrant call to
// |ThrottleDelegate::OnThrottleStateChanged|, as well as the resumption
@@ -63,6 +67,8 @@ class NET_EXPORT_PRIVATE NetworkThrottleManager {
// and destruction before return. Any caller of this function
// should not rely on this object or containing objects surviving
// this call.
+ //
+ // This call is a no-op if the priority is set to its current value.
virtual void SetPriority(RequestPriority priority) = 0;
protected:
@@ -80,8 +86,6 @@ class NET_EXPORT_PRIVATE NetworkThrottleManager {
RequestPriority priority,
bool ignore_limits) = 0;
Charlie Harrison 2016/09/01 18:17:52 When would a consumer choose to ignore limits?
Randy Smith (Not in Mondays) 2016/09/18 19:12:34 I think sync XHRs are the usual context, but it's
- static std::unique_ptr<NetworkThrottleManager> CreateThrottler();
-
protected:
NetworkThrottleManager() {}
« no previous file with comments | « no previous file | net/base/network_throttle_manager.cc » ('j') | net/base/network_throttle_manager_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698