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

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

Issue 1058873010: Move blink scheduler implementation into a component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_CHILD_SCHEDULER_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
6 #define CONTENT_CHILD_SCHEDULER_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
7
8 #include "base/bind.h"
9 #include "base/callback.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/time/time.h"
13
14 namespace content {
15
16 // A SingleThreadIdleTaskRunner is a task runner for running idle tasks. Idle
17 // tasks have an unbound argument which is bound to a deadline
18 // (in base::TimeTicks) when they are run. The idle task is expected to
19 // complete by this deadline.
20 class SingleThreadIdleTaskRunner
21 : public base::RefCountedThreadSafe<SingleThreadIdleTaskRunner> {
22 public:
23 typedef base::Callback<void(base::TimeTicks)> IdleTask;
24
25 // NOTE Category strings must have application lifetime (statics or
26 // literals). They may not include " chars.
27 SingleThreadIdleTaskRunner(
28 scoped_refptr<base::SingleThreadTaskRunner> idle_priority_task_runner,
29 scoped_refptr<base::SingleThreadTaskRunner> after_wakeup_task_runner,
30 base::Callback<void(base::TimeTicks*)> deadline_supplier,
31 const char* tracing_category);
32
33 virtual void PostIdleTask(const tracked_objects::Location& from_here,
34 const IdleTask& idle_task);
35
36 virtual void PostNonNestableIdleTask(
37 const tracked_objects::Location& from_here,
38 const IdleTask& idle_task);
39
40 virtual void PostIdleTaskAfterWakeup(
41 const tracked_objects::Location& from_here,
42 const IdleTask& idle_task);
43
44 bool RunsTasksOnCurrentThread() const;
45
46 protected:
47 virtual ~SingleThreadIdleTaskRunner();
48
49 private:
50 friend class base::RefCountedThreadSafe<SingleThreadIdleTaskRunner>;
51
52 void RunTask(IdleTask idle_task);
53
54 scoped_refptr<base::SingleThreadTaskRunner> idle_priority_task_runner_;
55 scoped_refptr<base::SingleThreadTaskRunner> after_wakeup_task_runner_;
56 base::Callback<void(base::TimeTicks*)> deadline_supplier_;
57 const char* tracing_category_;
58 base::WeakPtr<SingleThreadIdleTaskRunner> weak_scheduler_ptr_;
59 base::WeakPtrFactory<SingleThreadIdleTaskRunner> weak_factory_;
60 DISALLOW_COPY_AND_ASSIGN(SingleThreadIdleTaskRunner);
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_CHILD_SCHEDULER_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « content/child/scheduler/scheduler_message_loop_delegate.cc ('k') | content/child/scheduler/single_thread_idle_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698