OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/fake_datagram_socket.h" | 5 #include "remoting/protocol/fake_datagram_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 if (fail_create_) | 168 if (fail_create_) |
169 channel.reset(); | 169 channel.reset(); |
170 | 170 |
171 if (asynchronous_create_) { | 171 if (asynchronous_create_) { |
172 task_runner_->PostTask( | 172 task_runner_->PostTask( |
173 FROM_HERE, | 173 FROM_HERE, |
174 base::Bind(&FakeDatagramChannelFactory::NotifyChannelCreated, | 174 base::Bind(&FakeDatagramChannelFactory::NotifyChannelCreated, |
175 weak_factory_.GetWeakPtr(), base::Passed(&channel), | 175 weak_factory_.GetWeakPtr(), base::Passed(&channel), |
176 name, callback)); | 176 name, callback)); |
177 } else { | 177 } else { |
178 NotifyChannelCreated(channel.Pass(), name, callback); | 178 NotifyChannelCreated(std::move(channel), name, callback); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 void FakeDatagramChannelFactory::NotifyChannelCreated( | 182 void FakeDatagramChannelFactory::NotifyChannelCreated( |
183 scoped_ptr<FakeDatagramSocket> owned_socket, | 183 scoped_ptr<FakeDatagramSocket> owned_socket, |
184 const std::string& name, | 184 const std::string& name, |
185 const ChannelCreatedCallback& callback) { | 185 const ChannelCreatedCallback& callback) { |
186 if (channels_.find(name) != channels_.end()) | 186 if (channels_.find(name) != channels_.end()) |
187 callback.Run(owned_socket.Pass()); | 187 callback.Run(std::move(owned_socket)); |
188 } | 188 } |
189 | 189 |
190 void FakeDatagramChannelFactory::CancelChannelCreation( | 190 void FakeDatagramChannelFactory::CancelChannelCreation( |
191 const std::string& name) { | 191 const std::string& name) { |
192 channels_.erase(name); | 192 channels_.erase(name); |
193 } | 193 } |
194 | 194 |
195 } // namespace protocol | 195 } // namespace protocol |
196 } // namespace remoting | 196 } // namespace remoting |
OLD | NEW |