OLD | NEW |
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/address_list.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 connect_callback_ = callback; | 133 connect_callback_ = callback; |
134 | 134 |
135 // This will return false when GetNextAddress() returns an | 135 // This will return false when GetNextAddress() returns an |
136 // error. This helps to detect when the P2P Transport API is not | 136 // error. This helps to detect when the P2P Transport API is not |
137 // supported. | 137 // supported. |
138 int result = ProcessCandidates(); | 138 int result = ProcessCandidates(); |
139 if (result != net::OK) | 139 if (result != net::OK) |
140 return result; | 140 return result; |
141 | 141 |
142 result = transport_->Connect( | 142 result = transport_->Connect( |
143 callback_factory_.NewRequiredCallback( | 143 callback_factory_.NewCallback(&PepperTransportSocketAdapter::OnConnect)); |
144 &PepperTransportSocketAdapter::OnConnect)); | |
145 DCHECK_EQ(result, PP_OK_COMPLETIONPENDING); | 144 DCHECK_EQ(result, PP_OK_COMPLETIONPENDING); |
146 | 145 |
147 return net::ERR_IO_PENDING; | 146 return net::ERR_IO_PENDING; |
148 } | 147 } |
149 | 148 |
150 void PepperTransportSocketAdapter::Disconnect() { | 149 void PepperTransportSocketAdapter::Disconnect() { |
151 DCHECK(CalledOnValidThread()); | 150 DCHECK(CalledOnValidThread()); |
152 transport_.reset(); | 151 transport_.reset(); |
153 } | 152 } |
154 | 153 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 DCHECK(write_buffer_); | 281 DCHECK(write_buffer_); |
283 | 282 |
284 net::CompletionCallback callback = write_callback_; | 283 net::CompletionCallback callback = write_callback_; |
285 write_callback_.Reset(); | 284 write_callback_.Reset(); |
286 write_buffer_ = NULL; | 285 write_buffer_ = NULL; |
287 callback.Run(PPErrorToNetError(result)); | 286 callback.Run(PPErrorToNetError(result)); |
288 } | 287 } |
289 | 288 |
290 } // namespace protocol | 289 } // namespace protocol |
291 } // namespace remoting | 290 } // namespace remoting |
OLD | NEW |