OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class MessageHandler { | 23 class MessageHandler { |
24 public: | 24 public: |
25 virtual ~MessageHandler(); | 25 virtual ~MessageHandler(); |
26 virtual void OnMessage(Message* msg) = 0; | 26 virtual void OnMessage(Message* msg) = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 MessageHandler() {} | 29 MessageHandler() {} |
30 | 30 |
31 private: | 31 private: |
32 DISALLOW_COPY_AND_ASSIGN(MessageHandler); | 32 RTC_DISALLOW_COPY_AND_ASSIGN(MessageHandler); |
33 }; | 33 }; |
34 | 34 |
35 // Helper class to facilitate executing a functor on a thread. | 35 // Helper class to facilitate executing a functor on a thread. |
36 template <class ReturnT, class FunctorT> | 36 template <class ReturnT, class FunctorT> |
37 class FunctorMessageHandler : public MessageHandler { | 37 class FunctorMessageHandler : public MessageHandler { |
38 public: | 38 public: |
39 explicit FunctorMessageHandler(const FunctorT& functor) | 39 explicit FunctorMessageHandler(const FunctorT& functor) |
40 : functor_(functor) {} | 40 : functor_(functor) {} |
41 virtual void OnMessage(Message* msg) { | 41 virtual void OnMessage(Message* msg) { |
42 result_ = functor_(); | 42 result_ = functor_(); |
(...skipping 30 matching lines...) Expand all Loading... |
73 } | 73 } |
74 void result() const {} | 74 void result() const {} |
75 | 75 |
76 private: | 76 private: |
77 FunctorT functor_; | 77 FunctorT functor_; |
78 }; | 78 }; |
79 | 79 |
80 } // namespace rtc | 80 } // namespace rtc |
81 | 81 |
82 #endif // WEBRTC_BASE_MESSAGEHANDLER_H_ | 82 #endif // WEBRTC_BASE_MESSAGEHANDLER_H_ |
OLD | NEW |