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

Unified Diff: webrtc/api/ortcfactory.h

Issue 2632613002: Adding OrtcFactory, and changing UdpTransport to match current plan. (Closed)
Patch Set: Rebase and remove worker_thread from API 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/BUILD.gn ('k') | webrtc/api/ortcfactory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/ortcfactory.h
diff --git a/webrtc/api/ortcfactory.h b/webrtc/api/ortcfactory.h
new file mode 100644
index 0000000000000000000000000000000000000000..dc92774ff4a3d3cc19470d6e9545e1aae0dc8c27
--- /dev/null
+++ b/webrtc/api/ortcfactory.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_API_ORTCFACTORY_H_
+#define WEBRTC_API_ORTCFACTORY_H_
+
+#include <memory>
+
+#include "webrtc/api/ortcfactoryinterface.h"
+#include "webrtc/base/constructormagic.h"
+
+namespace webrtc {
+
+// Implementation of OrtcFactoryInterface.
+//
+// See ortcfactoryinterface.h for documentation.
+class OrtcFactory : public OrtcFactoryInterface {
+ public:
+ OrtcFactory(rtc::Thread* network_thread,
+ rtc::Thread* signaling_thread,
+ rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory);
+ ~OrtcFactory() override;
+ std::unique_ptr<UdpTransportInterface>
+ CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override;
+
+ rtc::Thread* network_thread() { return network_thread_; }
+ rtc::Thread* worker_thread() { return owned_worker_thread_.get(); }
+ rtc::Thread* signaling_thread() { return signaling_thread_; }
+
+ private:
+ rtc::Thread* network_thread_;
+ rtc::Thread* signaling_thread_;
+ rtc::NetworkManager* network_manager_;
+ rtc::PacketSocketFactory* socket_factory_;
+ // If we created/own the objects above, these will be non-null and thus will
+ // be released automatically upon destruction.
+ std::unique_ptr<rtc::Thread> owned_network_thread_;
+ std::unique_ptr<rtc::Thread> owned_worker_thread_;
+ bool wraps_signaling_thread_ = false;
+ std::unique_ptr<rtc::NetworkManager> owned_network_manager_;
+ std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
+ RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory);
+};
+
+BEGIN_OWNED_PROXY_MAP(OrtcFactory)
+ PROXY_SIGNALING_THREAD_DESTRUCTOR()
+ PROXY_METHOD3(std::unique_ptr<UdpTransportInterface>,
+ CreateUdpTransport,
+ int,
+ uint16_t,
+ uint16_t)
+END_PROXY_MAP()
+
+} // namespace webrtc
+
+#endif // WEBRTC_API_ORTCFACTORY_H_
« no previous file with comments | « webrtc/api/BUILD.gn ('k') | webrtc/api/ortcfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698