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

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

Issue 1447563002: Implement frame attribution (FrameBlamer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make sure blame context is initialized early enough Created 4 years, 8 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 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 COMPONENTS_SCHEDULER_CHILD_SINGLE_THREAD_IDLE_TASK_RUNNER_H_ 5 #ifndef COMPONENTS_SCHEDULER_CHILD_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
6 #define COMPONENTS_SCHEDULER_CHILD_SINGLE_THREAD_IDLE_TASK_RUNNER_H_ 6 #define COMPONENTS_SCHEDULER_CHILD_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/trace_event/trace_event.h"
14 #include "components/scheduler/scheduler_export.h" 15 #include "components/scheduler/scheduler_export.h"
15 16
17 namespace base {
18 namespace trace_event {
19 class BlameContext;
20 }
21 }
22
16 namespace scheduler { 23 namespace scheduler {
17 24
18 // A SingleThreadIdleTaskRunner is a task runner for running idle tasks. Idle 25 // A SingleThreadIdleTaskRunner is a task runner for running idle tasks. Idle
19 // tasks have an unbound argument which is bound to a deadline 26 // tasks have an unbound argument which is bound to a deadline
20 // (in base::TimeTicks) when they are run. The idle task is expected to 27 // (in base::TimeTicks) when they are run. The idle task is expected to
21 // complete by this deadline. 28 // complete by this deadline.
22 class SingleThreadIdleTaskRunner 29 class SingleThreadIdleTaskRunner
23 : public base::RefCountedThreadSafe<SingleThreadIdleTaskRunner> { 30 : public base::RefCountedThreadSafe<SingleThreadIdleTaskRunner> {
24 public: 31 public:
25 typedef base::Callback<void(base::TimeTicks)> IdleTask; 32 typedef base::Callback<void(base::TimeTicks)> IdleTask;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 virtual void PostNonNestableIdleTask( 67 virtual void PostNonNestableIdleTask(
61 const tracked_objects::Location& from_here, 68 const tracked_objects::Location& from_here,
62 const IdleTask& idle_task); 69 const IdleTask& idle_task);
63 70
64 virtual void PostIdleTaskAfterWakeup( 71 virtual void PostIdleTaskAfterWakeup(
65 const tracked_objects::Location& from_here, 72 const tracked_objects::Location& from_here,
66 const IdleTask& idle_task); 73 const IdleTask& idle_task);
67 74
68 bool RunsTasksOnCurrentThread() const; 75 bool RunsTasksOnCurrentThread() const;
69 76
77 void SetBlameContext(base::trace_event::BlameContext* blame_context);
78
70 protected: 79 protected:
71 virtual ~SingleThreadIdleTaskRunner(); 80 virtual ~SingleThreadIdleTaskRunner();
72 81
73 private: 82 private:
74 friend class base::RefCountedThreadSafe<SingleThreadIdleTaskRunner>; 83 friend class base::RefCountedThreadSafe<SingleThreadIdleTaskRunner>;
75 84
76 void RunTask(IdleTask idle_task); 85 void RunTask(IdleTask idle_task);
77 86
78 scoped_refptr<base::SingleThreadTaskRunner> idle_priority_task_runner_; 87 scoped_refptr<base::SingleThreadTaskRunner> idle_priority_task_runner_;
79 scoped_refptr<base::SingleThreadTaskRunner> after_wakeup_task_runner_; 88 scoped_refptr<base::SingleThreadTaskRunner> after_wakeup_task_runner_;
80 Delegate* delegate_; // NOT OWNED 89 Delegate* delegate_; // NOT OWNED
81 const char* tracing_category_; 90 const char* tracing_category_;
91 base::trace_event::BlameContext* blame_context_; // Not owned.
82 base::WeakPtr<SingleThreadIdleTaskRunner> weak_scheduler_ptr_; 92 base::WeakPtr<SingleThreadIdleTaskRunner> weak_scheduler_ptr_;
83 base::WeakPtrFactory<SingleThreadIdleTaskRunner> weak_factory_; 93 base::WeakPtrFactory<SingleThreadIdleTaskRunner> weak_factory_;
84 DISALLOW_COPY_AND_ASSIGN(SingleThreadIdleTaskRunner); 94 DISALLOW_COPY_AND_ASSIGN(SingleThreadIdleTaskRunner);
85 }; 95 };
86 96
87 } // namespace scheduler 97 } // namespace scheduler
88 98
89 #endif // COMPONENTS_SCHEDULER_CHILD_SINGLE_THREAD_IDLE_TASK_RUNNER_H_ 99 #endif // COMPONENTS_SCHEDULER_CHILD_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698