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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/child/scheduler_helper.h

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

Powered by Google App Engine
This is Rietveld 408576698