| OLD | NEW |
| 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 COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // Increments the throttled refcount and causes |task_queue| to be throttled | 33 // Increments the throttled refcount and causes |task_queue| to be throttled |
| 34 // if its not already throttled. | 34 // if its not already throttled. |
| 35 void IncreaseThrottleRefCount(TaskQueue* task_queue); | 35 void IncreaseThrottleRefCount(TaskQueue* task_queue); |
| 36 | 36 |
| 37 // If the refcouint is non-zero it's decremented. If the throttled refcount | 37 // If the refcouint is non-zero it's decremented. If the throttled refcount |
| 38 // becomes zero then |task_queue| is unthrottled. If the refcount was already | 38 // becomes zero then |task_queue| is unthrottled. If the refcount was already |
| 39 // zero this function does nothing. | 39 // zero this function does nothing. |
| 40 void DecreaseThrottleRefCount(TaskQueue* task_queue); | 40 void DecreaseThrottleRefCount(TaskQueue* task_queue); |
| 41 | 41 |
| 42 // Removes |task_queue| from |throttled_queues_|. |
| 43 void UnregisterTaskQueue(TaskQueue* task_queue); |
| 44 |
| 42 const VirtualTimeDomain* time_domain() const { return time_domain_.get(); } | 45 const VirtualTimeDomain* time_domain() const { return time_domain_.get(); } |
| 43 | 46 |
| 44 static base::TimeTicks ThrottledRunTime(base::TimeTicks unthrottled_runtime); | 47 static base::TimeTicks ThrottledRunTime(base::TimeTicks unthrottled_runtime); |
| 45 | 48 |
| 46 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } | 49 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 using TaskQueueMap = std::map<TaskQueue*, size_t>; | 52 using TaskQueueMap = std::map<TaskQueue*, size_t>; |
| 50 | 53 |
| 51 void PumpThrottledTasks(); | 54 void PumpThrottledTasks(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 70 base::TimeTicks pending_pump_throttled_tasks_runtime_; | 73 base::TimeTicks pending_pump_throttled_tasks_runtime_; |
| 71 | 74 |
| 72 base::WeakPtrFactory<ThrottlingHelper> weak_factory_; | 75 base::WeakPtrFactory<ThrottlingHelper> weak_factory_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(ThrottlingHelper); | 77 DISALLOW_COPY_AND_ASSIGN(ThrottlingHelper); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace scheduler | 80 } // namespace scheduler |
| 78 | 81 |
| 79 #endif // COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ | 82 #endif // COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ |
| OLD | NEW |