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

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

Issue 869573005: Implement posting location tracking in WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward decl Created 5 years, 11 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 | « no previous file | content/child/webthread_impl.cc » ('j') | content/child/webthread_impl.cc » ('J')
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 CONTENT_CHILD_WEBTHREAD_IMPL_H_ 5 #ifndef CONTENT_CHILD_WEBTHREAD_IMPL_H_
6 #define CONTENT_CHILD_WEBTHREAD_IMPL_H_ 6 #define CONTENT_CHILD_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 "content/common/content_export.h" 12 #include "content/common/content_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 {
16 class WebTraceLocation;
17 }
18
15 namespace content { 19 namespace content {
16 20
17 class CONTENT_EXPORT WebThreadBase : public blink::WebThread { 21 class CONTENT_EXPORT WebThreadBase : public blink::WebThread {
18 public: 22 public:
19 virtual ~WebThreadBase(); 23 virtual ~WebThreadBase();
20 24
21 virtual void addTaskObserver(TaskObserver* observer); 25 virtual void addTaskObserver(TaskObserver* observer);
22 virtual void removeTaskObserver(TaskObserver* observer); 26 virtual void removeTaskObserver(TaskObserver* observer);
23 27
24 virtual bool isCurrentThread() const = 0; 28 virtual bool isCurrentThread() const = 0;
25 virtual blink::PlatformThreadId threadId() const = 0; 29 virtual blink::PlatformThreadId threadId() const = 0;
26 30
27 protected: 31 protected:
28 WebThreadBase(); 32 WebThreadBase();
29 33
30 private: 34 private:
31 class TaskObserverAdapter; 35 class TaskObserverAdapter;
32 36
33 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap; 37 typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap;
34 TaskObserverMap task_observer_map_; 38 TaskObserverMap task_observer_map_;
35 }; 39 };
36 40
37 class CONTENT_EXPORT WebThreadImpl : public WebThreadBase { 41 class CONTENT_EXPORT WebThreadImpl : public WebThreadBase {
38 public: 42 public:
39 explicit WebThreadImpl(const char* name); 43 explicit WebThreadImpl(const char* name);
40 virtual ~WebThreadImpl(); 44 virtual ~WebThreadImpl();
41 45
46 virtual void postTask(const blink::WebTraceLocation& location, Task* task);
47 virtual void postDelayedTask(const blink::WebTraceLocation& location,
48 Task* task,
49 long long delay_ms);
50
51 // TODO(skyostil): Remove once blink has migrated.
42 virtual void postTask(Task* task); 52 virtual void postTask(Task* task);
43 virtual void postDelayedTask(Task* task, long long delay_ms); 53 virtual void postDelayedTask(Task* task, long long delay_ms);
44 54
45 virtual void enterRunLoop(); 55 virtual void enterRunLoop();
46 virtual void exitRunLoop(); 56 virtual void exitRunLoop();
47 57
48 base::MessageLoop* message_loop() const { return thread_->message_loop(); } 58 base::MessageLoop* message_loop() const { return thread_->message_loop(); }
49 59
50 virtual bool isCurrentThread() const override; 60 virtual bool isCurrentThread() const override;
51 virtual blink::PlatformThreadId threadId() const override; 61 virtual blink::PlatformThreadId threadId() const override;
52 62
53 private: 63 private:
54 scoped_ptr<base::Thread> thread_; 64 scoped_ptr<base::Thread> thread_;
55 }; 65 };
56 66
57 class WebThreadImplForMessageLoop : public WebThreadBase { 67 class WebThreadImplForMessageLoop : public WebThreadBase {
58 public: 68 public:
59 CONTENT_EXPORT explicit WebThreadImplForMessageLoop( 69 CONTENT_EXPORT explicit WebThreadImplForMessageLoop(
60 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner); 70 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner);
61 CONTENT_EXPORT virtual ~WebThreadImplForMessageLoop(); 71 CONTENT_EXPORT virtual ~WebThreadImplForMessageLoop();
62 72
63 virtual void postTask(Task* task) override; 73 virtual void postTask(const blink::WebTraceLocation& location, Task* task);
64 virtual void postDelayedTask(Task* task, long long delay_ms) override; 74 virtual void postDelayedTask(const blink::WebTraceLocation& location,
75 Task* task,
76 long long delay_ms);
77
78 // TODO(skyostil): Remove once blink has migrated.
79 virtual void postTask(Task* task);
80 virtual void postDelayedTask(Task* task, long long delay_ms);
65 81
66 virtual void enterRunLoop() override; 82 virtual void enterRunLoop() override;
67 virtual void exitRunLoop() override; 83 virtual void exitRunLoop() override;
68 84
69 private: 85 private:
70 virtual bool isCurrentThread() const override; 86 virtual bool isCurrentThread() const override;
71 virtual blink::PlatformThreadId threadId() const override; 87 virtual blink::PlatformThreadId threadId() const override;
72 88
73 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 89 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
74 blink::PlatformThreadId thread_id_; 90 blink::PlatformThreadId thread_id_;
75 }; 91 };
76 92
77 } // namespace content 93 } // namespace content
78 94
79 #endif // CONTENT_CHILD_WEBTHREAD_IMPL_H_ 95 #endif // CONTENT_CHILD_WEBTHREAD_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/webthread_impl.cc » ('j') | content/child/webthread_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698