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

Side by Side Diff: components/scheduler/renderer/throttling_helper.h

Issue 2184123002: Change VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 void IncreaseThrottleRefCount(TaskQueue* task_queue); 43 void IncreaseThrottleRefCount(TaskQueue* task_queue);
44 44
45 // If the refcouint is non-zero it's decremented. If the throttled refcount 45 // If the refcouint is non-zero it's decremented. If the throttled refcount
46 // becomes zero then |task_queue| is unthrottled. If the refcount was already 46 // becomes zero then |task_queue| is unthrottled. If the refcount was already
47 // zero this function does nothing. 47 // zero this function does nothing.
48 void DecreaseThrottleRefCount(TaskQueue* task_queue); 48 void DecreaseThrottleRefCount(TaskQueue* task_queue);
49 49
50 // Removes |task_queue| from |throttled_queues_|. 50 // Removes |task_queue| from |throttled_queues_|.
51 void UnregisterTaskQueue(TaskQueue* task_queue); 51 void UnregisterTaskQueue(TaskQueue* task_queue);
52 52
53 // Tells the ThrottlingHelper we're using virtual time, which disables all
54 // throttling.
55 void EnableVirtualTime();
56
53 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } 57 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); }
54 58
55 static base::TimeTicks ThrottledRunTime(base::TimeTicks unthrottled_runtime); 59 static base::TimeTicks ThrottledRunTime(base::TimeTicks unthrottled_runtime);
56 60
57 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } 61 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; }
58 62
59 private: 63 private:
60 struct Metadata { 64 struct Metadata {
61 Metadata() : throttling_ref_count(0), enabled(false) {} 65 Metadata() : throttling_ref_count(0), enabled(false) {}
62 66
(...skipping 16 matching lines...) Expand all
79 base::TimeTicks unthrottled_runtime); 83 base::TimeTicks unthrottled_runtime);
80 84
81 TaskQueueMap throttled_queues_; 85 TaskQueueMap throttled_queues_;
82 base::Closure forward_immediate_work_closure_; 86 base::Closure forward_immediate_work_closure_;
83 scoped_refptr<TaskQueue> task_runner_; 87 scoped_refptr<TaskQueue> task_runner_;
84 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED 88 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
85 base::TickClock* tick_clock_; // NOT OWNED 89 base::TickClock* tick_clock_; // NOT OWNED
86 const char* tracing_category_; // NOT OWNED 90 const char* tracing_category_; // NOT OWNED
87 std::unique_ptr<ThrottledTimeDomain> time_domain_; 91 std::unique_ptr<ThrottledTimeDomain> time_domain_;
88 92
89 CancelableClosureHolder suspend_timers_when_backgrounded_closure_; 93 CancelableClosureHolder pump_throttled_tasks_closure_;
90 base::TimeTicks pending_pump_throttled_tasks_runtime_; 94 base::TimeTicks pending_pump_throttled_tasks_runtime_;
95 bool virtual_time_;
91 96
92 base::WeakPtrFactory<ThrottlingHelper> weak_factory_; 97 base::WeakPtrFactory<ThrottlingHelper> weak_factory_;
93 98
94 DISALLOW_COPY_AND_ASSIGN(ThrottlingHelper); 99 DISALLOW_COPY_AND_ASSIGN(ThrottlingHelper);
95 }; 100 };
96 101
97 } // namespace scheduler 102 } // namespace scheduler
98 103
99 #endif // COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ 104 #endif // COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_
OLDNEW
« no previous file with comments | « components/scheduler/renderer/renderer_scheduler_impl_unittest.cc ('k') | components/scheduler/renderer/throttling_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698