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

Side by Side Diff: runtime/vm/exceptions_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/debugger_api_impl_test.cc ('k') | runtime/vm/intermediate_language_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/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 static struct NativeEntries { 69 static struct NativeEntries {
70 const char* name_; 70 const char* name_;
71 Dart_NativeFunction function_; 71 Dart_NativeFunction function_;
72 int argument_count_; 72 int argument_count_;
73 } BuiltinEntries[] = { 73 } BuiltinEntries[] = {
74 UNHANDLED_NATIVE_LIST(REGISTER_FUNCTION) 74 UNHANDLED_NATIVE_LIST(REGISTER_FUNCTION)
75 }; 75 };
76 76
77 77
78 static Dart_NativeFunction native_lookup(Dart_Handle name, 78 static Dart_NativeFunction native_lookup(Dart_Handle name,
79 int argument_count) { 79 int argument_count,
80 bool* auto_setup_scope) {
81 ASSERT(auto_setup_scope != NULL);
82 *auto_setup_scope = false;
80 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); 83 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
81 ASSERT(obj.IsString()); 84 ASSERT(obj.IsString());
82 const char* function_name = obj.ToCString(); 85 const char* function_name = obj.ToCString();
83 ASSERT(function_name != NULL); 86 ASSERT(function_name != NULL);
84 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries); 87 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries);
85 for (int i = 0; i < num_entries; i++) { 88 for (int i = 0; i < num_entries; i++) {
86 struct NativeEntries* entry = &(BuiltinEntries[i]); 89 struct NativeEntries* entry = &(BuiltinEntries[i]);
87 if (!strcmp(function_name, entry->name_) && 90 if (!strcmp(function_name, entry->name_) &&
88 (argument_count == entry->argument_count_)) { 91 (argument_count == entry->argument_count_)) {
89 return reinterpret_cast<Dart_NativeFunction>(entry->function_); 92 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 " UnhandledExceptions.equals(2, Second.method1(1));\n" 126 " UnhandledExceptions.equals(2, Second.method1(1));\n"
124 " UnhandledExceptions.equals(3, Second.method3(1));\n" 127 " UnhandledExceptions.equals(3, Second.method3(1));\n"
125 "}"; 128 "}";
126 Dart_Handle lib = TestCase::LoadTestScript( 129 Dart_Handle lib = TestCase::LoadTestScript(
127 kScriptChars, 130 kScriptChars,
128 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 131 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
129 EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL)); 132 EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL));
130 } 133 }
131 134
132 } // namespace dart 135 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698