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

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

Issue 924203002: Morph the APIs for Node, ParentNode, and Element closer to the specs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 2015 The Chromium Authors. All rights reserved. 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 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 "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/tonic/dart_wrappable.h" 6 #include "sky/engine/tonic/dart_wrappable.h"
7 7
8 #include "sky/engine/tonic/dart_class_library.h" 8 #include "sky/engine/tonic/dart_class_library.h"
9 #include "sky/engine/tonic/dart_error.h" 9 #include "sky/engine/tonic/dart_error.h"
10 #include "sky/engine/tonic/dart_state.h" 10 #include "sky/engine/tonic/dart_state.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 void DartWrappable::FinalizeDartWrapper(void* isolate_callback_data, 43 void DartWrappable::FinalizeDartWrapper(void* isolate_callback_data,
44 Dart_WeakPersistentHandle wrapper, 44 Dart_WeakPersistentHandle wrapper,
45 void* peer) { 45 void* peer) {
46 DartWrappable* wrappable = reinterpret_cast<DartWrappable*>(peer); 46 DartWrappable* wrappable = reinterpret_cast<DartWrappable*>(peer);
47 wrappable->dart_wrapper_ = nullptr; 47 wrappable->dart_wrapper_ = nullptr;
48 const DartWrapperInfo& info = wrappable->GetDartWrapperInfo(); 48 const DartWrapperInfo& info = wrappable->GetDartWrapperInfo();
49 info.deref_object(wrappable); // Balanced in CreateDartWrapper. 49 info.deref_object(wrappable); // Balanced in CreateDartWrapper.
50 } 50 }
51 51
52 DartWrappable* DartConverterWrappable::FromDart(Dart_Handle handle) { 52 DartWrappable* DartConverterWrappable::FromDart(Dart_Handle handle) {
53 intptr_t* peer = 0; 53 intptr_t peer = 0;
54 Dart_Handle result = 54 Dart_Handle result =
55 Dart_GetNativeInstanceField(handle, DartWrappable::kPeerIndex, peer); 55 Dart_GetNativeInstanceField(handle, DartWrappable::kPeerIndex, &peer);
56 if (Dart_IsError(result)) 56 if (Dart_IsError(result))
57 return nullptr; 57 return nullptr;
58 return reinterpret_cast<DartWrappable*>(peer); 58 return reinterpret_cast<DartWrappable*>(peer);
59 } 59 }
60 60
61 DartWrappable* DartConverterWrappable::FromArguments(Dart_NativeArguments args, 61 DartWrappable* DartConverterWrappable::FromArguments(Dart_NativeArguments args,
62 int index, 62 int index,
63 Dart_Handle& exception) { 63 Dart_Handle& exception) {
64 intptr_t native_fields[DartWrappable::kNumberOfNativeFields]; 64 intptr_t native_fields[DartWrappable::kNumberOfNativeFields];
65 Dart_Handle result = Dart_GetNativeFieldsOfArgument( 65 Dart_Handle result = Dart_GetNativeFieldsOfArgument(
(...skipping 16 matching lines...) Expand all
82 args, index, DartWrappable::kNumberOfNativeFields, native_fields); 82 args, index, DartWrappable::kNumberOfNativeFields, native_fields);
83 if (Dart_IsError(result)) { 83 if (Dart_IsError(result)) {
84 exception = Dart_NewStringFromCString(DartError::kInvalidArgument); 84 exception = Dart_NewStringFromCString(DartError::kInvalidArgument);
85 return nullptr; 85 return nullptr;
86 } 86 }
87 return reinterpret_cast<DartWrappable*>( 87 return reinterpret_cast<DartWrappable*>(
88 native_fields[DartWrappable::kPeerIndex]); 88 native_fields[DartWrappable::kPeerIndex]);
89 } 89 }
90 90
91 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698