Chromium Code Reviews| Index: webrtc/api/proxy.h |
| diff --git a/webrtc/api/proxy.h b/webrtc/api/proxy.h |
| index 2df85c4bf46f4adb2f03196f2487287ab9a31d56..5c0c693255ee92e38a23675180df2dfc271cbc8d 100644 |
| --- a/webrtc/api/proxy.h |
| +++ b/webrtc/api/proxy.h |
| @@ -307,42 +307,58 @@ class MethodCall5 : public rtc::Message, |
| }; |
| #define BEGIN_SIGNALING_PROXY_MAP(c) \ |
| - class c##Proxy : public c##Interface { \ |
| - protected: \ |
| - typedef c##Interface C; \ |
| - c##Proxy(rtc::Thread* signaling_thread, C* c) \ |
| - : signaling_thread_(signaling_thread), c_(c) {} \ |
| - ~c##Proxy() { \ |
| - MethodCall0<c##Proxy, void> call( \ |
| - this, &c##Proxy::Release_s); \ |
| - call.Marshal(signaling_thread_); \ |
| - } \ |
| - \ |
| - public: \ |
| - static rtc::scoped_refptr<C> Create(rtc::Thread* signaling_thread, C* c) { \ |
| - return new rtc::RefCountedObject<c##Proxy>( \ |
| - signaling_thread, c); \ |
| - } |
| + template <class INNER_CLASS> \ |
| + class c##ProxyEx; \ |
| + typedef c##ProxyEx<c##Interface> c##Proxy; \ |
| + template <class INNER_CLASS> \ |
| + class c##ProxyEx : public c##Interface { \ |
| + protected: \ |
| + typedef c##Interface C; \ |
| + c##ProxyEx(rtc::Thread* signaling_thread, INNER_CLASS* c) \ |
| + : signaling_thread_(signaling_thread), c_(c) {} \ |
| + ~c##ProxyEx() { \ |
| + MethodCall0<c##ProxyEx, void> call(this, &c##ProxyEx::Release_s); \ |
| + call.Marshal(signaling_thread_); \ |
| + } \ |
| + \ |
| + public: \ |
| + static rtc::scoped_refptr<c##ProxyEx> Create( \ |
| + rtc::Thread* signaling_thread, \ |
| + INNER_CLASS* c) { \ |
| + return new rtc::RefCountedObject<c##ProxyEx>(signaling_thread, c); \ |
| + } \ |
| + const INNER_CLASS* get() const { return c_.get(); } \ |
| + INNER_CLASS* get() { return c_.get(); } |
| #define BEGIN_PROXY_MAP(c) \ |
| - class c##Proxy : public c##Interface { \ |
| + template <class INNER_CLASS> \ |
|
pthatcher1
2016/06/03 00:23:50
Would it make sense to call this INTERNAL_CLASS?
Taylor Brandstetter
2016/06/03 22:48:39
Sure.
|
| + class c##ProxyEx; \ |
| + typedef c##ProxyEx<c##Interface> c##Proxy; \ |
| + template <class INNER_CLASS> \ |
| + class c##ProxyEx : public c##Interface { \ |
| protected: \ |
| typedef c##Interface C; \ |
| - c##Proxy(rtc::Thread* signaling_thread, rtc::Thread* worker_thread, C* c) \ |
| - : signaling_thread_(signaling_thread), \ |
| - worker_thread_(worker_thread), \ |
| - c_(c) {} \ |
| - ~c##Proxy() { \ |
| - MethodCall0<c##Proxy, void> call(this, &c##Proxy::Release_s); \ |
| + c##ProxyEx(rtc::Thread* signaling_thread, \ |
|
pthatcher1
2016/06/03 00:23:50
Would it make senes for this to be InternalProxy?
Taylor Brandstetter
2016/06/03 22:48:39
See my other comment. That name implies to me that
pthatcher1
2016/06/03 23:05:49
I think it just implies that you can get to the "i
|
| + rtc::Thread* worker_thread, \ |
| + INNER_CLASS* c) \ |
| + : signaling_thread_(signaling_thread), \ |
| + worker_thread_(worker_thread), \ |
| + c_(c) {} \ |
| + ~c##ProxyEx() { \ |
| + MethodCall0<c##ProxyEx, void> call(this, &c##ProxyEx::Release_s); \ |
| call.Marshal(signaling_thread_); \ |
| } \ |
| \ |
| public: \ |
| - static rtc::scoped_refptr<C> Create( \ |
| - rtc::Thread* signaling_thread, rtc::Thread* worker_thread, C* c) { \ |
| - return new rtc::RefCountedObject<c##Proxy>( \ |
| - signaling_thread, worker_thread, c); \ |
| - } |
| + static rtc::scoped_refptr<c##ProxyEx> Create( \ |
| + rtc::Thread* signaling_thread, \ |
| + rtc::Thread* worker_thread, \ |
| + INNER_CLASS* c) { \ |
| + return new rtc::RefCountedObject<c##ProxyEx>(signaling_thread, \ |
| + worker_thread, c); \ |
| + } \ |
| + const INNER_CLASS* get() const { return c_.get(); } \ |
| + INNER_CLASS* get() { return c_.get(); } |
| #define PROXY_METHOD0(r, method) \ |
| r method() override { \ |
| @@ -407,24 +423,22 @@ class MethodCall5 : public rtc::Message, |
| return call.Marshal(worker_thread_); \ |
| } |
| -#define END_SIGNALING_PROXY() \ |
| - private:\ |
| - void Release_s() {\ |
| - c_ = NULL;\ |
| - }\ |
| - mutable rtc::Thread* signaling_thread_;\ |
| - rtc::scoped_refptr<C> c_;\ |
| - }; |
| - |
| -#define END_PROXY() \ |
| - private: \ |
| - void Release_s() { \ |
| - c_ = NULL; \ |
| - } \ |
| - mutable rtc::Thread* signaling_thread_; \ |
| - mutable rtc::Thread* worker_thread_; \ |
| - rtc::scoped_refptr<C> c_; \ |
| - }; \ |
| +#define END_SIGNALING_PROXY() \ |
| + private: \ |
| + void Release_s() { c_ = NULL; } \ |
| + mutable rtc::Thread* signaling_thread_; \ |
| + rtc::scoped_refptr<INNER_CLASS> c_; \ |
| + } \ |
| + ; |
| + |
| +#define END_PROXY() \ |
| + private: \ |
| + void Release_s() { c_ = NULL; } \ |
| + mutable rtc::Thread* signaling_thread_; \ |
| + mutable rtc::Thread* worker_thread_; \ |
| + rtc::scoped_refptr<INNER_CLASS> c_; \ |
| + } \ |
| + ; |
|
pthatcher1
2016/06/03 00:23:50
Should we undo the reformatting here?
Taylor Brandstetter
2016/06/03 22:48:39
This is just what "git cl format" did (yep, it's s
pthatcher1
2016/06/03 23:05:49
It looked better before, so please undo it.
|
| } // namespace webrtc |