| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_BUDGET_POOL_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_BUDGET_POOL_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_BUDGET_POOL_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_BUDGET_POOL_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace blink { | 23 namespace blink { |
| 24 namespace scheduler { | 24 namespace scheduler { |
| 25 | 25 |
| 26 class TaskQueue; | 26 class TaskQueue; |
| 27 class BudgetPoolController; | 27 class BudgetPoolController; |
| 28 | 28 |
| 29 // BudgetPool represents a group of task queues which share a limit | 29 // BudgetPool represents a group of task queues which share a limit |
| 30 // on a resource. This limit applies when task queues are already throttled | 30 // on a resource. This limit applies when task queues are already throttled |
| 31 // by TaskQueueThrottler. | 31 // by TaskQueueThrottler. |
| 32 class BLINK_PLATFORM_EXPORT BudgetPool { | 32 class PLATFORM_EXPORT BudgetPool { |
| 33 public: | 33 public: |
| 34 virtual ~BudgetPool(); | 34 virtual ~BudgetPool(); |
| 35 | 35 |
| 36 const char* Name() const; | 36 const char* Name() const; |
| 37 | 37 |
| 38 // Report task run time to the budget pool. | 38 // Report task run time to the budget pool. |
| 39 virtual void RecordTaskRunTime(base::TimeTicks start_time, | 39 virtual void RecordTaskRunTime(base::TimeTicks start_time, |
| 40 base::TimeTicks end_time) = 0; | 40 base::TimeTicks end_time) = 0; |
| 41 | 41 |
| 42 // Retuns earliest time (can be in the past) when the next task can run. | 42 // Retuns earliest time (can be in the past) when the next task can run. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const char* name_; // NOT OWNED | 83 const char* name_; // NOT OWNED |
| 84 | 84 |
| 85 BudgetPoolController* budget_pool_controller_; | 85 BudgetPoolController* budget_pool_controller_; |
| 86 | 86 |
| 87 std::unordered_set<TaskQueue*> associated_task_queues_; | 87 std::unordered_set<TaskQueue*> associated_task_queues_; |
| 88 bool is_enabled_; | 88 bool is_enabled_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // CPUTimeBudgetPool represents a collection of task queues which share a limit | 91 // CPUTimeBudgetPool represents a collection of task queues which share a limit |
| 92 // on total cpu time. | 92 // on total cpu time. |
| 93 class BLINK_PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool { | 93 class PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool { |
| 94 public: | 94 public: |
| 95 CPUTimeBudgetPool(const char* name, | 95 CPUTimeBudgetPool(const char* name, |
| 96 BudgetPoolController* budget_pool_controller, | 96 BudgetPoolController* budget_pool_controller, |
| 97 base::TimeTicks now); | 97 base::TimeTicks now); |
| 98 | 98 |
| 99 ~CPUTimeBudgetPool(); | 99 ~CPUTimeBudgetPool(); |
| 100 | 100 |
| 101 // Set max budget level, base::nullopt represent absence of max level. | 101 // Set max budget level, base::nullopt represent absence of max level. |
| 102 // Max budget level prevents accumulating arbitrary large budgets when | 102 // Max budget level prevents accumulating arbitrary large budgets when |
| 103 // page is inactive for a very long time. | 103 // page is inactive for a very long time. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 base::Callback<void(base::TimeDelta)> reporting_callback_; | 182 base::Callback<void(base::TimeDelta)> reporting_callback_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(CPUTimeBudgetPool); | 184 DISALLOW_COPY_AND_ASSIGN(CPUTimeBudgetPool); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 } // namespace scheduler | 187 } // namespace scheduler |
| 188 } // namespace blink | 188 } // namespace blink |
| 189 | 189 |
| 190 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_BUDGET_POOL_H_ | 190 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_BUDGET_POOL_H_ |
| OLD | NEW |