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/core/painting/Float32List.h" | |
7 | |
8 #include "sky/engine/core/script/dom_dart_state.h" | |
9 #include "sky/engine/tonic/dart_error.h" | |
10 #include "base/logging.h" | |
11 | |
12 namespace blink { | |
13 | |
14 void Float32List::Init(Dart_Handle list) { | |
abarth-chromium
2015/06/04 16:58:16
Is there some reason this isn't a constructor?
Matt Perry
2015/06/04 17:22:44
Not a good one.
| |
15 dart_handle_ = list; | |
16 data = nullptr; | |
17 num_elements = 0; | |
18 | |
19 if (Dart_IsNull(list)) | |
20 return; | |
21 | |
22 Dart_TypedData_Type type; | |
23 Dart_TypedDataAcquireData( | |
24 list, &type, reinterpret_cast<void**>(&data), &num_elements); | |
25 DCHECK(!LogIfError(list)); | |
26 ASSERT(type == Dart_TypedData_kFloat32); | |
27 } | |
28 | |
29 Float32List::~Float32List() { | |
30 Dart_TypedDataReleaseData(dart_handle_); | |
31 } | |
32 | |
33 Float32List DartConverter<Float32List>::FromArgumentsWithNullCheck( | |
34 Dart_NativeArguments args, | |
35 int index, | |
36 Dart_Handle& exception) { | |
37 Float32List result; | |
38 | |
39 Dart_Handle list = Dart_GetNativeArgument(args, index); | |
40 DCHECK(!LogIfError(list)); | |
41 result.Init(list); | |
42 | |
43 return result; | |
abarth-chromium
2015/06/04 16:58:16
When ~Float32List runs, it will call Dart_TypedDat
Matt Perry
2015/06/04 17:22:44
Good point. Done.
| |
44 } | |
45 | |
46 } // namespace blink | |
OLD | NEW |