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

Side by Side Diff: webrtc/api/ortcfactory.h

Issue 2632613002: Adding OrtcFactory, and changing UdpTransport to match current plan. (Closed)
Patch Set: Adding OrtcFactoryInterface and factory method Created 3 years, 11 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_API_ORTCFACTORY_H_
12 #define WEBRTC_API_ORTCFACTORY_H_
13
14 #include <memory>
15
16 #include "webrtc/api/ortcfactoryinterface.h"
17 #include "webrtc/base/constructormagic.h"
18
19 namespace webrtc {
20
21 // Implementation of OrtcFactoryInterface.
22 //
23 // See ortcfactoryinterface.h for documentation.
24 class OrtcFactory : public OrtcFactoryInterface {
25 public:
26 OrtcFactory(rtc::Thread* network_thread,
27 rtc::Thread* worker_thread,
28 rtc::Thread* signaling_thread,
29 rtc::NetworkManager* network_manager,
30 rtc::PacketSocketFactory* socket_factory);
31 ~OrtcFactory() override;
32 std::unique_ptr<UdpTransportInterface>
33 CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override;
34
35 rtc::Thread* network_thread() { return network_thread_; }
36 rtc::Thread* worker_thread() { return worker_thread_; }
37 rtc::Thread* signaling_thread() { return signaling_thread_; }
38
39 private:
40 rtc::Thread* network_thread_;
41 rtc::Thread* worker_thread_;
42 rtc::Thread* signaling_thread_;
43 rtc::NetworkManager* network_manager_;
44 rtc::PacketSocketFactory* socket_factory_;
45 // If we created/own the objects above, these will be non-null and thus will
46 // be released automatically upon destruction.
47 std::unique_ptr<rtc::Thread> owned_network_thread_;
48 std::unique_ptr<rtc::Thread> owned_worker_thread_;
49 bool wraps_signaling_thread_ = false;
50 std::unique_ptr<rtc::NetworkManager> owned_network_manager_;
51 std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
52 RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory);
53 };
54
55 BEGIN_OWNED_PROXY_MAP(OrtcFactory)
56 PROXY_SIGNALING_THREAD_DESTRUCTOR()
57 PROXY_METHOD3(std::unique_ptr<UdpTransportInterface>,
58 CreateUdpTransport,
59 int,
60 uint16_t,
61 uint16_t)
62 END_PROXY_MAP()
63
64 } // namespace webrtc
65
66 #endif // WEBRTC_API_ORTCFACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698