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: sky/engine/testing/platform/webthread_impl.h

Issue 673033002: Remove WebThread (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 SKY_ENGINE_TESTING_PLATFORM__WEBTHREAD_IMPL_H_
6 #define SKY_ENGINE_TESTING_PLATFORM__WEBTHREAD_IMPL_H_
7
8 #include <map>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread.h"
12 #include "sky/engine/public/platform/WebThread.h"
13
14 namespace sky {
15
16 class WebThreadBase : public blink::WebThread {
17 public:
18 virtual ~WebThreadBase();
19
20 virtual void addTaskObserver(TaskObserver* observer);
21 virtual void removeTaskObserver(TaskObserver* observer);
22
23 virtual bool isCurrentThread() const = 0;
24 virtual blink::PlatformThreadId threadId() const = 0;
25
26 protected:
27 WebThreadBase();
28
29 private:
30 class TaskObserverAdapter;
31
32 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap;
33 TaskObserverMap task_observer_map_;
34 };
35
36 class WebThreadImpl : public WebThreadBase {
37 public:
38 explicit WebThreadImpl(const char* name);
39 virtual ~WebThreadImpl();
40
41 virtual void postTask(Task* task);
42 virtual void postDelayedTask(Task* task, long long delay_ms);
43
44 virtual void enterRunLoop();
45 virtual void exitRunLoop();
46
47 base::MessageLoop* message_loop() const { return thread_->message_loop(); }
48
49 virtual bool isCurrentThread() const;
50 virtual blink::PlatformThreadId threadId() const;
51
52 private:
53 scoped_ptr<base::Thread> thread_;
54 };
55
56 class WebThreadImplForMessageLoop : public WebThreadBase {
57 public:
58 explicit WebThreadImplForMessageLoop(
59 base::MessageLoopProxy* message_loop);
60 virtual ~WebThreadImplForMessageLoop();
61
62 virtual void postTask(Task* task);
63 virtual void postDelayedTask(Task* task, long long delay_ms);
64
65 virtual void enterRunLoop();
66 virtual void exitRunLoop();
67
68 private:
69 virtual bool isCurrentThread() const;
70 virtual blink::PlatformThreadId threadId() const;
71
72 scoped_refptr<base::MessageLoopProxy> message_loop_;
73 blink::PlatformThreadId thread_id_;
74 };
75
76 } // namespace sky
77
78 #endif // SKY_ENGINE_TESTING_PLATFORM__WEBTHREAD_IMPL_H_
OLDNEW
« no previous file with comments | « sky/engine/testing/platform/platform_impl.cc ('k') | sky/engine/testing/platform/webthread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698