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

Side by Side Diff: content/child/webthread_base.h

Issue 1088933002: Revert of Add a WorkerScheduler and a WebThreadImplForWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/child/threaded_data_provider.cc ('k') | content/child/webthread_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WEBTHREAD_BASE_H_
6 #define CONTENT_CHILD_WEBTHREAD_BASE_H_
7
8 #include <map>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread.h"
12 #include "content/common/content_export.h"
13 #include "third_party/WebKit/public/platform/WebThread.h"
14
15 namespace blink {
16 class WebTraceLocation;
17 }
18
19 namespace content {
20 class SingleThreadIdleTaskRunner;
21
22 class CONTENT_EXPORT WebThreadBase : public blink::WebThread {
23 public:
24 virtual ~WebThreadBase();
25
26 // blink::WebThread implementation.
27 virtual bool isCurrentThread() const;
28 virtual blink::PlatformThreadId threadId() const = 0;
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,
35 IdleTask* idle_task);
36 virtual void postIdleTaskAfterWakeup(const blink::WebTraceLocation& location,
37 IdleTask* idle_task);
38
39 virtual void enterRunLoop();
40 virtual void exitRunLoop();
41
42 virtual void addTaskObserver(TaskObserver* observer);
43 virtual void removeTaskObserver(TaskObserver* observer);
44
45 // Returns the base::Bind-compatible task runner for posting tasks to this
46 // thread. Can be called from any thread.
47 virtual base::SingleThreadTaskRunner* TaskRunner() const = 0;
48
49 // Returns the base::Bind-compatible task runner for posting idle tasks to
50 // this thread. Can be called from any thread.
51 virtual SingleThreadIdleTaskRunner* IdleTaskRunner() const = 0;
52
53 protected:
54 class TaskObserverAdapter;
55
56 WebThreadBase();
57
58 // Returns the underlying MessageLoop for this thread. Only used for entering
59 // and exiting a nested run loop. Only called on the thread that the
60 // WebThread belongs to.
61 virtual base::MessageLoop* MessageLoop() const = 0;
62
63 virtual void AddTaskObserverInternal(
64 base::MessageLoop::TaskObserver* observer);
65 virtual void RemoveTaskObserverInternal(
66 base::MessageLoop::TaskObserver* observer);
67
68 static void RunWebThreadTask(scoped_ptr<blink::WebThread::Task> task);
69 static void RunWebThreadIdleTask(
70 scoped_ptr<blink::WebThread::IdleTask> idle_task,
71 base::TimeTicks deadline);
72
73 private:
74 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap;
75 TaskObserverMap task_observer_map_;
76 };
77
78 } // namespace content
79
80 #endif // CONTENT_CHILD_WEBTHREAD_BASE_H_
OLDNEW
« no previous file with comments | « content/child/threaded_data_provider.cc ('k') | content/child/webthread_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698