OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/webrtc_transport.h" | 5 #include "remoting/protocol/webrtc_transport.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "jingle/glue/thread_wrapper.h" | 9 #include "jingle/glue/thread_wrapper.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 void set_connected_callback(const base::Closure& callback) { | 44 void set_connected_callback(const base::Closure& callback) { |
45 connected_callback_ = callback; | 45 connected_callback_ = callback; |
46 } | 46 } |
47 void set_error_callback(const ErrorCallback& callback) { | 47 void set_error_callback(const ErrorCallback& callback) { |
48 error_callback_ = callback; | 48 error_callback_ = callback; |
49 } | 49 } |
50 | 50 |
51 // Transport::EventHandler interface. | 51 // Transport::EventHandler interface. |
52 void OnOutgoingTransportInfo(scoped_ptr<buzz::XmlElement> message) override { | 52 void OnOutgoingTransportInfo(scoped_ptr<buzz::XmlElement> message) override { |
53 transport_info_callback_.Run(message.Pass()); | 53 transport_info_callback_.Run(std::move(message)); |
54 } | 54 } |
55 void OnTransportRouteChange(const std::string& channel_name, | 55 void OnTransportRouteChange(const std::string& channel_name, |
56 const TransportRoute& route) override {} | 56 const TransportRoute& route) override {} |
57 void OnTransportConnected() override { | 57 void OnTransportConnected() override { |
58 connected_callback_.Run(); | 58 connected_callback_.Run(); |
59 } | 59 } |
60 void OnTransportError(ErrorCode error) override { | 60 void OnTransportError(ErrorCode error) override { |
61 error_callback_.Run(error); | 61 error_callback_.Run(error); |
62 } | 62 } |
63 | 63 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void CreateDataStream() { | 151 void CreateDataStream() { |
152 client_transport_->GetStreamChannelFactory()->CreateChannel( | 152 client_transport_->GetStreamChannelFactory()->CreateChannel( |
153 kChannelName, base::Bind(&WebrtcTransportTest::OnClientChannelCreated, | 153 kChannelName, base::Bind(&WebrtcTransportTest::OnClientChannelCreated, |
154 base::Unretained(this))); | 154 base::Unretained(this))); |
155 host_transport_->GetStreamChannelFactory()->CreateChannel( | 155 host_transport_->GetStreamChannelFactory()->CreateChannel( |
156 kChannelName, base::Bind(&WebrtcTransportTest::OnHostChannelCreated, | 156 kChannelName, base::Bind(&WebrtcTransportTest::OnHostChannelCreated, |
157 base::Unretained(this))); | 157 base::Unretained(this))); |
158 } | 158 } |
159 | 159 |
160 void OnClientChannelCreated(scoped_ptr<P2PStreamSocket> socket) { | 160 void OnClientChannelCreated(scoped_ptr<P2PStreamSocket> socket) { |
161 client_socket_ = socket.Pass(); | 161 client_socket_ = std::move(socket); |
162 if (run_loop_ && host_socket_) | 162 if (run_loop_ && host_socket_) |
163 run_loop_->Quit(); | 163 run_loop_->Quit(); |
164 } | 164 } |
165 | 165 |
166 void OnHostChannelCreated(scoped_ptr<P2PStreamSocket> socket) { | 166 void OnHostChannelCreated(scoped_ptr<P2PStreamSocket> socket) { |
167 host_socket_ = socket.Pass(); | 167 host_socket_ = std::move(socket); |
168 if (run_loop_ && client_socket_) | 168 if (run_loop_ && client_socket_) |
169 run_loop_->Quit(); | 169 run_loop_->Quit(); |
170 } | 170 } |
171 | 171 |
172 void OnSessionError(ErrorCode error) { | 172 void OnSessionError(ErrorCode error) { |
173 error_ = error; | 173 error_ = error; |
174 run_loop_->Quit(); | 174 run_loop_->Quit(); |
175 } | 175 } |
176 | 176 |
177 void QuitRunLoopOnCounter(int* counter) { | 177 void QuitRunLoopOnCounter(int* counter) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 const int kMessages = 100; | 222 const int kMessages = 100; |
223 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), | 223 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
224 kMessageSize, kMessages); | 224 kMessageSize, kMessages); |
225 tester.Start(); | 225 tester.Start(); |
226 message_loop_.Run(); | 226 message_loop_.Run(); |
227 tester.CheckResults(); | 227 tester.CheckResults(); |
228 } | 228 } |
229 | 229 |
230 } // namespace protocol | 230 } // namespace protocol |
231 } // namespace remoting | 231 } // namespace remoting |
OLD | NEW |