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_stream_socket.h" | 5 #include "remoting/protocol/fake_stream_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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 | 180 |
181 if (fail_create_) | 181 if (fail_create_) |
182 channel.reset(); | 182 channel.reset(); |
183 | 183 |
184 if (asynchronous_create_) { | 184 if (asynchronous_create_) { |
185 task_runner_->PostTask(FROM_HERE, base::Bind( | 185 task_runner_->PostTask(FROM_HERE, base::Bind( |
186 &FakeStreamChannelFactory::NotifyChannelCreated, | 186 &FakeStreamChannelFactory::NotifyChannelCreated, |
187 weak_factory_.GetWeakPtr(), base::Passed(&channel), name, callback)); | 187 weak_factory_.GetWeakPtr(), base::Passed(&channel), name, callback)); |
188 } else { | 188 } else { |
189 NotifyChannelCreated(channel.Pass(), name, callback); | 189 NotifyChannelCreated(std::move(channel), name, callback); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 void FakeStreamChannelFactory::NotifyChannelCreated( | 193 void FakeStreamChannelFactory::NotifyChannelCreated( |
194 scoped_ptr<FakeStreamSocket> owned_channel, | 194 scoped_ptr<FakeStreamSocket> owned_channel, |
195 const std::string& name, | 195 const std::string& name, |
196 const ChannelCreatedCallback& callback) { | 196 const ChannelCreatedCallback& callback) { |
197 if (channels_.find(name) != channels_.end()) | 197 if (channels_.find(name) != channels_.end()) |
198 callback.Run(owned_channel.Pass()); | 198 callback.Run(std::move(owned_channel)); |
199 } | 199 } |
200 | 200 |
201 void FakeStreamChannelFactory::CancelChannelCreation(const std::string& name) { | 201 void FakeStreamChannelFactory::CancelChannelCreation(const std::string& name) { |
202 channels_.erase(name); | 202 channels_.erase(name); |
203 } | 203 } |
204 | 204 |
205 } // namespace protocol | 205 } // namespace protocol |
206 } // namespace remoting | 206 } // namespace remoting |
OLD | NEW |