mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 22:00:47 +01:00
Remove 'owned proxy' macros from proxy.h.
This seems to be unused and also differs from other proxy implementations in that proxies are generally for reference counted interfaces whereas the 'owned proxy' macros are not. Bug: webrtc:13464, webrtc:12701 Change-Id: I2fc2c2f186bccab8388928d41610112c3b5f88ac Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256018 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36255}
This commit is contained in:
parent
ef6b028c92
commit
29ad53e466
2 changed files with 0 additions and 65 deletions
15
pc/proxy.h
15
pc/proxy.h
|
@ -53,8 +53,6 @@
|
|||
// The variant defined with BEGIN_PRIMARY_PROXY_MAP is unaware of
|
||||
// the secondary thread, and invokes all methods on the primary thread.
|
||||
//
|
||||
// The variant defined with BEGIN_OWNED_PROXY_MAP does not use
|
||||
// refcounting, and instead just takes ownership of the object being proxied.
|
||||
|
||||
#ifndef PC_PROXY_H_
|
||||
#define PC_PROXY_H_
|
||||
|
@ -309,19 +307,6 @@ class ConstMethodCall : public QueuedTask {
|
|||
primary_thread, secondary_thread, c); \
|
||||
}
|
||||
|
||||
#define BEGIN_OWNED_PROXY_MAP(class_name) \
|
||||
PROXY_MAP_BOILERPLATE(class_name) \
|
||||
SECONDARY_PROXY_MAP_BOILERPLATE(class_name) \
|
||||
OWNED_PROXY_MAP_BOILERPLATE(class_name) \
|
||||
public: \
|
||||
static std::unique_ptr<class_name##Interface> Create( \
|
||||
rtc::Thread* primary_thread, rtc::Thread* secondary_thread, \
|
||||
std::unique_ptr<INTERNAL_CLASS> c) { \
|
||||
return std::unique_ptr<class_name##Interface>( \
|
||||
new class_name##ProxyWithInternal(primary_thread, secondary_thread, \
|
||||
c.release())); \
|
||||
}
|
||||
|
||||
#define PROXY_PRIMARY_THREAD_DESTRUCTOR() \
|
||||
private: \
|
||||
rtc::Thread* destructor_thread() const { return primary_thread_; } \
|
||||
|
|
|
@ -256,54 +256,4 @@ TEST_F(ProxyTest, WorkerMethod2) {
|
|||
EXPECT_EQ("Method2", fake_proxy_->Method2(arg1, arg2));
|
||||
}
|
||||
|
||||
// Interface for testing OWNED_PROXY_MAP.
|
||||
class FooInterface {
|
||||
public:
|
||||
virtual ~FooInterface() {}
|
||||
virtual void Bar() = 0;
|
||||
};
|
||||
|
||||
class Foo : public FooInterface {
|
||||
public:
|
||||
Foo() {}
|
||||
MOCK_METHOD(void, Bar, (), (override));
|
||||
};
|
||||
|
||||
BEGIN_OWNED_PROXY_MAP(Foo)
|
||||
PROXY_PRIMARY_THREAD_DESTRUCTOR()
|
||||
PROXY_METHOD0(void, Bar)
|
||||
END_PROXY_MAP(Foo)
|
||||
|
||||
class OwnedProxyTest : public ::testing::Test {
|
||||
public:
|
||||
OwnedProxyTest()
|
||||
: signaling_thread_(rtc::Thread::Create()),
|
||||
worker_thread_(rtc::Thread::Create()),
|
||||
foo_(new Foo()),
|
||||
foo_proxy_(FooProxy::Create(signaling_thread_.get(),
|
||||
worker_thread_.get(),
|
||||
std::unique_ptr<FooInterface>(foo_))) {
|
||||
signaling_thread_->Start();
|
||||
worker_thread_->Start();
|
||||
}
|
||||
|
||||
void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_->IsCurrent()); }
|
||||
void CheckWorkerThread() { EXPECT_TRUE(worker_thread_->IsCurrent()); }
|
||||
|
||||
protected:
|
||||
std::unique_ptr<rtc::Thread> signaling_thread_;
|
||||
std::unique_ptr<rtc::Thread> worker_thread_;
|
||||
Foo* foo_; // Owned by foo_proxy_, not this class.
|
||||
std::unique_ptr<FooInterface> foo_proxy_;
|
||||
};
|
||||
|
||||
// Just tests that a method can be invoked using an "owned proxy" (as opposed
|
||||
// to normal ref-counted version).
|
||||
TEST_F(OwnedProxyTest, BasicTest) {
|
||||
EXPECT_CALL(*foo_, Bar())
|
||||
.Times(Exactly(1))
|
||||
.WillOnce(InvokeWithoutArgs(this, &OwnedProxyTest::CheckSignalingThread));
|
||||
foo_proxy_->Bar();
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
Loading…
Reference in a new issue