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

Side by Side Diff: remoting/host/cast_extension_session.cc

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: Created 4 years, 12 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
OLDNEW
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/host/cast_extension_session.h" 5 #include "remoting/host/cast_extension_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 scoped_ptr<CastExtensionSession> cast_extension_session( 174 scoped_ptr<CastExtensionSession> cast_extension_session(
175 new CastExtensionSession(caller_task_runner, 175 new CastExtensionSession(caller_task_runner,
176 url_request_context_getter, 176 url_request_context_getter,
177 network_settings, 177 network_settings,
178 client_session_control, 178 client_session_control,
179 client_stub)); 179 client_stub));
180 if (!cast_extension_session->WrapTasksAndSave() || 180 if (!cast_extension_session->WrapTasksAndSave() ||
181 !cast_extension_session->InitializePeerConnection()) { 181 !cast_extension_session->InitializePeerConnection()) {
182 return nullptr; 182 return nullptr;
183 } 183 }
184 return cast_extension_session.Pass(); 184 return cast_extension_session;
185 } 185 }
186 186
187 void CastExtensionSession::OnCreateSessionDescription( 187 void CastExtensionSession::OnCreateSessionDescription(
188 webrtc::SessionDescriptionInterface* desc) { 188 webrtc::SessionDescriptionInterface* desc) {
189 if (!caller_task_runner_->BelongsToCurrentThread()) { 189 if (!caller_task_runner_->BelongsToCurrentThread()) {
190 caller_task_runner_->PostTask( 190 caller_task_runner_->PostTask(
191 FROM_HERE, 191 FROM_HERE,
192 base::Bind(&CastExtensionSession::OnCreateSessionDescription, 192 base::Bind(&CastExtensionSession::OnCreateSessionDescription,
193 base::Unretained(this), 193 base::Unretained(this),
194 desc)); 194 desc));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 scoped_ptr<webrtc::DesktopCapturer>* capturer) { 228 scoped_ptr<webrtc::DesktopCapturer>* capturer) {
229 if (has_grabbed_capturer_) { 229 if (has_grabbed_capturer_) {
230 LOG(ERROR) << "The video pipeline was reset unexpectedly."; 230 LOG(ERROR) << "The video pipeline was reset unexpectedly.";
231 has_grabbed_capturer_ = false; 231 has_grabbed_capturer_ = false;
232 peer_connection_->RemoveStream(stream_.release()); 232 peer_connection_->RemoveStream(stream_.release());
233 return; 233 return;
234 } 234 }
235 235
236 if (received_offer_) { 236 if (received_offer_) {
237 has_grabbed_capturer_ = true; 237 has_grabbed_capturer_ = true;
238 if (SetupVideoStream(capturer->Pass())) { 238 if (SetupVideoStream(std::move(*capturer))) {
239 peer_connection_->CreateAnswer(create_session_desc_observer_, nullptr); 239 peer_connection_->CreateAnswer(create_session_desc_observer_, nullptr);
240 } else { 240 } else {
241 has_grabbed_capturer_ = false; 241 has_grabbed_capturer_ = false;
242 // Ignore the received offer, since we failed to setup a video stream. 242 // Ignore the received offer, since we failed to setup a video stream.
243 received_offer_ = false; 243 received_offer_ = false;
244 } 244 }
245 return; 245 return;
246 } 246 }
247 } 247 }
248 248
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { 520 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) {
521 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 521 DCHECK(caller_task_runner_->BelongsToCurrentThread());
522 DCHECK(desktop_capturer); 522 DCHECK(desktop_capturer);
523 523
524 if (stream_) { 524 if (stream_) {
525 VLOG(1) << "Already added MediaStream. Aborting Setup."; 525 VLOG(1) << "Already added MediaStream. Aborting Setup.";
526 return false; 526 return false;
527 } 527 }
528 528
529 scoped_ptr<WebrtcVideoCapturerAdapter> video_capturer_adapter( 529 scoped_ptr<WebrtcVideoCapturerAdapter> video_capturer_adapter(
530 new WebrtcVideoCapturerAdapter(desktop_capturer.Pass())); 530 new WebrtcVideoCapturerAdapter(std::move(desktop_capturer)));
531 531
532 // Set video stream constraints. 532 // Set video stream constraints.
533 webrtc::FakeConstraints video_constraints; 533 webrtc::FakeConstraints video_constraints;
534 video_constraints.AddMandatory( 534 video_constraints.AddMandatory(
535 webrtc::MediaConstraintsInterface::kMinFrameRate, kMinFramesPerSecond); 535 webrtc::MediaConstraintsInterface::kMinFrameRate, kMinFramesPerSecond);
536 536
537 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track = 537 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track =
538 peer_conn_factory_->CreateVideoTrack( 538 peer_conn_factory_->CreateVideoTrack(
539 kVideoLabel, 539 kVideoLabel,
540 peer_conn_factory_->CreateVideoSource( 540 peer_conn_factory_->CreateVideoSource(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 json.SetString(kWebRtcCandidate, candidate_str); 644 json.SetString(kWebRtcCandidate, candidate_str);
645 std::string json_str; 645 std::string json_str;
646 if (!base::JSONWriter::Write(json, &json_str)) { 646 if (!base::JSONWriter::Write(json, &json_str)) {
647 LOG(ERROR) << "Failed to serialize candidate message."; 647 LOG(ERROR) << "Failed to serialize candidate message.";
648 return; 648 return;
649 } 649 }
650 SendMessageToClient(kSubjectNewCandidate, json_str); 650 SendMessageToClient(kSubjectNewCandidate, json_str);
651 } 651 }
652 652
653 } // namespace remoting 653 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698