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

Side by Side Diff: chrome/renderer/extensions/cast_streaming_native_handler.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/extensions/cast_streaming_native_handler.h" 5 #include "chrome/renderer/extensions/cast_streaming_native_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <algorithm> 9 #include <algorithm>
11 #include <functional> 10 #include <functional>
12 #include <iterator> 11 #include <iterator>
13 #include <string> 12 #include <string>
13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
21 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
22 #include "chrome/common/extensions/api/cast_streaming_receiver_session.h" 22 #include "chrome/common/extensions/api/cast_streaming_receiver_session.h"
23 #include "chrome/common/extensions/api/cast_streaming_rtp_stream.h" 23 #include "chrome/common/extensions/api/cast_streaming_rtp_stream.h"
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidAudioParams))); 812 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidAudioParams)));
813 return; 813 return;
814 } 814 }
815 815
816 scoped_ptr<base::DictionaryValue> options; 816 scoped_ptr<base::DictionaryValue> options;
817 if (args.Length() >= 9) { 817 if (args.Length() >= 9) {
818 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 818 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
819 scoped_ptr<base::Value> options_value( 819 scoped_ptr<base::Value> options_value(
820 converter->FromV8Value(args[8], context()->v8_context())); 820 converter->FromV8Value(args[8], context()->v8_context()));
821 if (!options_value->IsType(base::Value::TYPE_NULL)) { 821 if (!options_value->IsType(base::Value::TYPE_NULL)) {
822 options = base::DictionaryValue::From(options_value.Pass()); 822 options = base::DictionaryValue::From(std::move(options_value));
823 if (!options) { 823 if (!options) {
824 args.GetIsolate()->ThrowException(v8::Exception::TypeError( 824 args.GetIsolate()->ThrowException(v8::Exception::TypeError(
825 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs))); 825 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs)));
826 return; 826 return;
827 } 827 }
828 } 828 }
829 } 829 }
830 830
831 if (!options) { 831 if (!options) {
832 options.reset(new base::DictionaryValue()); 832 options.reset(new base::DictionaryValue());
833 } 833 }
834 834
835 v8::CopyablePersistentTraits<v8::Function>::CopyablePersistent error_callback; 835 v8::CopyablePersistentTraits<v8::Function>::CopyablePersistent error_callback;
836 error_callback.Reset(args.GetIsolate(), 836 error_callback.Reset(args.GetIsolate(),
837 v8::Local<v8::Function>(args[7].As<v8::Function>())); 837 v8::Local<v8::Function>(args[7].As<v8::Function>()));
838 838
839 session->Start( 839 session->Start(
840 audio_config, video_config, local_endpoint, remote_endpoint, 840 audio_config, video_config, local_endpoint, remote_endpoint,
841 options.Pass(), capture_format, 841 std::move(options), capture_format,
842 base::Bind(&CastStreamingNativeHandler::AddTracksToMediaStream, 842 base::Bind(&CastStreamingNativeHandler::AddTracksToMediaStream,
843 weak_factory_.GetWeakPtr(), url, params), 843 weak_factory_.GetWeakPtr(), url, params),
844 base::Bind(&CastStreamingNativeHandler::CallReceiverErrorCallback, 844 base::Bind(&CastStreamingNativeHandler::CallReceiverErrorCallback,
845 weak_factory_.GetWeakPtr(), error_callback)); 845 weak_factory_.GetWeakPtr(), error_callback));
846 } 846 }
847 847
848 void CastStreamingNativeHandler::CallReceiverErrorCallback( 848 void CastStreamingNativeHandler::CallReceiverErrorCallback(
849 v8::CopyablePersistentTraits<v8::Function>::CopyablePersistent function, 849 v8::CopyablePersistentTraits<v8::Function>::CopyablePersistent function,
850 const std::string& error_message) { 850 const std::string& error_message) {
851 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); 851 v8::Isolate* isolate = context()->v8_context()->GetIsolate();
852 v8::Local<v8::Value> arg = v8::String::NewFromUtf8(isolate, 852 v8::Local<v8::Value> arg = v8::String::NewFromUtf8(isolate,
853 error_message.data(), 853 error_message.data(),
854 v8::String::kNormalString, 854 v8::String::kNormalString,
855 error_message.size()); 855 error_message.size());
856 context()->CallFunction( 856 context()->CallFunction(
857 v8::Local<v8::Function>::New(isolate, function), 1, &arg); 857 v8::Local<v8::Function>::New(isolate, function), 1, &arg);
858 } 858 }
859 859
860 860
861 void CastStreamingNativeHandler::AddTracksToMediaStream( 861 void CastStreamingNativeHandler::AddTracksToMediaStream(
862 const std::string& url, 862 const std::string& url,
863 const media::AudioParameters& params, 863 const media::AudioParameters& params,
864 scoped_refptr<media::AudioCapturerSource> audio, 864 scoped_refptr<media::AudioCapturerSource> audio,
865 scoped_ptr<media::VideoCapturerSource> video) { 865 scoped_ptr<media::VideoCapturerSource> video) {
866 content::AddAudioTrackToMediaStream(audio, params, true, true, url); 866 content::AddAudioTrackToMediaStream(audio, params, true, true, url);
867 content::AddVideoTrackToMediaStream(video.Pass(), true, true, url); 867 content::AddVideoTrackToMediaStream(std::move(video), true, true, url);
868 } 868 }
869 869
870 } // namespace extensions 870 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698