OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/tonic/dart_error.h" |
| 7 #include "sky/engine/tonic/float32_list.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 Float32List::Float32List(Dart_Handle list) |
| 12 : data_(nullptr), num_elements_(0), dart_handle_(list) { |
| 13 if (Dart_IsNull(list)) |
| 14 return; |
| 15 |
| 16 Dart_TypedData_Type type; |
| 17 Dart_TypedDataAcquireData( |
| 18 list, &type, reinterpret_cast<void**>(&data_), &num_elements_); |
| 19 DCHECK(!LogIfError(list)); |
| 20 ASSERT(type == Dart_TypedData_kFloat32); |
| 21 } |
| 22 |
| 23 Float32List::Float32List(Float32List&& other) |
| 24 : data_(other.data_), |
| 25 num_elements_(other.num_elements_), |
| 26 dart_handle_(other.dart_handle_) { |
| 27 other.data_ = nullptr; |
| 28 other.dart_handle_ = nullptr; |
| 29 } |
| 30 |
| 31 Float32List::~Float32List() { |
| 32 if (data_) |
| 33 Dart_TypedDataReleaseData(dart_handle_); |
| 34 } |
| 35 |
| 36 Float32List DartConverter<Float32List>::FromArgumentsWithNullCheck( |
| 37 Dart_NativeArguments args, |
| 38 int index, |
| 39 Dart_Handle& exception) { |
| 40 Dart_Handle list = Dart_GetNativeArgument(args, index); |
| 41 DCHECK(!LogIfError(list)); |
| 42 |
| 43 Float32List result(list); |
| 44 return result; |
| 45 } |
| 46 |
| 47 } // namespace blink |
OLD | NEW |