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

Unified Diff: remoting/protocol/channel_factory.h

Issue 10830046: Implement ChannelMultiplexer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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: remoting/protocol/channel_factory.h
diff --git a/remoting/protocol/channel_factory.h b/remoting/protocol/channel_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..13e928e8415f0d57659538566bd01ac6ae75d586
--- /dev/null
+++ b/remoting/protocol/channel_factory.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 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 REMOTING_PROTOCOL_CHANNEL_FACTORY_H_
+#define REMOTING_PROTOCOL_CHANNEL_FACTORY_H_
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
+
+namespace net {
+class Socket;
+class StreamSocket;
+} // namespace net
+
+namespace remoting {
+namespace protocol {
+
+class ChannelFactory : public base::NonThreadSafe {
Wez 2012/08/06 23:14:07 nit: Why is NonThreadSafe part of this interface?
Sergey Ulanov 2012/08/07 20:12:22 To make it clear that this interface is not thread
+ public:
+ // TODO(sergeyu): Specify connection error code when channel
+ // connection fails.
+ typedef base::Callback<void(scoped_ptr<net::StreamSocket>)>
+ StreamChannelCallback;
+ typedef base::Callback<void(scoped_ptr<net::Socket>)>
+ DatagramChannelCallback;
+
+ ChannelFactory() {}
+ virtual ~ChannelFactory() {}
Wez 2012/08/06 23:14:07 Is the caller really responsible for the lifetime
Sergey Ulanov 2012/08/07 20:12:22 Done.
+
+ // Creates new channels for this connection. The specified callback
+ // is called when then new channel is created and connected. The
+ // callback is called with NULL if connection failed for any reason.
+ // All channels must be destroyed before the session is
+ // destroyed. Can be called only when in CONNECTING, CONNECTED or
+ // AUTHENTICATED states.
Wez 2012/08/06 23:14:07 nit: This comment refers to sessions and session s
Wez 2012/08/06 23:14:07 nit: Clarify that it's acceptable for implementati
Sergey Ulanov 2012/08/07 20:12:22 Cleaned up that comment.
Sergey Ulanov 2012/08/07 20:12:22 Done.
+ virtual void CreateStreamChannel(
+ const std::string& name, const StreamChannelCallback& callback) = 0;
+ virtual void CreateDatagramChannel(
+ const std::string& name, const DatagramChannelCallback& callback) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ChannelFactory);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_CHANNEL_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698