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

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

Issue 1309423004: Introduce WebTaskRunner Patch 4/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try and fix compile Created 5 years, 3 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_WEBTHREAD_BASE_H_ 5 #ifndef COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_BASE_H_
6 #define COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_BASE_H_ 6 #define COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_BASE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "components/scheduler/scheduler_export.h" 12 #include "components/scheduler/scheduler_export.h"
13 #include "third_party/WebKit/public/platform/WebThread.h" 13 #include "third_party/WebKit/public/platform/WebThread.h"
14 14
15 namespace blink { 15 namespace blink {
16 class WebTraceLocation; 16 class WebTraceLocation;
17 } 17 }
18 18
19 namespace scheduler { 19 namespace scheduler {
20 class SingleThreadIdleTaskRunner; 20 class SingleThreadIdleTaskRunner;
21 21
22 class SCHEDULER_EXPORT WebThreadBase : public blink::WebThread { 22 class SCHEDULER_EXPORT WebThreadBase : public blink::WebThread {
23 public: 23 public:
24 virtual ~WebThreadBase(); 24 virtual ~WebThreadBase();
25 25
26 // blink::WebThread implementation. 26 // blink::WebThread implementation.
27 virtual bool isCurrentThread() const; 27 virtual bool isCurrentThread() const;
28 virtual blink::PlatformThreadId threadId() const = 0; 28 virtual blink::PlatformThreadId threadId() const = 0;
29 29
30 virtual void postTask(const blink::WebTraceLocation& location, Task* task);
31 virtual void postDelayedTask(const blink::WebTraceLocation& location,
32 Task* task,
33 long long delay_ms);
34 virtual void postIdleTask(const blink::WebTraceLocation& location, 30 virtual void postIdleTask(const blink::WebTraceLocation& location,
35 IdleTask* idle_task); 31 IdleTask* idle_task);
36 virtual void postIdleTaskAfterWakeup(const blink::WebTraceLocation& location, 32 virtual void postIdleTaskAfterWakeup(const blink::WebTraceLocation& location,
37 IdleTask* idle_task); 33 IdleTask* idle_task);
38 34
39 virtual void addTaskObserver(TaskObserver* observer); 35 virtual void addTaskObserver(TaskObserver* observer);
40 virtual void removeTaskObserver(TaskObserver* observer); 36 virtual void removeTaskObserver(TaskObserver* observer);
41 37
42 // Returns the base::Bind-compatible task runner for posting tasks to this 38 // Returns the base::Bind-compatible task runner for posting tasks to this
43 // thread. Can be called from any thread. 39 // thread. Can be called from any thread.
44 virtual base::SingleThreadTaskRunner* TaskRunner() const = 0; 40 virtual base::SingleThreadTaskRunner* TaskRunner() const = 0;
45 41
46 // Returns the base::Bind-compatible task runner for posting idle tasks to 42 // Returns the base::Bind-compatible task runner for posting idle tasks to
47 // this thread. Can be called from any thread. 43 // this thread. Can be called from any thread.
48 virtual scheduler::SingleThreadIdleTaskRunner* IdleTaskRunner() const = 0; 44 virtual scheduler::SingleThreadIdleTaskRunner* IdleTaskRunner() const = 0;
49 45
50 protected: 46 protected:
51 class TaskObserverAdapter; 47 class TaskObserverAdapter;
52 48
53 WebThreadBase(); 49 WebThreadBase();
54 50
55 virtual void AddTaskObserverInternal( 51 virtual void AddTaskObserverInternal(
56 base::MessageLoop::TaskObserver* observer); 52 base::MessageLoop::TaskObserver* observer);
57 virtual void RemoveTaskObserverInternal( 53 virtual void RemoveTaskObserverInternal(
58 base::MessageLoop::TaskObserver* observer); 54 base::MessageLoop::TaskObserver* observer);
59 55
60 static void RunWebThreadTask(scoped_ptr<blink::WebThread::Task> task);
61 static void RunWebThreadIdleTask( 56 static void RunWebThreadIdleTask(
62 scoped_ptr<blink::WebThread::IdleTask> idle_task, 57 scoped_ptr<blink::WebThread::IdleTask> idle_task,
63 base::TimeTicks deadline); 58 base::TimeTicks deadline);
64 59
65 private: 60 private:
66 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap; 61 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap;
67 TaskObserverMap task_observer_map_; 62 TaskObserverMap task_observer_map_;
68 }; 63 };
69 64
70 } // namespace scheduler 65 } // namespace scheduler
71 66
72 #endif // COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_BASE_H_ 67 #endif // COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_BASE_H_
OLDNEW
« no previous file with comments | « components/scheduler/child/web_scheduler_impl.cc ('k') | components/scheduler/child/webthread_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698