| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/scheduler/Scheduler.h" | 6 #include "platform/scheduler/Scheduler.h" |
| 7 | 7 |
| 8 #include "platform/PlatformThreadData.h" | 8 #include "platform/PlatformThreadData.h" |
| 9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/Task.h" | 10 #include "platform/Task.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class Scheduler::MainThreadPendingHighPriorityTaskRunner : public WebThread::Tas
k { | 27 class Scheduler::MainThreadPendingHighPriorityTaskRunner : public WebThread::Tas
k { |
| 28 public: | 28 public: |
| 29 MainThreadPendingHighPriorityTaskRunner( | 29 MainThreadPendingHighPriorityTaskRunner( |
| 30 const Scheduler::Task& task, const TraceLocation& location, const char*
traceName) | 30 const Scheduler::Task& task, const TraceLocation& location, const char*
traceName) |
| 31 : m_task(internal::TracedStandardTask::Create(task, location, traceName)
) | 31 : m_task(internal::TracedStandardTask::Create(task, location, traceName)
) |
| 32 { | 32 { |
| 33 ASSERT(Scheduler::shared()); | 33 ASSERT(Scheduler::shared()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // WebThread::Task implementation. | 36 // WebThread::Task implementation. |
| 37 virtual void run() OVERRIDE | 37 virtual void run() override |
| 38 { | 38 { |
| 39 m_task->run(); | 39 m_task->run(); |
| 40 if (Scheduler* scheduler = Scheduler::shared()) { | 40 if (Scheduler* scheduler = Scheduler::shared()) { |
| 41 scheduler->updatePolicy(); | 41 scheduler->updatePolicy(); |
| 42 scheduler->didRunHighPriorityTask(); | 42 scheduler->didRunHighPriorityTask(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 OwnPtr<internal::TracedStandardTask> m_task; | 47 OwnPtr<internal::TracedStandardTask> m_task; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Can be created from any thread. | 50 // Can be created from any thread. |
| 51 // Note if the scheduler gets shutdown, this may be run after. | 51 // Note if the scheduler gets shutdown, this may be run after. |
| 52 class Scheduler::MainThreadPendingTaskRunner : public WebThread::Task { | 52 class Scheduler::MainThreadPendingTaskRunner : public WebThread::Task { |
| 53 public: | 53 public: |
| 54 MainThreadPendingTaskRunner( | 54 MainThreadPendingTaskRunner( |
| 55 const Scheduler::Task& task, const TraceLocation& location, const char*
traceName) | 55 const Scheduler::Task& task, const TraceLocation& location, const char*
traceName) |
| 56 : m_task(internal::TracedStandardTask::Create(task, location, traceName)
) | 56 : m_task(internal::TracedStandardTask::Create(task, location, traceName)
) |
| 57 { | 57 { |
| 58 ASSERT(Scheduler::shared()); | 58 ASSERT(Scheduler::shared()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // WebThread::Task implementation. | 61 // WebThread::Task implementation. |
| 62 virtual void run() OVERRIDE | 62 virtual void run() override |
| 63 { | 63 { |
| 64 m_task->run(); | 64 m_task->run(); |
| 65 if (Scheduler* scheduler = Scheduler::shared()) { | 65 if (Scheduler* scheduler = Scheduler::shared()) { |
| 66 scheduler->updatePolicy(); | 66 scheduler->updatePolicy(); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 OwnPtr<internal::TracedStandardTask> m_task; | 71 OwnPtr<internal::TracedStandardTask> m_task; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 | 74 |
| 75 // Can be created from any thread. | 75 // Can be created from any thread. |
| 76 // Note if the scheduler gets shutdown, this may be run after. | 76 // Note if the scheduler gets shutdown, this may be run after. |
| 77 class Scheduler::MainThreadPendingIdleTaskRunner : public WebThread::Task { | 77 class Scheduler::MainThreadPendingIdleTaskRunner : public WebThread::Task { |
| 78 public: | 78 public: |
| 79 MainThreadPendingIdleTaskRunner() | 79 MainThreadPendingIdleTaskRunner() |
| 80 { | 80 { |
| 81 ASSERT(Scheduler::shared()); | 81 ASSERT(Scheduler::shared()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // WebThread::Task implementation. | 84 // WebThread::Task implementation. |
| 85 virtual void run() OVERRIDE | 85 virtual void run() override |
| 86 { | 86 { |
| 87 if (Scheduler* scheduler = Scheduler::shared()) { | 87 if (Scheduler* scheduler = Scheduler::shared()) { |
| 88 scheduler->maybeRunPendingIdleTask(); | 88 scheduler->maybeRunPendingIdleTask(); |
| 89 // If possible, run the next idle task by reposting on the main thre
ad. | 89 // If possible, run the next idle task by reposting on the main thre
ad. |
| 90 scheduler->maybePostMainThreadPendingIdleTask(); | 90 scheduler->maybePostMainThreadPendingIdleTask(); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 }; | 94 }; |
| 95 | 95 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 { | 311 { |
| 312 ASSERT(m_policyStateMutex.locked()); | 312 ASSERT(m_policyStateMutex.locked()); |
| 313 if (schedulerPolicy == CompositorPriority) | 313 if (schedulerPolicy == CompositorPriority) |
| 314 m_compositorPriorityPolicyEndTimeSeconds = Platform::current()->monotoni
callyIncreasingTime() + kLowSchedulerPolicyAfterTouchTimeSeconds; | 314 m_compositorPriorityPolicyEndTimeSeconds = Platform::current()->monotoni
callyIncreasingTime() + kLowSchedulerPolicyAfterTouchTimeSeconds; |
| 315 | 315 |
| 316 releaseStore(&m_schedulerPolicy, schedulerPolicy); | 316 releaseStore(&m_schedulerPolicy, schedulerPolicy); |
| 317 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "SchedulerPolic
y", schedulerPolicy); | 317 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "SchedulerPolic
y", schedulerPolicy); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |