Index: webrtc/api/proxy.h |
diff --git a/webrtc/api/proxy.h b/webrtc/api/proxy.h |
index 1351a0427e6b4077f034bbc593b5626d9b16bb33..e2f688cf035d4b242f399ab443ddcf866f9da0fe 100644 |
--- a/webrtc/api/proxy.h |
+++ b/webrtc/api/proxy.h |
@@ -299,73 +299,93 @@ class MethodCall5 : public rtc::Message, |
class c##Proxy : public c##Interface { \ |
protected: \ |
typedef c##Interface C; \ |
- c##Proxy(rtc::Thread* thread, C* c) : owner_thread_(thread), c_(c) {} \ |
+ c##Proxy(rtc::Thread* signal_thread, rtc::Thread* worker_thread, C* c) \ |
+ : signal_thread_(signal_thread), worker_thread_(worker_thread), c_(c) {} \ |
~c##Proxy() { \ |
MethodCall0<c##Proxy, void> call(this, &c##Proxy::Release_s); \ |
- call.Marshal(owner_thread_); \ |
+ call.Marshal(signal_thread_); \ |
} \ |
\ |
public: \ |
- static rtc::scoped_refptr<C> Create(rtc::Thread* thread, C* c) { \ |
- return new rtc::RefCountedObject<c##Proxy>(thread, c); \ |
+ /* Worker thread must be provided if any worker methods are defined. */ \ |
+ static rtc::scoped_refptr<C> Create( \ |
+ rtc::Thread* signal_thread, rtc::Thread* worker_thread, C* c) { \ |
+ return new rtc::RefCountedObject<c##Proxy>( \ |
+ signal_thread, worker_thread, c); \ |
} |
#define PROXY_METHOD0(r, method) \ |
r method() override { \ |
MethodCall0<C, r> call(c_.get(), &C::method); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_CONSTMETHOD0(r, method) \ |
r method() const override { \ |
ConstMethodCall0<C, r> call(c_.get(), &C::method); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_METHOD1(r, method, t1) \ |
r method(t1 a1) override { \ |
MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_CONSTMETHOD1(r, method, t1) \ |
r method(t1 a1) const override { \ |
ConstMethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_METHOD2(r, method, t1, t2) \ |
r method(t1 a1, t2 a2) override { \ |
MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_METHOD3(r, method, t1, t2, t3) \ |
r method(t1 a1, t2 a2, t3 a3) override { \ |
MethodCall3<C, r, t1, t2, t3> call(c_.get(), &C::method, a1, a2, a3); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_METHOD4(r, method, t1, t2, t3, t4) \ |
r method(t1 a1, t2 a2, t3 a3, t4 a4) override { \ |
MethodCall4<C, r, t1, t2, t3, t4> call(c_.get(), &C::method, a1, a2, a3, \ |
a4); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
} |
#define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \ |
r method(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) override { \ |
MethodCall5<C, r, t1, t2, t3, t4, t5> call(c_.get(), &C::method, a1, a2, \ |
a3, a4, a5); \ |
- return call.Marshal(owner_thread_); \ |
+ return call.Marshal(signal_thread_); \ |
+ } |
+ |
+// Define methods which should be invoked on the worker thread. |
+#define PROXY_WORKER_METHOD1(r, method, t1) \ |
+ r method(t1 a1) override { \ |
+ MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \ |
+ return call.Marshal(worker_thread_); \ |
+ } |
+ |
+#define PROXY_WORKER_METHOD2(r, method, t1, t2) \ |
+ r method(t1 a1, t2 a2) override { \ |
+ MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \ |
+ return call.Marshal(worker_thread_); \ |
} |
#define END_PROXY() \ |
private:\ |
void Release_s() {\ |
c_ = NULL;\ |
+ /* TODO(nisse): Temporary hack to silence unusedness warnings */ \ |
+ (void) worker_thread_; \ |
}\ |
- mutable rtc::Thread* owner_thread_;\ |
+ mutable rtc::Thread* signal_thread_;\ |
+ mutable rtc::Thread* worker_thread_;\ |
rtc::scoped_refptr<C> c_;\ |
};\ |