Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: webrtc/api/peerconnectionfactory.cc

Issue 1828463002: Adding comments about threading around CreatePeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/api/peerconnectioninterface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnectionfactory.cc
diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc
index 22e450ca4ec29ed5bd1177d73d7020380928c007..852b7a8cce80d3ecb643548b157e93b6082b7790 100644
--- a/webrtc/api/peerconnectionfactory.cc
+++ b/webrtc/api/peerconnectionfactory.cc
@@ -64,16 +64,11 @@ CreatePeerConnectionFactory() {
rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
new rtc::RefCountedObject<PeerConnectionFactory>());
-
- // Call Initialize synchronously but make sure its executed on
- // |signaling_thread|.
- MethodCall0<PeerConnectionFactory, bool> call(
- pc_factory.get(),
- &PeerConnectionFactory::Initialize);
- bool result = call.Marshal(pc_factory->signaling_thread());
-
- if (!result) {
- return NULL;
+ RTC_CHECK(rtc::Thread::Current() == pc_factory->signaling_thread());
+ // The signaling thread is the current thread so we can
+ // safely call Initialize directly.
+ if (!pc_factory->Initialize()) {
+ return nullptr;
}
return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(),
pc_factory);
@@ -101,7 +96,7 @@ CreatePeerConnectionFactory(
bool result = call.Marshal(signaling_thread);
if (!result) {
- return NULL;
+ return nullptr;
}
return PeerConnectionFactoryProxy::Create(signaling_thread, pc_factory);
}
« no previous file with comments | « no previous file | webrtc/api/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698