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

Side by Side Diff: tonic/dart_wrappable.h

Issue 1244983003: Make mojo dart controller depend on tonic and get building without wtf (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « tonic/dart_state.cc ('k') | tonic/float32_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef SKY_ENGINE_TONIC_DART_WRAPPABLE_H_ 5 #ifndef SKY_ENGINE_TONIC_DART_WRAPPABLE_H_
6 #define SKY_ENGINE_TONIC_DART_WRAPPABLE_H_ 6 #define SKY_ENGINE_TONIC_DART_WRAPPABLE_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/template_util.h" 9 #include "base/template_util.h"
10 #include "dart/runtime/include/dart_api.h" 10 #include "dart/runtime/include/dart_api.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 int index, 116 int index,
117 Dart_Handle& exception, 117 Dart_Handle& exception,
118 bool auto_scope = true) { 118 bool auto_scope = true) {
119 // TODO(abarth): We're missing a type check. 119 // TODO(abarth): We're missing a type check.
120 return static_cast<T*>(DartConverterWrappable::FromArgumentsWithNullCheck( 120 return static_cast<T*>(DartConverterWrappable::FromArgumentsWithNullCheck(
121 args, index, exception)); 121 args, index, exception));
122 } 122 }
123 }; 123 };
124 124
125 template<typename T> 125 template<typename T>
126 struct DartConverter<RefPtr<T>> {
127 static Dart_Handle ToDart(RefPtr<T> val) {
128 return DartConverter<T*>::ToDart(val.get());
129 }
130
131 static RefPtr<T> FromDart(Dart_Handle handle) {
132 return DartConverter<T*>::FromDart(handle);
133 }
134 };
135
136 template<typename T>
137 inline T* GetReceiver(Dart_NativeArguments args) { 126 inline T* GetReceiver(Dart_NativeArguments args) {
138 intptr_t receiver; 127 intptr_t receiver;
139 Dart_Handle result = Dart_GetNativeReceiver(args, &receiver); 128 Dart_Handle result = Dart_GetNativeReceiver(args, &receiver);
140 DCHECK(!Dart_IsError(result)); 129 DCHECK(!Dart_IsError(result));
141 return static_cast<T*>(reinterpret_cast<DartWrappable*>(receiver)); 130 return static_cast<T*>(reinterpret_cast<DartWrappable*>(receiver));
142 } 131 }
143 132
144 } // namespace blink 133 } // namespace blink
145 134
146 #endif // SKY_ENGINE_TONIC_DART_WRAPPABLE_H_ 135 #endif // SKY_ENGINE_TONIC_DART_WRAPPABLE_H_
OLDNEW
« no previous file with comments | « tonic/dart_state.cc ('k') | tonic/float32_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698