 Chromium Code Reviews
 Chromium Code Reviews Issue 393163003:
  Add coalescing timer to ResourceScheduler. CL 2 from BUG=128035.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@rsblank
    
  
    Issue 393163003:
  Add coalescing timer to ResourceScheduler. CL 2 from BUG=128035.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@rsblank| Index: content/browser/loader/resource_scheduler.h | 
| diff --git a/content/browser/loader/resource_scheduler.h b/content/browser/loader/resource_scheduler.h | 
| index b445a6818fddec1e7726ff9b16c32ad5773d205d..3e11431228b47af351d70ad6d8fc27f5268802d9 100644 | 
| --- a/content/browser/loader/resource_scheduler.h | 
| +++ b/content/browser/loader/resource_scheduler.h | 
| @@ -12,6 +12,7 @@ | 
| #include "base/compiler_specific.h" | 
| #include "base/memory/scoped_ptr.h" | 
| #include "base/threading/non_thread_safe.h" | 
| +#include "base/timer/timer.h" | 
| #include "content/common/content_export.h" | 
| #include "net/base/priority_queue.h" | 
| #include "net/base/request_priority.h" | 
| @@ -69,6 +70,13 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { | 
| ResourceScheduler(); | 
| ~ResourceScheduler(); | 
| + // Use a mock timer when testing. | 
| + void set_timer_for_testing(scoped_ptr<base::Timer> timer) { | 
| + DCHECK(timer); | 
| + coalescing_timer_.reset(); | 
| + coalescing_timer_.reset(timer.release()); | 
| + } | 
| + | 
| // TODO(aiolos): Remove when throttling and coalescing have landed | 
| void SetThrottleOptionsForTesting(bool should_throttle, bool should_coalesce); | 
| @@ -139,14 +147,23 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { | 
| // These Calls may update the ThrottleState of all clients, and have the | 
| // potential to be re-entarant. | 
| 
mmenke
2014/07/16 17:01:34
nit:  While you're here, this should be "re-entran
 | 
| // Called when a Client newly becomes active loading. | 
| - void DecrementActiveClientsLoading(); | 
| 
aiolos (Not reviewing)
2014/07/15 23:54:58
The comments were in the wrong order. If you want
 
mmenke
2014/07/16 17:01:34
I'm fine with the change in this CL.
 | 
| - // Caled when a Client stops being active loading. | 
| void IncrementActiveClientsLoading(); | 
| + // Caled when a Client stops being active loading. | 
| 
mmenke
2014/07/16 17:01:34
nit:  "Called".  Also, grammar isn't quite right.
 | 
| + void DecrementActiveClientsLoading(); | 
| void OnLoadingActiveClientsStateChanged(); | 
| size_t CountActiveClientsLoading(); | 
| + // Called when a Client becomes coalesced. | 
| + void IncrementCoalescedClients(); | 
| + // Called when a client stops being coalesced. | 
| + void DecrementCoalescedClients(); | 
| + | 
| + size_t CountCoalescedClients(); | 
| + | 
| + void LoadCoalescedRequests(); | 
| + | 
| // Update the queue position for |request|, possibly causing it to start | 
| // loading. | 
| // | 
| @@ -167,6 +184,8 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { | 
| bool should_throttle_; | 
| ClientMap client_map_; | 
| size_t active_clients_loading_; | 
| + size_t coalesced_clients_; | 
| + scoped_ptr<base::Timer> coalescing_timer_; | 
| RequestSet unowned_requests_; | 
| }; |