| OLD | NEW |
| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
| 12 #include "platform/scheduler/base/task_queue_manager.h" | 12 #include "platform/scheduler/base/task_queue_manager.h" |
| 13 #include "platform/scheduler/base/task_queue_selector.h" | 13 #include "platform/scheduler/base/task_queue_selector.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 namespace scheduler { | 16 namespace scheduler { |
| 17 | 17 |
| 18 class SchedulerTqmDelegate; | 18 class SchedulerTqmDelegate; |
| 19 | 19 |
| 20 // Common scheduler functionality for default tasks. | 20 // Common scheduler functionality for default tasks. |
| 21 class BLINK_PLATFORM_EXPORT SchedulerHelper | 21 class PLATFORM_EXPORT SchedulerHelper : public TaskQueueManager::Observer { |
| 22 : public TaskQueueManager::Observer { | |
| 23 public: | 22 public: |
| 24 // Category strings must have application lifetime (statics or | 23 // Category strings must have application lifetime (statics or |
| 25 // literals). They may not include " chars. | 24 // literals). They may not include " chars. |
| 26 SchedulerHelper( | 25 SchedulerHelper( |
| 27 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate, | 26 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate, |
| 28 const char* tracing_category, | 27 const char* tracing_category, |
| 29 const char* disabled_by_default_tracing_category, | 28 const char* disabled_by_default_tracing_category, |
| 30 const char* disabled_by_default_verbose_tracing_category); | 29 const char* disabled_by_default_verbose_tracing_category); |
| 31 SchedulerHelper( | 30 SchedulerHelper( |
| 32 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate, | 31 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // Returns true if Shutdown() has been called. Otherwise returns false. | 69 // Returns true if Shutdown() has been called. Otherwise returns false. |
| 71 bool IsShutdown() const { return !task_queue_manager_.get(); } | 70 bool IsShutdown() const { return !task_queue_manager_.get(); } |
| 72 | 71 |
| 73 inline void CheckOnValidThread() const { | 72 inline void CheckOnValidThread() const { |
| 74 DCHECK(thread_checker_.CalledOnValidThread()); | 73 DCHECK(thread_checker_.CalledOnValidThread()); |
| 75 } | 74 } |
| 76 | 75 |
| 77 // Creates a new TaskQueue with the given |spec|. | 76 // Creates a new TaskQueue with the given |spec|. |
| 78 scoped_refptr<TaskQueue> NewTaskQueue(const TaskQueue::Spec& spec); | 77 scoped_refptr<TaskQueue> NewTaskQueue(const TaskQueue::Spec& spec); |
| 79 | 78 |
| 80 class BLINK_PLATFORM_EXPORT Observer { | 79 class PLATFORM_EXPORT Observer { |
| 81 public: | 80 public: |
| 82 virtual ~Observer() {} | 81 virtual ~Observer() {} |
| 83 | 82 |
| 84 // Called when |queue| is unregistered. | 83 // Called when |queue| is unregistered. |
| 85 virtual void OnUnregisterTaskQueue( | 84 virtual void OnUnregisterTaskQueue( |
| 86 const scoped_refptr<TaskQueue>& queue) = 0; | 85 const scoped_refptr<TaskQueue>& queue) = 0; |
| 87 | 86 |
| 88 // Called when the scheduler tried to execute a task from a disabled | 87 // Called when the scheduler tried to execute a task from a disabled |
| 89 // queue. See TaskQueue::Spec::SetShouldReportWhenExecutionBlocked. | 88 // queue. See TaskQueue::Spec::SetShouldReportWhenExecutionBlocked. |
| 90 virtual void OnTriedToExecuteBlockedTask(const TaskQueue& queue, | 89 virtual void OnTriedToExecuteBlockedTask(const TaskQueue& queue, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 const char* tracing_category_; | 125 const char* tracing_category_; |
| 127 const char* disabled_by_default_tracing_category_; | 126 const char* disabled_by_default_tracing_category_; |
| 128 | 127 |
| 129 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 128 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 } // namespace scheduler | 131 } // namespace scheduler |
| 133 } // namespace blink | 132 } // namespace blink |
| 134 | 133 |
| 135 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ | 134 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ |
| OLD | NEW |