| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef WEBKIT_GLUE_WEBTHREAD_IMPL_H_ | 4 #ifndef WEBKIT_GLUE_WEBTHREAD_IMPL_H_ |
| 5 #define WEBKIT_GLUE_WEBTHREAD_IMPL_H_ | 5 #define WEBKIT_GLUE_WEBTHREAD_IMPL_H_ |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "base/message_loop.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebThread.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebThread.h" |
| 12 #include "webkit/glue/webkit_glue_export.h" | 13 #include "webkit/glue/webkit_glue_export.h" |
| 13 | 14 |
| 14 namespace webkit_glue { | 15 namespace webkit_glue { |
| 15 | 16 |
| 16 class WebThreadBase : public WebKit::WebThread { | 17 class WebThreadBase : public WebKit::WebThread { |
| 17 public: | 18 public: |
| 18 virtual ~WebThreadBase(); | 19 virtual ~WebThreadBase(); |
| 19 | 20 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 class WebThreadImpl : public WebThreadBase { | 36 class WebThreadImpl : public WebThreadBase { |
| 36 public: | 37 public: |
| 37 WEBKIT_GLUE_EXPORT explicit WebThreadImpl(const char* name); | 38 WEBKIT_GLUE_EXPORT explicit WebThreadImpl(const char* name); |
| 38 WEBKIT_GLUE_EXPORT virtual ~WebThreadImpl(); | 39 WEBKIT_GLUE_EXPORT virtual ~WebThreadImpl(); |
| 39 | 40 |
| 40 virtual void postTask(Task* task) OVERRIDE; | 41 virtual void postTask(Task* task) OVERRIDE; |
| 41 virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE; | 42 virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE; |
| 42 | 43 |
| 44 virtual void enterRunLoop(); |
| 45 virtual void exitRunLoop(); |
| 46 |
| 43 MessageLoop* message_loop() const { return thread_->message_loop(); } | 47 MessageLoop* message_loop() const { return thread_->message_loop(); } |
| 44 | 48 |
| 45 private: | 49 private: |
| 46 virtual bool IsCurrentThread() const OVERRIDE; | 50 virtual bool IsCurrentThread() const OVERRIDE; |
| 47 scoped_ptr<base::Thread> thread_; | 51 scoped_ptr<base::Thread> thread_; |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 class WebThreadImplForMessageLoop : public WebThreadBase { | 54 class WebThreadImplForMessageLoop : public WebThreadBase { |
| 51 public: | 55 public: |
| 52 explicit WebThreadImplForMessageLoop(base::MessageLoopProxy* message_loop); | 56 WebThreadImplForMessageLoop(MessageLoop* message_loop, |
| 57 base::PlatformThreadId thread_id); |
| 53 virtual ~WebThreadImplForMessageLoop(); | 58 virtual ~WebThreadImplForMessageLoop(); |
| 54 | 59 |
| 55 virtual void postTask(Task* task) OVERRIDE; | 60 virtual void postTask(Task* task) OVERRIDE; |
| 56 virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE; | 61 virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE; |
| 57 | 62 |
| 63 virtual void enterRunLoop(); |
| 64 virtual void exitRunLoop(); |
| 65 |
| 58 private: | 66 private: |
| 59 virtual bool IsCurrentThread() const OVERRIDE; | 67 virtual bool IsCurrentThread() const OVERRIDE; |
| 60 scoped_refptr<base::MessageLoopProxy> message_loop_; | 68 MessageLoop* message_loop_; |
| 69 base::PlatformThreadId thread_id_; |
| 61 }; | 70 }; |
| 62 | 71 |
| 63 } // namespace webkit_glue | 72 } // namespace webkit_glue |
| 64 | 73 |
| 65 #endif | 74 #endif |
| OLD | NEW |