| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| 11 #include "content/renderer/scheduler/renderer_scheduler.h" | 11 #include "content/renderer/scheduler/renderer_scheduler.h" |
| 12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" | 12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" |
| 13 #include "content/renderer/scheduler/task_queue_manager.h" | 13 #include "content/renderer/scheduler/task_queue_manager.h" |
| 14 | 14 |
| 15 namespace base { |
| 16 namespace debug { |
| 17 class ConvertableToTraceFormat; |
| 18 } |
| 19 } |
| 20 |
| 15 namespace content { | 21 namespace content { |
| 16 | 22 |
| 17 class RendererTaskQueueSelector; | 23 class RendererTaskQueueSelector; |
| 18 | 24 |
| 19 class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { | 25 class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| 20 public: | 26 public: |
| 21 RendererSchedulerImpl( | 27 RendererSchedulerImpl( |
| 22 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 28 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
| 23 ~RendererSchedulerImpl() override; | 29 ~RendererSchedulerImpl() override; |
| 24 | 30 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 bool IsSet() const; | 71 bool IsSet() const; |
| 66 | 72 |
| 67 private: | 73 private: |
| 68 base::subtle::Atomic32 flag_; | 74 base::subtle::Atomic32 flag_; |
| 69 base::Lock* write_lock_; // Not owned. | 75 base::Lock* write_lock_; // Not owned. |
| 70 base::ThreadChecker thread_checker_; | 76 base::ThreadChecker thread_checker_; |
| 71 | 77 |
| 72 DISALLOW_COPY_AND_ASSIGN(PollableNeedsUpdateFlag); | 78 DISALLOW_COPY_AND_ASSIGN(PollableNeedsUpdateFlag); |
| 73 }; | 79 }; |
| 74 | 80 |
| 81 // Returns the serialized scheduler state for tracing. |
| 82 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueLocked( |
| 83 base::TimeTicks optional_now) const; |
| 84 static const char* TaskQueueIdToString(QueueId queue_id); |
| 85 static const char* PolicyToString(Policy policy); |
| 86 |
| 75 // The time we should stay in CompositorPriority mode for after a touch event. | 87 // The time we should stay in CompositorPriority mode for after a touch event. |
| 76 static const int kCompositorPriorityAfterTouchMillis = 100; | 88 static const int kCompositorPriorityAfterTouchMillis = 100; |
| 77 | 89 |
| 78 // IdleTaskDeadlineSupplier Implementation: | 90 // IdleTaskDeadlineSupplier Implementation: |
| 79 void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const; | 91 void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const; |
| 80 | 92 |
| 81 // Returns the current scheduler policy. Must be called from the main thread. | 93 // Returns the current scheduler policy. Must be called from the main thread. |
| 82 Policy SchedulerPolicy() const; | 94 Policy SchedulerPolicy() const; |
| 83 | 95 |
| 84 // Posts a call to UpdatePolicy on the control runner to be run after |delay| | 96 // Posts a call to UpdatePolicy on the control runner to be run after |delay| |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 131 |
| 120 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; | 132 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; |
| 121 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 133 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
| 122 | 134 |
| 123 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 135 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
| 124 }; | 136 }; |
| 125 | 137 |
| 126 } // namespace content | 138 } // namespace content |
| 127 | 139 |
| 128 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ | 140 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
| OLD | NEW |