| OLD | NEW |
| (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* signaling_thread, | |
| 28 rtc::NetworkManager* network_manager, | |
| 29 rtc::PacketSocketFactory* socket_factory); | |
| 30 ~OrtcFactory() override; | |
| 31 std::unique_ptr<UdpTransportInterface> | |
| 32 CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override; | |
| 33 | |
| 34 rtc::Thread* network_thread() { return network_thread_; } | |
| 35 rtc::Thread* worker_thread() { return owned_worker_thread_.get(); } | |
| 36 rtc::Thread* signaling_thread() { return signaling_thread_; } | |
| 37 | |
| 38 private: | |
| 39 rtc::Thread* network_thread_; | |
| 40 rtc::Thread* signaling_thread_; | |
| 41 rtc::NetworkManager* network_manager_; | |
| 42 rtc::PacketSocketFactory* socket_factory_; | |
| 43 // If we created/own the objects above, these will be non-null and thus will | |
| 44 // be released automatically upon destruction. | |
| 45 std::unique_ptr<rtc::Thread> owned_network_thread_; | |
| 46 std::unique_ptr<rtc::Thread> owned_worker_thread_; | |
| 47 bool wraps_signaling_thread_ = false; | |
| 48 std::unique_ptr<rtc::NetworkManager> owned_network_manager_; | |
| 49 std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_; | |
| 50 RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory); | |
| 51 }; | |
| 52 | |
| 53 BEGIN_OWNED_PROXY_MAP(OrtcFactory) | |
| 54 PROXY_SIGNALING_THREAD_DESTRUCTOR() | |
| 55 PROXY_METHOD3(std::unique_ptr<UdpTransportInterface>, | |
| 56 CreateUdpTransport, | |
| 57 int, | |
| 58 uint16_t, | |
| 59 uint16_t) | |
| 60 END_PROXY_MAP() | |
| 61 | |
| 62 } // namespace webrtc | |
| 63 | |
| 64 #endif // WEBRTC_API_ORTCFACTORY_H_ | |
| OLD | NEW |