| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 JINGLE_GLUE_THREAD_WRAPPER_H_ | 5 #ifndef JINGLE_GLUE_THREAD_WRAPPER_H_ |
| 6 #define JINGLE_GLUE_THREAD_WRAPPER_H_ | 6 #define JINGLE_GLUE_THREAD_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual ~JingleThreadWrapper(); | 45 virtual ~JingleThreadWrapper(); |
| 46 | 46 |
| 47 // Sets whether the thread can be used to send messages | 47 // Sets whether the thread can be used to send messages |
| 48 // synchronously to another thread using Send() method. Set to false | 48 // synchronously to another thread using Send() method. Set to false |
| 49 // by default to avoid potential jankiness when Send() used on | 49 // by default to avoid potential jankiness when Send() used on |
| 50 // renderer thread. It should be set explicitly for threads that | 50 // renderer thread. It should be set explicitly for threads that |
| 51 // need to call Send() for other threads. | 51 // need to call Send() for other threads. |
| 52 void set_send_allowed(bool allowed) { send_allowed_ = allowed; } | 52 void set_send_allowed(bool allowed) { send_allowed_ = allowed; } |
| 53 | 53 |
| 54 // MessageLoop::DestructionObserver implementation. | 54 // MessageLoop::DestructionObserver implementation. |
| 55 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 55 virtual void WillDestroyCurrentMessageLoop() override; |
| 56 | 56 |
| 57 // rtc::MessageQueue overrides. | 57 // rtc::MessageQueue overrides. |
| 58 virtual void Post(rtc::MessageHandler *phandler, | 58 virtual void Post(rtc::MessageHandler *phandler, |
| 59 uint32 id, | 59 uint32 id, |
| 60 rtc::MessageData *pdata, | 60 rtc::MessageData *pdata, |
| 61 bool time_sensitive) OVERRIDE; | 61 bool time_sensitive) override; |
| 62 virtual void PostDelayed(int delay_ms, | 62 virtual void PostDelayed(int delay_ms, |
| 63 rtc::MessageHandler* handler, | 63 rtc::MessageHandler* handler, |
| 64 uint32 id, | 64 uint32 id, |
| 65 rtc::MessageData* data) OVERRIDE; | 65 rtc::MessageData* data) override; |
| 66 virtual void Clear(rtc::MessageHandler* handler, | 66 virtual void Clear(rtc::MessageHandler* handler, |
| 67 uint32 id, | 67 uint32 id, |
| 68 rtc::MessageList* removed) OVERRIDE; | 68 rtc::MessageList* removed) override; |
| 69 virtual void Send(rtc::MessageHandler *handler, | 69 virtual void Send(rtc::MessageHandler *handler, |
| 70 uint32 id, | 70 uint32 id, |
| 71 rtc::MessageData *data) OVERRIDE; | 71 rtc::MessageData *data) override; |
| 72 | 72 |
| 73 // Following methods are not supported.They are overriden just to | 73 // Following methods are not supported.They are overriden just to |
| 74 // ensure that they are not called (each of them contain NOTREACHED | 74 // ensure that they are not called (each of them contain NOTREACHED |
| 75 // in the body). Some of this methods can be implemented if it | 75 // in the body). Some of this methods can be implemented if it |
| 76 // becomes neccessary to use libjingle code that calls them. | 76 // becomes neccessary to use libjingle code that calls them. |
| 77 virtual void Quit() OVERRIDE; | 77 virtual void Quit() override; |
| 78 virtual bool IsQuitting() OVERRIDE; | 78 virtual bool IsQuitting() override; |
| 79 virtual void Restart() OVERRIDE; | 79 virtual void Restart() override; |
| 80 virtual bool Get(rtc::Message* message, | 80 virtual bool Get(rtc::Message* message, |
| 81 int delay_ms, | 81 int delay_ms, |
| 82 bool process_io) OVERRIDE; | 82 bool process_io) override; |
| 83 virtual bool Peek(rtc::Message* message, | 83 virtual bool Peek(rtc::Message* message, |
| 84 int delay_ms) OVERRIDE; | 84 int delay_ms) override; |
| 85 virtual void PostAt(uint32 timestamp, | 85 virtual void PostAt(uint32 timestamp, |
| 86 rtc::MessageHandler* handler, | 86 rtc::MessageHandler* handler, |
| 87 uint32 id, | 87 uint32 id, |
| 88 rtc::MessageData* data) OVERRIDE; | 88 rtc::MessageData* data) override; |
| 89 virtual void Dispatch(rtc::Message* message) OVERRIDE; | 89 virtual void Dispatch(rtc::Message* message) override; |
| 90 virtual void ReceiveSends() OVERRIDE; | 90 virtual void ReceiveSends() override; |
| 91 virtual int GetDelay() OVERRIDE; | 91 virtual int GetDelay() override; |
| 92 | 92 |
| 93 // rtc::Thread overrides. | 93 // rtc::Thread overrides. |
| 94 virtual void Stop() OVERRIDE; | 94 virtual void Stop() override; |
| 95 virtual void Run() OVERRIDE; | 95 virtual void Run() override; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 typedef std::map<int, rtc::Message> MessagesQueue; | 98 typedef std::map<int, rtc::Message> MessagesQueue; |
| 99 struct PendingSend; | 99 struct PendingSend; |
| 100 | 100 |
| 101 void PostTaskInternal( | 101 void PostTaskInternal( |
| 102 int delay_ms, rtc::MessageHandler* handler, | 102 int delay_ms, rtc::MessageHandler* handler, |
| 103 uint32 message_id, rtc::MessageData* data); | 103 uint32 message_id, rtc::MessageData* data); |
| 104 void RunTask(int task_id); | 104 void RunTask(int task_id); |
| 105 void ProcessPendingSends(); | 105 void ProcessPendingSends(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 118 | 118 |
| 119 base::WeakPtr<JingleThreadWrapper> weak_ptr_; | 119 base::WeakPtr<JingleThreadWrapper> weak_ptr_; |
| 120 base::WeakPtrFactory<JingleThreadWrapper> weak_ptr_factory_; | 120 base::WeakPtrFactory<JingleThreadWrapper> weak_ptr_factory_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(JingleThreadWrapper); | 122 DISALLOW_COPY_AND_ASSIGN(JingleThreadWrapper); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace jingle_glue | 125 } // namespace jingle_glue |
| 126 | 126 |
| 127 #endif // JINGLE_GLUE_THREAD_WRAPPER_H_ | 127 #endif // JINGLE_GLUE_THREAD_WRAPPER_H_ |
| OLD | NEW |