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

Side by Side Diff: components/scheduler/child/scheduler_helper.h

Issue 1898233002: Report expected task queueing time via UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove export. Fix windows. Created 4 years, 5 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 COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_
6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ 6 #define COMPONENTS_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 "components/scheduler/base/task_queue_manager.h"
13 #include "components/scheduler/base/task_queue_selector.h" 13 #include "components/scheduler/base/task_queue_selector.h"
14 #include "components/scheduler/scheduler_export.h" 14 #include "components/scheduler/scheduler_export.h"
15 15
16 namespace base { 16 namespace base {
17 class TickClock; 17 class TickClock;
18 } 18 }
19 19
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 : public TaskQueueManager::Observer { 25 class SCHEDULER_EXPORT SchedulerHelper
26 : public TaskQueueManager::Observer {
26 public: 27 public:
27 // Category strings must have application lifetime (statics or 28 // Category strings must have application lifetime (statics or
28 // literals). They may not include " chars. 29 // literals). They may not include " chars.
29 SchedulerHelper( 30 SchedulerHelper(
30 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate, 31 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate,
31 const char* tracing_category, 32 const char* tracing_category,
32 const char* disabled_by_default_tracing_category, 33 const char* disabled_by_default_tracing_category,
33 const char* disabled_by_default_verbose_tracing_category); 34 const char* disabled_by_default_verbose_tracing_category);
34 ~SchedulerHelper() override; 35 ~SchedulerHelper() override;
35 36
(...skipping 14 matching lines...) Expand all
50 // are executed with the highest priority but do not cause the scheduler to 51 // are executed with the highest priority but do not cause the scheduler to
51 // wake up. Care must be taken to avoid starvation of other task queues. 52 // wake up. Care must be taken to avoid starvation of other task queues.
52 scoped_refptr<TaskQueue> ControlAfterWakeUpTaskRunner(); 53 scoped_refptr<TaskQueue> ControlAfterWakeUpTaskRunner();
53 54
54 // Adds or removes a task observer from the scheduler. The observer will be 55 // Adds or removes a task observer from the scheduler. The observer will be
55 // notified before and after every executed task. These functions can only be 56 // notified before and after every executed task. These functions can only be
56 // called on the thread this class was created on. 57 // called on the thread this class was created on.
57 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); 58 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer);
58 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); 59 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer);
59 60
61 void SetTaskTimeTracker(TaskTimeTracker* task_time_tracker) {
62 if (task_queue_manager_)
63 task_queue_manager_->SetTaskTimeTracker(task_time_tracker);
64 }
65
60 // Shuts down the scheduler by dropping any remaining pending work in the work 66 // Shuts down the scheduler by dropping any remaining pending work in the work
61 // queues. After this call any work posted to the task runners will be 67 // queues. After this call any work posted to the task runners will be
62 // silently dropped. 68 // silently dropped.
63 void Shutdown(); 69 void Shutdown();
64 70
65 // Returns true if Shutdown() has been called. Otherwise returns false. 71 // Returns true if Shutdown() has been called. Otherwise returns false.
66 bool IsShutdown() const { return !task_queue_manager_.get(); } 72 bool IsShutdown() const { return !task_queue_manager_.get(); }
67 73
68 void CheckOnValidThread() const { 74 void CheckOnValidThread() const {
69 DCHECK(thread_checker_.CalledOnValidThread()); 75 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 Observer* observer_; // NOT OWNED 122 Observer* observer_; // NOT OWNED
117 const char* tracing_category_; 123 const char* tracing_category_;
118 const char* disabled_by_default_tracing_category_; 124 const char* disabled_by_default_tracing_category_;
119 125
120 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); 126 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper);
121 }; 127 };
122 128
123 } // namespace scheduler 129 } // namespace scheduler
124 130
125 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ 131 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_
OLDNEW
« no previous file with comments | « components/scheduler/base/time_domain_unittest.cc ('k') | components/scheduler/child/scheduler_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698