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

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

Issue 2246493002: Revert of Change VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
57 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } 53 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); }
58 54
59 static base::TimeTicks ThrottledRunTime(base::TimeTicks unthrottled_runtime); 55 static base::TimeTicks ThrottledRunTime(base::TimeTicks unthrottled_runtime);
60 56
61 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } 57 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; }
62 58
63 private: 59 private:
64 struct Metadata { 60 struct Metadata {
65 Metadata() : throttling_ref_count(0), enabled(false) {} 61 Metadata() : throttling_ref_count(0), enabled(false) {}
66 62
(...skipping 16 matching lines...) Expand all
83 base::TimeTicks unthrottled_runtime); 79 base::TimeTicks unthrottled_runtime);
84 80
85 TaskQueueMap throttled_queues_; 81 TaskQueueMap throttled_queues_;
86 base::Closure forward_immediate_work_closure_; 82 base::Closure forward_immediate_work_closure_;
87 scoped_refptr<TaskQueue> task_runner_; 83 scoped_refptr<TaskQueue> task_runner_;
88 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED 84 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
89 base::TickClock* tick_clock_; // NOT OWNED 85 base::TickClock* tick_clock_; // NOT OWNED
90 const char* tracing_category_; // NOT OWNED 86 const char* tracing_category_; // NOT OWNED
91 std::unique_ptr<ThrottledTimeDomain> time_domain_; 87 std::unique_ptr<ThrottledTimeDomain> time_domain_;
92 88
93 CancelableClosureHolder pump_throttled_tasks_closure_; 89 CancelableClosureHolder suspend_timers_when_backgrounded_closure_;
94 base::TimeTicks pending_pump_throttled_tasks_runtime_; 90 base::TimeTicks pending_pump_throttled_tasks_runtime_;
95 bool virtual_time_;
96 91
97 base::WeakPtrFactory<ThrottlingHelper> weak_factory_; 92 base::WeakPtrFactory<ThrottlingHelper> weak_factory_;
98 93
99 DISALLOW_COPY_AND_ASSIGN(ThrottlingHelper); 94 DISALLOW_COPY_AND_ASSIGN(ThrottlingHelper);
100 }; 95 };
101 96
102 } // namespace scheduler 97 } // namespace scheduler
103 98
104 #endif // COMPONENTS_SCHEDULER_RENDERER_THROTTLING_HELPER_H_ 99 #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