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

Unified Diff: remoting/protocol/pepper_p2p_channel.h

Issue 7200037: Channel adapter for Pepper P2P Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update DEPS Created 9 years, 6 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 | « remoting/protocol/DEPS ('k') | remoting/protocol/pepper_p2p_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pepper_p2p_channel.h
diff --git a/remoting/protocol/pepper_p2p_channel.h b/remoting/protocol/pepper_p2p_channel.h
new file mode 100644
index 0000000000000000000000000000000000000000..b818bc896e238832d4eb53a37f2963ed3d90f842
--- /dev/null
+++ b/remoting/protocol/pepper_p2p_channel.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2011 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_PEPPER_P2P_CHANNEL_H_
+#define REMOTING_PROTOCOL_PEPPER_P2P_CHANNEL_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
+#include "net/socket/socket.h"
+#include "ppapi/c/pp_stdint.h"
+
+namespace pp {
+class Instance;
+class Transport_Dev;
+} // namespace pp
+
+namespace remoting {
+namespace protocol {
+
+// This class create P2PChannel based on the Pepper P2P Transport API
+// and provides net::Socket interface on top of it.
+class PepperP2PChannel : public base::NonThreadSafe,
+ public net::Socket {
+ public:
+ // TODO(sergeyu): Use cricket::Candidate instead of strings to
+ // represent candidates.
+ typedef base::Callback<void(const std::string&)> IncomingCandidateCallback;
+
+ PepperP2PChannel(pp::Instance* pp_instance, const char* name,
+ const IncomingCandidateCallback& candidate_callback);
+ virtual ~PepperP2PChannel();
+
+ bool Init();
+
+ // Adds candidate received from the peer.
+ void AddRemoteCandidate(const std::string& candidate);
+
+ // net::Socket interface.
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback);
+ virtual int Write(net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback);
+ virtual bool SetReceiveBufferSize(int32 size);
+ virtual bool SetSendBufferSize(int32 size);
+
+ private:
+ // Callbacks for PPAPI calls.
+ static void NextAddressCallback(void* data, int32_t result);
+ static void ReadCallback(void* data, int32_t result);
+ static void WriteCallback(void* data, int32_t result);
+
+ bool ProcessCandidates();
+
+ IncomingCandidateCallback candidate_callback_;
+
+ scoped_ptr<pp::Transport_Dev> transport_;
+
+ bool get_address_pending_;
+
+ net::CompletionCallback* read_callback_;
+ scoped_refptr<net::IOBuffer> read_buffer_;
+
+ net::CompletionCallback* write_callback_;
+ scoped_refptr<net::IOBuffer> write_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperP2PChannel);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_PEPPER_P2P_CHANNEL_H_
« no previous file with comments | « remoting/protocol/DEPS ('k') | remoting/protocol/pepper_p2p_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698