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

Unified Diff: net/quic/quartc/quartc_factory_interface.h

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Fix the issues when testing with WebRTC. Created 4 years, 2 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
Index: net/quic/quartc/quartc_factory_interface.h
diff --git a/net/quic/quartc/quartc_factory_interface.h b/net/quic/quartc/quartc_factory_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..be744e9ce2da14cf4e478b9faa0debaf21181b47
--- /dev/null
+++ b/net/quic/quartc/quartc_factory_interface.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_
+#define NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_
+
+#include "net/base/net_export.h"
zhihuang1 2016/10/13 06:22:41 Same as before. This is a stand-alone header with
+#include "net/quic/quartc/quartc_session_interface.h"
+#include "net/quic/quartc/quartc_task_runner_interface.h"
+
+namespace net {
+
+// Used to create instances for Quartc objects such as QuartcSession.
+class QuartcFactoryInterface {
+ public:
+ virtual ~QuartcFactoryInterface() {}
+
+ struct QuartcSessionConfig {
+ // When using Quartc, there are two endpoints. The QuartcSession on one
+ // endpoint must act as a server and the one on the other side must act as a
+ // client.
+ bool is_server = false;
+ // This is only needed when is_server = false. It must be unique
+ // for each endpoint the local endpoint may communicate with. For example,
+ // a WebRTC client could use the remote endpoint's crypto fingerprint
+ std::string unique_remote_server_id;
+ // The way the QuicConnection will send and receive packets, like a virtual
+ // UDP socket. For WebRTC, this will typically be an IceTransport.
+ QuartcSessionInterface::PacketTransport* packet_transport = nullptr;
+ };
+
+ virtual std::unique_ptr<QuartcSessionInterface> CreateQuartcSession(
+ const QuartcSessionConfig& quartc_config) = 0;
+};
+
+// The configuration for creating a QuartcFactory.
+struct QuartcFactoryConfig {
+ // The task runner used by the QuartcAlarm. Implemented by the Quartc user
+ // with different mechanism. For example in WebRTC, it is implemented with
+ // rtc::Thread.
+ QuartcTaskRunnerInterface* quartc_task_runner;
pthatcher1 2016/10/14 18:59:00 "task_runner" is probably sufficient. And should
zhihuang1 2016/10/16 00:45:28 I removed the "=nullptr" from other classes becaus
+};
+
+// Creates a new instance of QuartcFactoryInterface.
+NET_EXPORT_PRIVATE std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory(
+ const QuartcFactoryConfig& factory_config);
+
+} // namepace net
+
+#endif // NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698