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

Side by Side Diff: webrtc/pc/ortcfactory.cc

Issue 2719683002: Rewrite rtc::Bind using variadic templates. (Closed)
Patch Set: Mention where sequence_generator comes from in a comment. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/template_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 10 matching lines...) Expand all
21 namespace webrtc { 21 namespace webrtc {
22 22
23 // static 23 // static
24 std::unique_ptr<OrtcFactoryInterface> OrtcFactoryInterface::Create( 24 std::unique_ptr<OrtcFactoryInterface> OrtcFactoryInterface::Create(
25 rtc::Thread* network_thread, 25 rtc::Thread* network_thread,
26 rtc::Thread* signaling_thread, 26 rtc::Thread* signaling_thread,
27 rtc::NetworkManager* network_manager, 27 rtc::NetworkManager* network_manager,
28 rtc::PacketSocketFactory* socket_factory) { 28 rtc::PacketSocketFactory* socket_factory) {
29 // Hop to signaling thread if needed. 29 // Hop to signaling thread if needed.
30 if (signaling_thread && !signaling_thread->IsCurrent()) { 30 if (signaling_thread && !signaling_thread->IsCurrent()) {
31 // The template parameters are necessary because there are two
32 // OrtcFactoryInterface::Create methods, so the types can't be derived from
33 // just the function pointer.
31 return signaling_thread->Invoke<std::unique_ptr<OrtcFactoryInterface>>( 34 return signaling_thread->Invoke<std::unique_ptr<OrtcFactoryInterface>>(
32 RTC_FROM_HERE, 35 RTC_FROM_HERE,
33 rtc::Bind(&OrtcFactoryInterface::Create, network_thread, 36 rtc::Bind<std::unique_ptr<OrtcFactoryInterface>, rtc::Thread*,
34 signaling_thread, network_manager, socket_factory)); 37 rtc::Thread*, rtc::NetworkManager*,
38 rtc::PacketSocketFactory*>(&OrtcFactoryInterface::Create,
39 network_thread, signaling_thread,
40 network_manager, socket_factory));
35 } 41 }
36 OrtcFactory* new_factory = 42 OrtcFactory* new_factory =
37 new OrtcFactory(network_thread, signaling_thread, 43 new OrtcFactory(network_thread, signaling_thread,
38 network_manager, socket_factory); 44 network_manager, socket_factory);
39 // Return a proxy so that any calls on the returned object (including 45 // Return a proxy so that any calls on the returned object (including
40 // destructor) happen on the signaling thread. 46 // destructor) happen on the signaling thread.
41 return OrtcFactoryProxy::Create(new_factory->signaling_thread(), 47 return OrtcFactoryProxy::Create(new_factory->signaling_thread(),
42 new_factory->network_thread(), new_factory); 48 new_factory->network_thread(), new_factory);
43 } 49 }
44 50
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 LOG(LS_INFO) << "Created UDP socket with address " 116 LOG(LS_INFO) << "Created UDP socket with address "
111 << socket->GetLocalAddress().ToSensitiveString() << "."; 117 << socket->GetLocalAddress().ToSensitiveString() << ".";
112 // Use proxy so that calls to the returned object are invoked on the network 118 // Use proxy so that calls to the returned object are invoked on the network
113 // thread. 119 // thread.
114 return UdpTransportProxy::Create( 120 return UdpTransportProxy::Create(
115 signaling_thread_, network_thread_, 121 signaling_thread_, network_thread_,
116 new cricket::UdpTransport(std::string(), std::move(socket))); 122 new cricket::UdpTransport(std::string(), std::move(socket)));
117 } 123 }
118 124
119 } // namespace webrtc 125 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/template_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698