Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_PEPPER_P2P_CHANNEL_H_ | |
| 6 #define REMOTING_PROTOCOL_PEPPER_P2P_CHANNEL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/threading/non_thread_safe.h" | |
| 13 #include "net/socket/socket.h" | |
| 14 | |
| 15 namespace pp { | |
| 16 class Instance; | |
| 17 class Transport_Dev; | |
| 18 } // namespace pp | |
| 19 | |
| 20 namespace remoting { | |
| 21 | |
|
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
| |
| 22 // This class create P2PChannel based on the Pepper P2P Transport API | |
| 23 // and provides net::Socket interface on top of it. | |
| 24 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
| |
| 25 public net::Socket { | |
| 26 public: | |
| 27 // TODO(sergeyu): Parse candidate objects and use cricket::Candidate | |
| 28 // 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
| |
| 29 typedef base::Callback<void(const std::string&)> IncomingCandidateCallback; | |
| 30 | |
| 31 PepperP2PChannel(pp::Instance* pp_instance, const char* name, | |
| 32 const IncomingCandidateCallback& candidate_callback); | |
| 33 virtual ~PepperP2PChannel(); | |
| 34 | |
| 35 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.
| |
| 36 | |
| 37 // net::Socket interface. | |
| 38 virtual int Read(net::IOBuffer* buf, int buf_len, | |
| 39 net::CompletionCallback* callback); | |
| 40 virtual int Write(net::IOBuffer* buf, int buf_len, | |
| 41 net::CompletionCallback* callback); | |
| 42 virtual bool SetReceiveBufferSize(int32 size); | |
| 43 virtual bool SetSendBufferSize(int32 size); | |
| 44 | |
| 45 private: | |
| 46 // Callbacks for PPAPI calls. | |
| 47 static void NextAddressCallback(void* data, int32_t result); | |
| 48 static void ReadCallback(void* data, int32_t result); | |
| 49 static void WriteCallback(void* data, int32_t result); | |
| 50 | |
| 51 void ProcessCandidates(); | |
| 52 | |
| 53 IncomingCandidateCallback candidate_callback_; | |
| 54 | |
| 55 scoped_ptr<pp::Transport_Dev> transport_; | |
| 56 | |
| 57 net::CompletionCallback* read_callback_; | |
| 58 scoped_refptr<net::IOBuffer> read_buffer_; | |
| 59 | |
| 60 net::CompletionCallback* write_callback_; | |
| 61 scoped_refptr<net::IOBuffer> write_buffer_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(PepperP2PChannel); | |
| 64 }; | |
| 65 | |
| 66 } // namespace remoting | |
| 67 | |
| 68 #endif // REMOTING_PROTOCOL_PEPPER_P2P_CHANNEL_H_ | |
| OLD | NEW |