Index: webrtc/base/messagehandler.h |
diff --git a/webrtc/base/messagehandler.h b/webrtc/base/messagehandler.h |
index 123c8509736794a978f3b644f37ca0bfe4db2cbd..b0a82179a2310766914bee8c53d9ac4628769d40 100644 |
--- a/webrtc/base/messagehandler.h |
+++ b/webrtc/base/messagehandler.h |
@@ -12,6 +12,7 @@ |
#define WEBRTC_BASE_MESSAGEHANDLER_H_ |
#include "webrtc/base/constructormagic.h" |
+#include "webrtc/base/scoped_ptr.h" |
namespace rtc { |
@@ -47,6 +48,20 @@ class FunctorMessageHandler : public MessageHandler { |
ReturnT result_; |
}; |
+// Specialization for rtc::scoped_ptr<ReturnT>. |
+template <class ReturnT, class FunctorT> |
+class FunctorMessageHandler<class rtc::scoped_ptr<ReturnT>, FunctorT> |
+ : public MessageHandler { |
+ public: |
+ explicit FunctorMessageHandler(const FunctorT& functor) : functor_(functor) {} |
+ virtual void OnMessage(Message* msg) { result_ = functor_().Pass(); } |
+ rtc::scoped_ptr<ReturnT> result() { return result_.Pass(); } |
+ |
+ private: |
+ FunctorT functor_; |
+ rtc::scoped_ptr<ReturnT> result_; |
+}; |
+ |
// Specialization for ReturnT of void. |
template <class FunctorT> |
class FunctorMessageHandler<void, FunctorT> : public MessageHandler { |
@@ -62,7 +77,6 @@ class FunctorMessageHandler<void, FunctorT> : public MessageHandler { |
FunctorT functor_; |
}; |
- |
} // namespace rtc |
#endif // WEBRTC_BASE_MESSAGEHANDLER_H_ |