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

Side by Side Diff: sky/engine/tonic/dart_float32list.cc

Issue 1155193004: Canvas.concat takes a 16-element Float32List instead of an array. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: abarth Created 5 years, 6 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
(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/dart_float32list.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;
abarth-chromium 2015/06/04 17:29:28 I'd null out the other dart_handle_ too for parano
Matt Perry 2015/06/04 17:34:35 Done.
28 }
29
30 Float32List::~Float32List() {
31 if (data_)
32 Dart_TypedDataReleaseData(dart_handle_);
33 }
34
35 Float32List DartConverter<Float32List>::FromArgumentsWithNullCheck(
36 Dart_NativeArguments args,
37 int index,
38 Dart_Handle& exception) {
39 Dart_Handle list = Dart_GetNativeArgument(args, index);
40 DCHECK(!LogIfError(list));
41
42 Float32List result(list);
43 return std::move(result);
abarth-chromium 2015/06/04 17:29:28 return Float32List(list); No need for std::move.
Matt Perry 2015/06/04 17:34:35 Done.
44 }
45
46 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698