Chromium Code Reviews| 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..6f124446f23ff79c6e68397cd3bfaebb6c6a259b |
| --- /dev/null |
| +++ b/remoting/protocol/pepper_p2p_channel.h |
| @@ -0,0 +1,68 @@ |
| +// 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" |
| + |
| +namespace pp { |
| +class Instance; |
| +class Transport_Dev; |
| +} // namespace pp |
| + |
| +namespace remoting { |
| + |
|
Wez
2011/06/20 22:19:31
Missing "namespace protocol" here?
Does this code
Sergey Ulanov
2011/06/21 00:23:20
It has nothing to do with libjingle, and is unlike
|
| +// 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, |
|
Wez
2011/06/20 22:19:31
Since this implements net::Socket for Pepper P2P,
Sergey Ulanov
2011/06/21 00:23:20
"Channel" in the name is supposed to show that thi
|
| + public net::Socket { |
| + public: |
| + // TODO(sergeyu): Parse candidate objects and use cricket::Candidate |
| + // here? |
|
Wez
2011/06/20 22:19:31
This comment is on a typedef; are you saying that
Sergey Ulanov
2011/06/21 00:23:20
It applies to the the whole class, and to this cal
|
| + typedef base::Callback<void(const std::string&)> IncomingCandidateCallback; |
| + |
| + PepperP2PChannel(pp::Instance* pp_instance, const char* name, |
| + const IncomingCandidateCallback& candidate_callback); |
| + virtual ~PepperP2PChannel(); |
| + |
| + void AddRemoteCandidate(const std::string& candidate); |
|
Wez
2011/06/20 22:19:31
Document this API?
Sergey Ulanov
2011/06/21 00:23:20
Done.
|
| + |
| + // 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); |
| + |
| + void ProcessCandidates(); |
| + |
| + IncomingCandidateCallback candidate_callback_; |
| + |
| + scoped_ptr<pp::Transport_Dev> transport_; |
| + |
| + 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 remoting |
| + |
| +#endif // REMOTING_PROTOCOL_PEPPER_P2P_CHANNEL_H_ |