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

Side by Side Diff: mojo/services/html_viewer/webthread_impl.h

Issue 515243002: Expose platform thread id on blink::WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « content/child/webthread_impl.cc ('k') | mojo/services/html_viewer/webthread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 MOJO_SERVICES_HTML_VIEWER_WEBTHREAD_IMPL_H_ 5 #ifndef MOJO_SERVICES_HTML_VIEWER_WEBTHREAD_IMPL_H_
6 #define MOJO_SERVICES_HTML_VIEWER_WEBTHREAD_IMPL_H_ 6 #define MOJO_SERVICES_HTML_VIEWER_WEBTHREAD_IMPL_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 "third_party/WebKit/public/platform/WebThread.h" 12 #include "third_party/WebKit/public/platform/WebThread.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 15
16 class WebThreadBase : public blink::WebThread { 16 class WebThreadBase : public blink::WebThread {
17 public: 17 public:
18 virtual ~WebThreadBase(); 18 virtual ~WebThreadBase();
19 19
20 virtual void addTaskObserver(TaskObserver* observer); 20 virtual void addTaskObserver(TaskObserver* observer);
21 virtual void removeTaskObserver(TaskObserver* observer); 21 virtual void removeTaskObserver(TaskObserver* observer);
22 22
23 virtual bool isCurrentThread() const = 0; 23 virtual bool isCurrentThread() const = 0;
24 virtual blink::PlatformThreadId threadId() const = 0;
24 25
25 protected: 26 protected:
26 WebThreadBase(); 27 WebThreadBase();
27 28
28 private: 29 private:
29 class TaskObserverAdapter; 30 class TaskObserverAdapter;
30 31
31 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap; 32 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap;
32 TaskObserverMap task_observer_map_; 33 TaskObserverMap task_observer_map_;
33 }; 34 };
34 35
35 class WebThreadImpl : public WebThreadBase { 36 class WebThreadImpl : public WebThreadBase {
36 public: 37 public:
37 explicit WebThreadImpl(const char* name); 38 explicit WebThreadImpl(const char* name);
38 virtual ~WebThreadImpl(); 39 virtual ~WebThreadImpl();
39 40
40 virtual void postTask(Task* task); 41 virtual void postTask(Task* task);
41 virtual void postDelayedTask(Task* task, long long delay_ms); 42 virtual void postDelayedTask(Task* task, long long delay_ms);
42 43
43 virtual void enterRunLoop(); 44 virtual void enterRunLoop();
44 virtual void exitRunLoop(); 45 virtual void exitRunLoop();
45 46
46 base::MessageLoop* message_loop() const { return thread_->message_loop(); } 47 base::MessageLoop* message_loop() const { return thread_->message_loop(); }
47 48
48 virtual bool isCurrentThread() const; 49 virtual bool isCurrentThread() const;
50 virtual blink::PlatformThreadId threadId() const;
49 51
50 private: 52 private:
51 scoped_ptr<base::Thread> thread_; 53 scoped_ptr<base::Thread> thread_;
52 }; 54 };
53 55
54 class WebThreadImplForMessageLoop : public WebThreadBase { 56 class WebThreadImplForMessageLoop : public WebThreadBase {
55 public: 57 public:
56 explicit WebThreadImplForMessageLoop( 58 explicit WebThreadImplForMessageLoop(
57 base::MessageLoopProxy* message_loop); 59 base::MessageLoopProxy* message_loop);
58 virtual ~WebThreadImplForMessageLoop(); 60 virtual ~WebThreadImplForMessageLoop();
59 61
60 virtual void postTask(Task* task); 62 virtual void postTask(Task* task);
61 virtual void postDelayedTask(Task* task, long long delay_ms); 63 virtual void postDelayedTask(Task* task, long long delay_ms);
62 64
63 virtual void enterRunLoop(); 65 virtual void enterRunLoop();
64 virtual void exitRunLoop(); 66 virtual void exitRunLoop();
65 67
66 private: 68 private:
67 virtual bool isCurrentThread() const; 69 virtual bool isCurrentThread() const;
70 virtual blink::PlatformThreadId threadId() const;
71
68 scoped_refptr<base::MessageLoopProxy> message_loop_; 72 scoped_refptr<base::MessageLoopProxy> message_loop_;
73 blink::PlatformThreadId thread_id_;
69 }; 74 };
70 75
71 } // namespace mojo 76 } // namespace mojo
72 77
73 #endif // MOJO_SERVICES_HTML_VIEWER_WEBTHREAD_IMPL_H_ 78 #endif // MOJO_SERVICES_HTML_VIEWER_WEBTHREAD_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/webthread_impl.cc ('k') | mojo/services/html_viewer/webthread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698