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

Side by Side Diff: remoting/protocol/pepper_transport_socket_adapter.cc

Issue 7778022: Chromoting protocol implementation based on P2P Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/pepper_transport_socket_adapter.h" 5 #include "remoting/protocol/pepper_transport_socket_adapter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/address_list.h"
8 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
9 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/base/net_util.h"
10 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
11 #include "ppapi/cpp/dev/transport_dev.h" 13 #include "ppapi/cpp/dev/transport_dev.h"
12 #include "ppapi/cpp/var.h" 14 #include "ppapi/cpp/var.h"
13 15
14 namespace remoting { 16 namespace remoting {
15 namespace protocol { 17 namespace protocol {
16 18
17 namespace { 19 namespace {
18 20
19 const char kTcpProtocol[] = "tcp"; 21 const char kTcpProtocol[] = "tcp";
(...skipping 12 matching lines...) Expand all
32 case PP_ERROR_NOINTERFACE: 34 case PP_ERROR_NOINTERFACE:
33 return net::ERR_NOT_IMPLEMENTED; 35 return net::ERR_NOT_IMPLEMENTED;
34 default: 36 default:
35 return net::ERR_FAILED; 37 return net::ERR_FAILED;
36 } 38 }
37 } 39 }
38 40
39 } // namespace 41 } // namespace
40 42
41 PepperTransportSocketAdapter::PepperTransportSocketAdapter( 43 PepperTransportSocketAdapter::PepperTransportSocketAdapter(
42 pp::Instance* pp_instance, 44 pp::Transport_Dev* transport,
43 const std::string& name, 45 const std::string& name,
44 Observer* observer) 46 Observer* observer)
45 : name_(name), 47 : name_(name),
46 observer_(observer), 48 observer_(observer),
49 transport_(transport),
47 connected_(false), 50 connected_(false),
48 get_address_pending_(false), 51 get_address_pending_(false),
49 read_callback_(NULL), 52 read_callback_(NULL),
50 write_callback_(NULL) { 53 write_callback_(NULL) {
51 callback_factory_.Initialize(this); 54 callback_factory_.Initialize(this);
52 transport_.reset(new pp::Transport_Dev(
53 pp_instance, name_.c_str(), kTcpProtocol));
54 } 55 }
55 56
56 PepperTransportSocketAdapter::~PepperTransportSocketAdapter() { 57 PepperTransportSocketAdapter::~PepperTransportSocketAdapter() {
57 observer_->OnChannelDeleted(); 58 observer_->OnChannelDeleted();
58 } 59 }
59 60
60 void PepperTransportSocketAdapter::AddRemoteCandidate( 61 void PepperTransportSocketAdapter::AddRemoteCandidate(
61 const std::string& candidate) { 62 const std::string& candidate) {
62 DCHECK(CalledOnValidThread()); 63 DCHECK(CalledOnValidThread());
63 transport_->ReceiveRemoteAddress(candidate); 64 transport_->ReceiveRemoteAddress(candidate);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return connected_; 142 return connected_;
142 } 143 }
143 144
144 bool PepperTransportSocketAdapter::IsConnectedAndIdle() const { 145 bool PepperTransportSocketAdapter::IsConnectedAndIdle() const {
145 NOTIMPLEMENTED(); 146 NOTIMPLEMENTED();
146 return false; 147 return false;
147 } 148 }
148 149
149 int PepperTransportSocketAdapter::GetPeerAddress( 150 int PepperTransportSocketAdapter::GetPeerAddress(
150 net::AddressList* address) const { 151 net::AddressList* address) const {
151 NOTIMPLEMENTED(); 152 // We actually don't know the peer address. Returning so the upper layers
152 return net::ERR_FAILED; 153 // won't complain.
Wez 2011/09/09 23:39:12 nit: Wording. "We don't have a meaningful peer add
Sergey Ulanov 2011/09/12 19:50:50 This comment was copied from pseudotcp_adapter.cc.
154 net::IPAddressNumber ip_address(4);
155 *address = net::AddressList::CreateFromIPAddress(ip_address, 0);
156 return net::OK;
153 } 157 }
154 158
155 int PepperTransportSocketAdapter::GetLocalAddress( 159 int PepperTransportSocketAdapter::GetLocalAddress(
156 net::IPEndPoint* address) const { 160 net::IPEndPoint* address) const {
157 NOTIMPLEMENTED(); 161 NOTIMPLEMENTED();
158 return net::ERR_FAILED; 162 return net::ERR_FAILED;
159 } 163 }
160 164
161 const net::BoundNetLog& PepperTransportSocketAdapter::NetLog() const { 165 const net::BoundNetLog& PepperTransportSocketAdapter::NetLog() const {
162 return net_log_; 166 return net_log_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 DCHECK(write_buffer_); 254 DCHECK(write_buffer_);
251 255
252 net::CompletionCallback* callback = write_callback_; 256 net::CompletionCallback* callback = write_callback_;
253 write_callback_ = NULL; 257 write_callback_ = NULL;
254 write_buffer_ = NULL; 258 write_buffer_ = NULL;
255 callback->Run(PPErrorToNetError(result)); 259 callback->Run(PPErrorToNetError(result));
256 } 260 }
257 261
258 } // namespace protocol 262 } // namespace protocol
259 } // namespace remoting 263 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698