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

Side by Side Diff: samples/sample_extension/sample_extension.cc

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
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 #include <string.h> 4 #include <string.h>
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include "dart_api.h" 7 #include "dart_api.h"
8 8
9 Dart_NativeFunction ResolveName(Dart_Handle name, int argc); 9 Dart_NativeFunction ResolveName(Dart_Handle name, int argc);
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Dart_NativeFunction function; 109 Dart_NativeFunction function;
110 }; 110 };
111 111
112 FunctionLookup function_list[] = { 112 FunctionLookup function_list[] = {
113 {"SystemRand", SystemRand}, 113 {"SystemRand", SystemRand},
114 {"SystemSrand", SystemSrand}, 114 {"SystemSrand", SystemSrand},
115 {"RandomArray_ServicePort", randomArrayServicePort}, 115 {"RandomArray_ServicePort", randomArrayServicePort},
116 {NULL, NULL}}; 116 {NULL, NULL}};
117 117
118 Dart_NativeFunction ResolveName(Dart_Handle name, int argc) { 118 Dart_NativeFunction ResolveName(Dart_Handle name, int argc) {
119 if (!Dart_IsString8(name)) return NULL; 119 if (!Dart_IsString(name)) return NULL;
120 Dart_NativeFunction result = NULL; 120 Dart_NativeFunction result = NULL;
121 Dart_EnterScope(); 121 Dart_EnterScope();
122 const char* cname; 122 const char* cname;
123 HandleError(Dart_StringToCString(name, &cname)); 123 HandleError(Dart_StringToCString(name, &cname));
124 124
125 for (int i=0; function_list[i].name != NULL; ++i) { 125 for (int i=0; function_list[i].name != NULL; ++i) {
126 if (strcmp(function_list[i].name, cname) == 0) { 126 if (strcmp(function_list[i].name, cname) == 0) {
127 result = function_list[i].function; 127 result = function_list[i].function;
128 break; 128 break;
129 } 129 }
130 } 130 }
131 Dart_ExitScope(); 131 Dart_ExitScope();
132 return result; 132 return result;
133 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698