Revert "Rename SIGNALING and WORKER to PRIMARY and SECONDARY"
This reverts commit a37f2bd9421868e222d591d3371486a6ab939fd6. Reason for revert: Breaks compile step (e.g. https://ci.chromium.org/ui/p/webrtc/builders/ci/Android64%20Builder%20x64%20(dbg)/19773/overview). Original change's description: > Rename SIGNALING and WORKER to PRIMARY and SECONDARY > > This makes the proxy macros less confusing when the secondary thread > is sometimes the worker thread, sometimes the networking thread. > > Bug: none > Change-Id: I1a8cebb82d09be44fe40e80c861bcfb47b9928e8 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208763 > Reviewed-by: Tommi <tommi@webrtc.org> > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33346} TBR=hta@webrtc.org Bug: none Change-Id: I2014faab3392f445f56edd9e833d00000ebc5ca3 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208840 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33347}
This commit is contained in:

committed by
Commit Bot

parent
a37f2bd942
commit
07a01d09e4
@ -20,8 +20,8 @@ namespace webrtc {
|
|||||||
|
|
||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(MediaStream)
|
BEGIN_SIGNALING_PROXY_MAP(MediaStream)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
|
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
|
||||||
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
|
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
|
||||||
|
@ -24,8 +24,8 @@ namespace webrtc {
|
|||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
|
|
||||||
BEGIN_PRIMARY_PROXY_MAP(AudioTrack)
|
BEGIN_SIGNALING_PROXY_MAP(AudioTrack)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_CONSTMETHOD0(TrackState, state)
|
PROXY_CONSTMETHOD0(TrackState, state)
|
||||||
@ -41,7 +41,7 @@ PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
|||||||
END_PROXY_MAP()
|
END_PROXY_MAP()
|
||||||
|
|
||||||
BEGIN_PROXY_MAP(VideoTrack)
|
BEGIN_PROXY_MAP(VideoTrack)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_CONSTMETHOD0(TrackState, state)
|
PROXY_CONSTMETHOD0(TrackState, state)
|
||||||
@ -49,11 +49,11 @@ PROXY_CONSTMETHOD0(bool, enabled)
|
|||||||
PROXY_METHOD1(bool, set_enabled, bool)
|
PROXY_METHOD1(bool, set_enabled, bool)
|
||||||
PROXY_CONSTMETHOD0(ContentHint, content_hint)
|
PROXY_CONSTMETHOD0(ContentHint, content_hint)
|
||||||
PROXY_METHOD1(void, set_content_hint, ContentHint)
|
PROXY_METHOD1(void, set_content_hint, ContentHint)
|
||||||
PROXY_SECONDARY_METHOD2(void,
|
PROXY_WORKER_METHOD2(void,
|
||||||
AddOrUpdateSink,
|
AddOrUpdateSink,
|
||||||
rtc::VideoSinkInterface<VideoFrame>*,
|
rtc::VideoSinkInterface<VideoFrame>*,
|
||||||
const rtc::VideoSinkWants&)
|
const rtc::VideoSinkWants&)
|
||||||
PROXY_SECONDARY_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
||||||
PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
|
PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
|
||||||
|
|
||||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||||
|
@ -22,8 +22,8 @@ namespace webrtc {
|
|||||||
|
|
||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(PeerConnectionFactory)
|
BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD1(void, SetOptions, const Options&)
|
PROXY_METHOD1(void, SetOptions, const Options&)
|
||||||
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
|
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||||
CreatePeerConnection,
|
CreatePeerConnection,
|
||||||
|
@ -26,7 +26,7 @@ namespace webrtc {
|
|||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_PROXY_MAP(PeerConnection)
|
BEGIN_PROXY_MAP(PeerConnection)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
|
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
|
||||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
|
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
|
||||||
PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
|
PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
|
||||||
@ -140,8 +140,8 @@ PROXY_WORKER_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>,
|
|||||||
const std::string&)
|
const std::string&)
|
||||||
// This method will be invoked on the network thread. See
|
// This method will be invoked on the network thread. See
|
||||||
// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
|
// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
|
||||||
PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
|
PROXY_WORKER_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
|
||||||
GetSctpTransport)
|
GetSctpTransport)
|
||||||
PROXY_METHOD0(SignalingState, signaling_state)
|
PROXY_METHOD0(SignalingState, signaling_state)
|
||||||
PROXY_METHOD0(IceConnectionState, ice_connection_state)
|
PROXY_METHOD0(IceConnectionState, ice_connection_state)
|
||||||
PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
|
PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
|
||||||
|
180
api/proxy.h
180
api/proxy.h
@ -12,13 +12,6 @@
|
|||||||
// PeerConnection classes.
|
// PeerConnection classes.
|
||||||
// TODO(deadbeef): Move this to pc/; this is part of the implementation.
|
// TODO(deadbeef): Move this to pc/; this is part of the implementation.
|
||||||
|
|
||||||
// The proxied objects are initialized with either one or two thread
|
|
||||||
// objects that operations can be proxied to: The primary and secondary
|
|
||||||
// threads.
|
|
||||||
// In common usage, the primary thread will be the PeerConnection's
|
|
||||||
// signaling thread, and the secondary thread will be either the
|
|
||||||
// PeerConnection's worker thread or the PeerConnection's network thread.
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Example usage:
|
// Example usage:
|
||||||
//
|
//
|
||||||
@ -36,22 +29,22 @@
|
|||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// BEGIN_PROXY_MAP(Test)
|
// BEGIN_PROXY_MAP(Test)
|
||||||
// PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
// PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
// PROXY_METHOD0(std::string, FooA)
|
// PROXY_METHOD0(std::string, FooA)
|
||||||
// PROXY_CONSTMETHOD1(std::string, FooB, arg1)
|
// PROXY_CONSTMETHOD1(std::string, FooB, arg1)
|
||||||
// PROXY_SECONDARY_METHOD1(std::string, FooC, arg1)
|
// PROXY_WORKER_METHOD1(std::string, FooC, arg1)
|
||||||
// END_PROXY_MAP()
|
// END_PROXY_MAP()
|
||||||
//
|
//
|
||||||
// Where the destructor and first two methods are invoked on the primary
|
// Where the destructor and first two methods are invoked on the signaling
|
||||||
// thread, and the third is invoked on the secondary thread.
|
// thread, and the third is invoked on the worker thread.
|
||||||
//
|
//
|
||||||
// The proxy can be created using
|
// The proxy can be created using
|
||||||
//
|
//
|
||||||
// TestProxy::Create(Thread* signaling_thread, Thread* worker_thread,
|
// TestProxy::Create(Thread* signaling_thread, Thread* worker_thread,
|
||||||
// TestInterface*).
|
// TestInterface*).
|
||||||
//
|
//
|
||||||
// The variant defined with BEGIN_PRIMARY_PROXY_MAP is unaware of
|
// The variant defined with BEGIN_SIGNALING_PROXY_MAP is unaware of
|
||||||
// the secondary thread, and invokes all methods on the primary thread.
|
// the worker thread, and invokes all methods on the signaling thread.
|
||||||
//
|
//
|
||||||
// The variant defined with BEGIN_OWNED_PROXY_MAP does not use
|
// The variant defined with BEGIN_OWNED_PROXY_MAP does not use
|
||||||
// refcounting, and instead just takes ownership of the object being proxied.
|
// refcounting, and instead just takes ownership of the object being proxied.
|
||||||
@ -202,25 +195,25 @@ class ConstMethodCall : public QueuedTask {
|
|||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define PRIMARY_PROXY_MAP_BOILERPLATE(c) \
|
#define SIGNALING_PROXY_MAP_BOILERPLATE(c) \
|
||||||
protected: \
|
|
||||||
c##ProxyWithInternal(rtc::Thread* primary_thread, INTERNAL_CLASS* c) \
|
|
||||||
: primary_thread_(primary_thread), c_(c) {} \
|
|
||||||
\
|
|
||||||
private: \
|
|
||||||
mutable rtc::Thread* primary_thread_;
|
|
||||||
|
|
||||||
#define SECONDARY_PROXY_MAP_BOILERPLATE(c) \
|
|
||||||
protected: \
|
protected: \
|
||||||
c##ProxyWithInternal(rtc::Thread* primary_thread, \
|
c##ProxyWithInternal(rtc::Thread* signaling_thread, INTERNAL_CLASS* c) \
|
||||||
rtc::Thread* secondary_thread, INTERNAL_CLASS* c) \
|
: signaling_thread_(signaling_thread), c_(c) {} \
|
||||||
: primary_thread_(primary_thread), \
|
|
||||||
secondary_thread_(secondary_thread), \
|
|
||||||
c_(c) {} \
|
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
mutable rtc::Thread* primary_thread_; \
|
mutable rtc::Thread* signaling_thread_;
|
||||||
mutable rtc::Thread* secondary_thread_;
|
|
||||||
|
#define WORKER_PROXY_MAP_BOILERPLATE(c) \
|
||||||
|
protected: \
|
||||||
|
c##ProxyWithInternal(rtc::Thread* signaling_thread, \
|
||||||
|
rtc::Thread* worker_thread, INTERNAL_CLASS* c) \
|
||||||
|
: signaling_thread_(signaling_thread), \
|
||||||
|
worker_thread_(worker_thread), \
|
||||||
|
c_(c) {} \
|
||||||
|
\
|
||||||
|
private: \
|
||||||
|
mutable rtc::Thread* signaling_thread_; \
|
||||||
|
mutable rtc::Thread* worker_thread_;
|
||||||
|
|
||||||
// Note that the destructor is protected so that the proxy can only be
|
// Note that the destructor is protected so that the proxy can only be
|
||||||
// destroyed via RefCountInterface.
|
// destroyed via RefCountInterface.
|
||||||
@ -253,88 +246,89 @@ class ConstMethodCall : public QueuedTask {
|
|||||||
void DestroyInternal() { delete c_; } \
|
void DestroyInternal() { delete c_; } \
|
||||||
INTERNAL_CLASS* c_;
|
INTERNAL_CLASS* c_;
|
||||||
|
|
||||||
#define BEGIN_PRIMARY_PROXY_MAP(c) \
|
#define BEGIN_SIGNALING_PROXY_MAP(c) \
|
||||||
PROXY_MAP_BOILERPLATE(c) \
|
PROXY_MAP_BOILERPLATE(c) \
|
||||||
PRIMARY_PROXY_MAP_BOILERPLATE(c) \
|
SIGNALING_PROXY_MAP_BOILERPLATE(c) \
|
||||||
REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
|
REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
|
||||||
public: \
|
public: \
|
||||||
static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
|
static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
|
||||||
rtc::Thread* primary_thread, INTERNAL_CLASS* c) { \
|
rtc::Thread* signaling_thread, INTERNAL_CLASS* c) { \
|
||||||
return new rtc::RefCountedObject<c##ProxyWithInternal>(primary_thread, c); \
|
return new rtc::RefCountedObject<c##ProxyWithInternal>(signaling_thread, \
|
||||||
|
c); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BEGIN_PROXY_MAP(c) \
|
#define BEGIN_PROXY_MAP(c) \
|
||||||
PROXY_MAP_BOILERPLATE(c) \
|
PROXY_MAP_BOILERPLATE(c) \
|
||||||
SECONDARY_PROXY_MAP_BOILERPLATE(c) \
|
WORKER_PROXY_MAP_BOILERPLATE(c) \
|
||||||
REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
|
REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
|
||||||
public: \
|
public: \
|
||||||
static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
|
static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
|
||||||
rtc::Thread* primary_thread, rtc::Thread* secondary_thread, \
|
rtc::Thread* signaling_thread, rtc::Thread* worker_thread, \
|
||||||
INTERNAL_CLASS* c) { \
|
INTERNAL_CLASS* c) { \
|
||||||
return new rtc::RefCountedObject<c##ProxyWithInternal>( \
|
return new rtc::RefCountedObject<c##ProxyWithInternal>(signaling_thread, \
|
||||||
primary_thread, secondary_thread, c); \
|
worker_thread, c); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BEGIN_OWNED_PROXY_MAP(c) \
|
#define BEGIN_OWNED_PROXY_MAP(c) \
|
||||||
PROXY_MAP_BOILERPLATE(c) \
|
PROXY_MAP_BOILERPLATE(c) \
|
||||||
SECONDARY_PROXY_MAP_BOILERPLATE(c) \
|
WORKER_PROXY_MAP_BOILERPLATE(c) \
|
||||||
OWNED_PROXY_MAP_BOILERPLATE(c) \
|
OWNED_PROXY_MAP_BOILERPLATE(c) \
|
||||||
public: \
|
public: \
|
||||||
static std::unique_ptr<c##Interface> Create( \
|
static std::unique_ptr<c##Interface> Create( \
|
||||||
rtc::Thread* primary_thread, rtc::Thread* secondary_thread, \
|
rtc::Thread* signaling_thread, rtc::Thread* worker_thread, \
|
||||||
std::unique_ptr<INTERNAL_CLASS> c) { \
|
std::unique_ptr<INTERNAL_CLASS> c) { \
|
||||||
return std::unique_ptr<c##Interface>(new c##ProxyWithInternal( \
|
return std::unique_ptr<c##Interface>(new c##ProxyWithInternal( \
|
||||||
primary_thread, secondary_thread, c.release())); \
|
signaling_thread, worker_thread, c.release())); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_PRIMARY_THREAD_DESTRUCTOR() \
|
#define PROXY_SIGNALING_THREAD_DESTRUCTOR() \
|
||||||
private: \
|
|
||||||
rtc::Thread* destructor_thread() const { return primary_thread_; } \
|
|
||||||
\
|
|
||||||
public: // NOLINTNEXTLINE
|
|
||||||
|
|
||||||
#define PROXY_SECONDARY_THREAD_DESTRUCTOR() \
|
|
||||||
private: \
|
private: \
|
||||||
rtc::Thread* destructor_thread() const { return secondary_thread_; } \
|
rtc::Thread* destructor_thread() const { return signaling_thread_; } \
|
||||||
\
|
\
|
||||||
public: // NOLINTNEXTLINE
|
public: // NOLINTNEXTLINE
|
||||||
|
|
||||||
#define PROXY_METHOD0(r, method) \
|
#define PROXY_WORKER_THREAD_DESTRUCTOR() \
|
||||||
r method() override { \
|
private: \
|
||||||
MethodCall<C, r> call(c_, &C::method); \
|
rtc::Thread* destructor_thread() const { return worker_thread_; } \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
\
|
||||||
|
public: // NOLINTNEXTLINE
|
||||||
|
|
||||||
|
#define PROXY_METHOD0(r, method) \
|
||||||
|
r method() override { \
|
||||||
|
MethodCall<C, r> call(c_, &C::method); \
|
||||||
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_CONSTMETHOD0(r, method) \
|
#define PROXY_CONSTMETHOD0(r, method) \
|
||||||
r method() const override { \
|
r method() const override { \
|
||||||
ConstMethodCall<C, r> call(c_, &C::method); \
|
ConstMethodCall<C, r> call(c_, &C::method); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_METHOD1(r, method, t1) \
|
#define PROXY_METHOD1(r, method, t1) \
|
||||||
r method(t1 a1) override { \
|
r method(t1 a1) override { \
|
||||||
MethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
MethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_CONSTMETHOD1(r, method, t1) \
|
#define PROXY_CONSTMETHOD1(r, method, t1) \
|
||||||
r method(t1 a1) const override { \
|
r method(t1 a1) const override { \
|
||||||
ConstMethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
ConstMethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_METHOD2(r, method, t1, t2) \
|
#define PROXY_METHOD2(r, method, t1, t2) \
|
||||||
r method(t1 a1, t2 a2) override { \
|
r method(t1 a1, t2 a2) override { \
|
||||||
MethodCall<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
|
MethodCall<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2)); \
|
std::move(a2)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_METHOD3(r, method, t1, t2, t3) \
|
#define PROXY_METHOD3(r, method, t1, t2, t3) \
|
||||||
r method(t1 a1, t2 a2, t3 a3) override { \
|
r method(t1 a1, t2 a2, t3 a3) override { \
|
||||||
MethodCall<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
|
MethodCall<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2), std::move(a3)); \
|
std::move(a2), std::move(a3)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_METHOD4(r, method, t1, t2, t3, t4) \
|
#define PROXY_METHOD4(r, method, t1, t2, t3, t4) \
|
||||||
@ -342,7 +336,7 @@ class ConstMethodCall : public QueuedTask {
|
|||||||
MethodCall<C, r, t1, t2, t3, t4> call(c_, &C::method, std::move(a1), \
|
MethodCall<C, r, t1, t2, t3, t4> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2), std::move(a3), \
|
std::move(a2), std::move(a3), \
|
||||||
std::move(a4)); \
|
std::move(a4)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \
|
#define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \
|
||||||
@ -350,60 +344,60 @@ class ConstMethodCall : public QueuedTask {
|
|||||||
MethodCall<C, r, t1, t2, t3, t4, t5> call(c_, &C::method, std::move(a1), \
|
MethodCall<C, r, t1, t2, t3, t4, t5> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2), std::move(a3), \
|
std::move(a2), std::move(a3), \
|
||||||
std::move(a4), std::move(a5)); \
|
std::move(a4), std::move(a5)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, primary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define methods which should be invoked on the secondary thread.
|
// Define methods which should be invoked on the worker thread.
|
||||||
#define PROXY_SECONDARY_METHOD0(r, method) \
|
#define PROXY_WORKER_METHOD0(r, method) \
|
||||||
r method() override { \
|
r method() override { \
|
||||||
MethodCall<C, r> call(c_, &C::method); \
|
MethodCall<C, r> call(c_, &C::method); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_CONSTMETHOD0(r, method) \
|
#define PROXY_WORKER_CONSTMETHOD0(r, method) \
|
||||||
r method() const override { \
|
r method() const override { \
|
||||||
ConstMethodCall<C, r> call(c_, &C::method); \
|
ConstMethodCall<C, r> call(c_, &C::method); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_METHOD1(r, method, t1) \
|
#define PROXY_WORKER_METHOD1(r, method, t1) \
|
||||||
r method(t1 a1) override { \
|
r method(t1 a1) override { \
|
||||||
MethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
MethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_CONSTMETHOD1(r, method, t1) \
|
#define PROXY_WORKER_CONSTMETHOD1(r, method, t1) \
|
||||||
r method(t1 a1) const override { \
|
r method(t1 a1) const override { \
|
||||||
ConstMethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
ConstMethodCall<C, r, t1> call(c_, &C::method, std::move(a1)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_METHOD2(r, method, t1, t2) \
|
#define PROXY_WORKER_METHOD2(r, method, t1, t2) \
|
||||||
r method(t1 a1, t2 a2) override { \
|
r method(t1 a1, t2 a2) override { \
|
||||||
MethodCall<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
|
MethodCall<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2)); \
|
std::move(a2)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_CONSTMETHOD2(r, method, t1, t2) \
|
#define PROXY_WORKER_CONSTMETHOD2(r, method, t1, t2) \
|
||||||
r method(t1 a1, t2 a2) const override { \
|
r method(t1 a1, t2 a2) const override { \
|
||||||
ConstMethodCall<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
|
ConstMethodCall<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2)); \
|
std::move(a2)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_METHOD3(r, method, t1, t2, t3) \
|
#define PROXY_WORKER_METHOD3(r, method, t1, t2, t3) \
|
||||||
r method(t1 a1, t2 a2, t3 a3) override { \
|
r method(t1 a1, t2 a2, t3 a3) override { \
|
||||||
MethodCall<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
|
MethodCall<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2), std::move(a3)); \
|
std::move(a2), std::move(a3)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROXY_SECONDARY_CONSTMETHOD3(r, method, t1, t2) \
|
#define PROXY_WORKER_CONSTMETHOD3(r, method, t1, t2) \
|
||||||
r method(t1 a1, t2 a2, t3 a3) const override { \
|
r method(t1 a1, t2 a2, t3 a3) const override { \
|
||||||
ConstMethodCall<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
|
ConstMethodCall<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
|
||||||
std::move(a2), std::move(a3)); \
|
std::move(a2), std::move(a3)); \
|
||||||
return call.Marshal(RTC_FROM_HERE, secondary_thread_); \
|
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// For use when returning purely const state (set during construction).
|
// For use when returning purely const state (set during construction).
|
||||||
|
@ -120,8 +120,8 @@ class RTC_EXPORT RtpReceiverInterface : public rtc::RefCountInterface {
|
|||||||
// Define proxy for RtpReceiverInterface.
|
// Define proxy for RtpReceiverInterface.
|
||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(RtpReceiver)
|
BEGIN_SIGNALING_PROXY_MAP(RtpReceiver)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
||||||
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
||||||
|
@ -104,8 +104,8 @@ class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface {
|
|||||||
// Define proxy for RtpSenderInterface.
|
// Define proxy for RtpSenderInterface.
|
||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(RtpSender)
|
BEGIN_SIGNALING_PROXY_MAP(RtpSender)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
|
PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
||||||
|
@ -21,27 +21,27 @@ namespace webrtc {
|
|||||||
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_PROXY_MAP(VideoTrackSource)
|
BEGIN_PROXY_MAP(VideoTrackSource)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(SourceState, state)
|
PROXY_CONSTMETHOD0(SourceState, state)
|
||||||
BYPASS_PROXY_CONSTMETHOD0(bool, remote)
|
BYPASS_PROXY_CONSTMETHOD0(bool, remote)
|
||||||
BYPASS_PROXY_CONSTMETHOD0(bool, is_screencast)
|
BYPASS_PROXY_CONSTMETHOD0(bool, is_screencast)
|
||||||
PROXY_CONSTMETHOD0(absl::optional<bool>, needs_denoising)
|
PROXY_CONSTMETHOD0(absl::optional<bool>, needs_denoising)
|
||||||
PROXY_METHOD1(bool, GetStats, Stats*)
|
PROXY_METHOD1(bool, GetStats, Stats*)
|
||||||
PROXY_SECONDARY_METHOD2(void,
|
PROXY_WORKER_METHOD2(void,
|
||||||
AddOrUpdateSink,
|
AddOrUpdateSink,
|
||||||
rtc::VideoSinkInterface<VideoFrame>*,
|
rtc::VideoSinkInterface<VideoFrame>*,
|
||||||
const rtc::VideoSinkWants&)
|
const rtc::VideoSinkWants&)
|
||||||
PROXY_SECONDARY_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
|
||||||
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
|
||||||
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
|
||||||
PROXY_CONSTMETHOD0(bool, SupportsEncodedOutput)
|
PROXY_CONSTMETHOD0(bool, SupportsEncodedOutput)
|
||||||
PROXY_SECONDARY_METHOD0(void, GenerateKeyFrame)
|
PROXY_WORKER_METHOD0(void, GenerateKeyFrame)
|
||||||
PROXY_SECONDARY_METHOD1(void,
|
PROXY_WORKER_METHOD1(void,
|
||||||
AddEncodedSink,
|
AddEncodedSink,
|
||||||
rtc::VideoSinkInterface<RecordableEncodedFrame>*)
|
rtc::VideoSinkInterface<RecordableEncodedFrame>*)
|
||||||
PROXY_SECONDARY_METHOD1(void,
|
PROXY_WORKER_METHOD1(void,
|
||||||
RemoveEncodedSink,
|
RemoveEncodedSink,
|
||||||
rtc::VideoSinkInterface<RecordableEncodedFrame>*)
|
rtc::VideoSinkInterface<RecordableEncodedFrame>*)
|
||||||
END_PROXY_MAP()
|
END_PROXY_MAP()
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -99,9 +99,9 @@ class DtmfSender : public DtmfSenderInterface, public sigslot::has_slots<> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Define proxy for DtmfSenderInterface.
|
// Define proxy for DtmfSenderInterface.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(DtmfSender)
|
BEGIN_SIGNALING_PROXY_MAP(DtmfSender)
|
||||||
|
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD1(void, RegisterObserver, DtmfSenderObserverInterface*)
|
PROXY_METHOD1(void, RegisterObserver, DtmfSenderObserverInterface*)
|
||||||
PROXY_METHOD0(void, UnregisterObserver)
|
PROXY_METHOD0(void, UnregisterObserver)
|
||||||
PROXY_METHOD0(bool, CanInsertDtmf)
|
PROXY_METHOD0(bool, CanInsertDtmf)
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
BEGIN_PROXY_MAP(JitterBufferDelay)
|
BEGIN_PROXY_MAP(JitterBufferDelay)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD2(void, OnStart, cricket::Delayable*, uint32_t)
|
PROXY_METHOD2(void, OnStart, cricket::Delayable*, uint32_t)
|
||||||
PROXY_METHOD0(void, OnStop)
|
PROXY_METHOD0(void, OnStop)
|
||||||
PROXY_SECONDARY_METHOD1(void, Set, absl::optional<double>)
|
PROXY_WORKER_METHOD1(void, Set, absl::optional<double>)
|
||||||
END_PROXY_MAP()
|
END_PROXY_MAP()
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -64,20 +64,20 @@ class Fake : public FakeInterface {
|
|||||||
|
|
||||||
// Proxies for the test interface.
|
// Proxies for the test interface.
|
||||||
BEGIN_PROXY_MAP(Fake)
|
BEGIN_PROXY_MAP(Fake)
|
||||||
PROXY_SECONDARY_THREAD_DESTRUCTOR()
|
PROXY_WORKER_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD0(void, VoidMethod0)
|
PROXY_METHOD0(void, VoidMethod0)
|
||||||
PROXY_METHOD0(std::string, Method0)
|
PROXY_METHOD0(std::string, Method0)
|
||||||
PROXY_CONSTMETHOD0(std::string, ConstMethod0)
|
PROXY_CONSTMETHOD0(std::string, ConstMethod0)
|
||||||
PROXY_SECONDARY_METHOD1(std::string, Method1, std::string)
|
PROXY_WORKER_METHOD1(std::string, Method1, std::string)
|
||||||
PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string)
|
PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string)
|
||||||
PROXY_SECONDARY_METHOD2(std::string, Method2, std::string, std::string)
|
PROXY_WORKER_METHOD2(std::string, Method2, std::string, std::string)
|
||||||
END_PROXY_MAP()
|
END_PROXY_MAP()
|
||||||
|
|
||||||
// Preprocessor hack to get a proxy class a name different than FakeProxy.
|
// Preprocessor hack to get a proxy class a name different than FakeProxy.
|
||||||
#define FakeProxy FakeSignalingProxy
|
#define FakeProxy FakeSignalingProxy
|
||||||
#define FakeProxyWithInternal FakeSignalingProxyWithInternal
|
#define FakeProxyWithInternal FakeSignalingProxyWithInternal
|
||||||
BEGIN_PRIMARY_PROXY_MAP(Fake)
|
BEGIN_SIGNALING_PROXY_MAP(Fake)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD0(void, VoidMethod0)
|
PROXY_METHOD0(void, VoidMethod0)
|
||||||
PROXY_METHOD0(std::string, Method0)
|
PROXY_METHOD0(std::string, Method0)
|
||||||
PROXY_CONSTMETHOD0(std::string, ConstMethod0)
|
PROXY_CONSTMETHOD0(std::string, ConstMethod0)
|
||||||
@ -270,7 +270,7 @@ class Foo : public FooInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_OWNED_PROXY_MAP(Foo)
|
BEGIN_OWNED_PROXY_MAP(Foo)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD0(void, Bar)
|
PROXY_METHOD0(void, Bar)
|
||||||
END_PROXY_MAP()
|
END_PROXY_MAP()
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ int GenerateUniqueId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define proxy for DataChannelInterface.
|
// Define proxy for DataChannelInterface.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(DataChannel)
|
BEGIN_SIGNALING_PROXY_MAP(DataChannel)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*)
|
PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*)
|
||||||
PROXY_METHOD0(void, UnregisterObserver)
|
PROXY_METHOD0(void, UnregisterObserver)
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, label)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, label)
|
||||||
|
@ -264,9 +264,9 @@ class RtpTransceiver final
|
|||||||
const std::function<void()> on_negotiation_needed_;
|
const std::function<void()> on_negotiation_needed_;
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_PRIMARY_PROXY_MAP(RtpTransceiver)
|
BEGIN_SIGNALING_PROXY_MAP(RtpTransceiver)
|
||||||
|
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||||
PROXY_CONSTMETHOD0(absl::optional<std::string>, mid)
|
PROXY_CONSTMETHOD0(absl::optional<std::string>, mid)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpSenderInterface>, sender)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpSenderInterface>, sender)
|
||||||
|
@ -38,8 +38,8 @@ int GenerateUniqueId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define proxy for DataChannelInterface.
|
// Define proxy for DataChannelInterface.
|
||||||
BEGIN_PRIMARY_PROXY_MAP(DataChannel)
|
BEGIN_SIGNALING_PROXY_MAP(DataChannel)
|
||||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*)
|
PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*)
|
||||||
PROXY_METHOD0(void, UnregisterObserver)
|
PROXY_METHOD0(void, UnregisterObserver)
|
||||||
BYPASS_PROXY_CONSTMETHOD0(std::string, label)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, label)
|
||||||
|
Reference in New Issue
Block a user