| OLD | NEW |
| 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 <functional> | 7 #include <functional> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 CHECK_EQ(2, args.Length()); | 255 CHECK_EQ(2, args.Length()); |
| 256 CHECK(args[0]->IsInt32()); | 256 CHECK(args[0]->IsInt32()); |
| 257 CHECK(args[1]->IsObject()); | 257 CHECK(args[1]->IsObject()); |
| 258 | 258 |
| 259 const int transport_id = args[0]->ToInt32()->Value(); | 259 const int transport_id = args[0]->ToInt32()->Value(); |
| 260 CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); | 260 CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); |
| 261 if (!transport) | 261 if (!transport) |
| 262 return; | 262 return; |
| 263 | 263 |
| 264 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 264 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 265 scoped_ptr<Value> params_value( | 265 scoped_ptr<base::Value> params_value( |
| 266 converter->FromV8Value(args[1], context()->v8_context())); | 266 converter->FromV8Value(args[1], context()->v8_context())); |
| 267 if (!params_value) { | 267 if (!params_value) { |
| 268 args.GetIsolate()->ThrowException(v8::Exception::TypeError( | 268 args.GetIsolate()->ThrowException(v8::Exception::TypeError( |
| 269 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertParams))); | 269 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertParams))); |
| 270 return; | 270 return; |
| 271 } | 271 } |
| 272 scoped_ptr<RtpParams> params = RtpParams::FromValue(*params_value); | 272 scoped_ptr<RtpParams> params = RtpParams::FromValue(*params_value); |
| 273 if (!params) { | 273 if (!params) { |
| 274 args.GetIsolate()->ThrowException(v8::Exception::TypeError( | 274 args.GetIsolate()->ThrowException(v8::Exception::TypeError( |
| 275 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidRtpParams))); | 275 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidRtpParams))); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 CHECK_EQ(2, args.Length()); | 309 CHECK_EQ(2, args.Length()); |
| 310 CHECK(args[0]->IsInt32()); | 310 CHECK(args[0]->IsInt32()); |
| 311 CHECK(args[1]->IsObject()); | 311 CHECK(args[1]->IsObject()); |
| 312 | 312 |
| 313 const int transport_id = args[0]->ToInt32()->Value(); | 313 const int transport_id = args[0]->ToInt32()->Value(); |
| 314 CastUdpTransport* transport = GetUdpTransportOrThrow(transport_id); | 314 CastUdpTransport* transport = GetUdpTransportOrThrow(transport_id); |
| 315 if (!transport) | 315 if (!transport) |
| 316 return; | 316 return; |
| 317 | 317 |
| 318 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 318 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 319 scoped_ptr<Value> udp_params_value( | 319 scoped_ptr<base::Value> udp_params_value( |
| 320 converter->FromV8Value(args[1], context()->v8_context())); | 320 converter->FromV8Value(args[1], context()->v8_context())); |
| 321 if (!udp_params_value) { | 321 if (!udp_params_value) { |
| 322 args.GetIsolate()->ThrowException(v8::Exception::TypeError( | 322 args.GetIsolate()->ThrowException(v8::Exception::TypeError( |
| 323 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs))); | 323 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs))); |
| 324 return; | 324 return; |
| 325 } | 325 } |
| 326 scoped_ptr<UdpParams> udp_params = UdpParams::FromValue(*udp_params_value); | 326 scoped_ptr<UdpParams> udp_params = UdpParams::FromValue(*udp_params_value); |
| 327 if (!udp_params) { | 327 if (!udp_params) { |
| 328 args.GetIsolate()->ThrowException(v8::Exception::TypeError( | 328 args.GetIsolate()->ThrowException(v8::Exception::TypeError( |
| 329 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidUdpParams))); | 329 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidUdpParams))); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 356 transport_id); | 356 transport_id); |
| 357 if (iter != udp_transport_map_.end()) | 357 if (iter != udp_transport_map_.end()) |
| 358 return iter->second.get(); | 358 return iter->second.get(); |
| 359 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); | 359 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); |
| 360 isolate->ThrowException(v8::Exception::RangeError( | 360 isolate->ThrowException(v8::Exception::RangeError( |
| 361 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); | 361 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); |
| 362 return NULL; | 362 return NULL; |
| 363 } | 363 } |
| 364 | 364 |
| 365 } // namespace extensions | 365 } // namespace extensions |
| OLD | NEW |