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

Side by Side Diff: runtime/vm/stack_frame_test.cc

Issue 117723002: Allow the native resolver to setup whether it needs the Dart API scope to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/stub_code_arm.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 static struct NativeEntries { 129 static struct NativeEntries {
130 const char* name_; 130 const char* name_;
131 Dart_NativeFunction function_; 131 Dart_NativeFunction function_;
132 int argument_count_; 132 int argument_count_;
133 } BuiltinEntries[] = { 133 } BuiltinEntries[] = {
134 STACKFRAME_NATIVE_LIST(REGISTER_FUNCTION) 134 STACKFRAME_NATIVE_LIST(REGISTER_FUNCTION)
135 }; 135 };
136 136
137 137
138 static Dart_NativeFunction native_lookup(Dart_Handle name, 138 static Dart_NativeFunction native_lookup(Dart_Handle name,
139 int argument_count) { 139 int argument_count,
140 bool* auto_setup_scope) {
141 ASSERT(auto_setup_scope != NULL);
142 *auto_setup_scope = false;
140 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); 143 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
141 ASSERT(obj.IsString()); 144 ASSERT(obj.IsString());
142 const char* function_name = obj.ToCString(); 145 const char* function_name = obj.ToCString();
143 ASSERT(function_name != NULL); 146 ASSERT(function_name != NULL);
144 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries); 147 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries);
145 for (int i = 0; i < num_entries; i++) { 148 for (int i = 0; i < num_entries; i++) {
146 struct NativeEntries* entry = &(BuiltinEntries[i]); 149 struct NativeEntries* entry = &(BuiltinEntries[i]);
147 if (!strcmp(function_name, entry->name_) && 150 if (!strcmp(function_name, entry->name_) &&
148 (entry->argument_count_ == argument_count)) { 151 (entry->argument_count_ == argument_count)) {
149 return reinterpret_cast<Dart_NativeFunction>(entry->function_); 152 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 " }" 281 " }"
279 "}"; 282 "}";
280 Dart_Handle lib = TestCase::LoadTestScript( 283 Dart_Handle lib = TestCase::LoadTestScript(
281 kScriptChars, 284 kScriptChars,
282 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 285 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
283 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test")); 286 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test"));
284 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL)); 287 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL));
285 } 288 }
286 289
287 } // namespace dart 290 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698