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

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

Issue 664963002: content: Add RendererScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Daniel and Jared's comments and move renderer_scheduler ownership to render_thread_impl Created 6 years, 1 month 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_RENDERER_SCHEDULER_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
6 #define CONTENT_RENDERER_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/memory/weak_ptr.h"
no sievers 2014/11/04 20:41:41 nit: unneeded
rmcilroy 2014/11/05 00:34:01 Done.
12 #include "base/single_thread_task_runner.h"
13 #include "base/time/time.h"
14
15 namespace content {
16
17 // A SingleThreadIdleTaskRunner is a task runner for running idle tasks. Idle
18 // tasks have an unbound argument which is bound to a deadline
19 // (in base::TimeTicks) when they are run. The idle task is expected to
20 // complete by this deadline.
21 class SingleThreadIdleTaskRunner
22 : public base::RefCountedThreadSafe<SingleThreadIdleTaskRunner> {
23 public:
24 typedef base::Callback<void(base::TimeTicks)> IdleTask;
25
26 SingleThreadIdleTaskRunner(
27 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
28 base::Callback<void(base::TimeTicks*)> deadline_supplier);
29
30 virtual void PostIdleTask(const tracked_objects::Location& from_here,
31 const IdleTask& idle_task);
32
33 bool RunsTasksOnCurrentThread() const;
34
35 protected:
36 virtual ~SingleThreadIdleTaskRunner();
37
38 private:
39 friend class base::RefCountedThreadSafe<SingleThreadIdleTaskRunner>;
40
41 void RunTask(IdleTask idle_task);
42
43 scoped_refptr<base::TaskRunner> task_runner_;
44 base::Callback<void(base::TimeTicks*)> deadline_supplier_;
no sievers 2014/11/04 20:41:41 nit: DISALLOW_COPY_AND_ASSIGN
rmcilroy 2014/11/05 00:34:01 Done.
45 };
46
47 } // namespace content
48
49 #endif // CONTENT_RENDERER_SCHEDULER_SINGLE_THREAD_IDLE_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698