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

Side by Side Diff: Source/bindings/dart/DartHandleProxy.cpp

Issue 81213004: Demangle names before using them as properties for DartHandleProxies. (Closed) Base URL: svn://svn.chromium.org/multivm/branches/1650/blink
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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Dart_Handle stripTrailingDot(Dart_Handle str) 132 Dart_Handle stripTrailingDot(Dart_Handle str)
133 { 133 {
134 return DartUtilities::invokeUtilsMethod("stripTrailingDot", 1, &str); 134 return DartUtilities::invokeUtilsMethod("stripTrailingDot", 1, &str);
135 } 135 }
136 136
137 Dart_Handle addTrailingDot(Dart_Handle str) 137 Dart_Handle addTrailingDot(Dart_Handle str)
138 { 138 {
139 return DartUtilities::invokeUtilsMethod("addTrailingDot", 1, &str); 139 return DartUtilities::invokeUtilsMethod("addTrailingDot", 1, &str);
140 } 140 }
141 141
142 Dart_Handle demangle(Dart_Handle str)
143 {
144 return DartUtilities::invokeUtilsMethod("demangle", 1, &str);
145 }
146
142 Dart_Handle lookupValueForEncodedMapKey(Dart_Handle object, Dart_Handle key) 147 Dart_Handle lookupValueForEncodedMapKey(Dart_Handle object, Dart_Handle key)
143 { 148 {
144 Dart_Handle args[] = {object, key}; 149 Dart_Handle args[] = {object, key};
145 return DartUtilities::invokeUtilsMethod("lookupValueForEncodedMapKey", 2, ar gs); 150 return DartUtilities::invokeUtilsMethod("lookupValueForEncodedMapKey", 2, ar gs);
146 } 151 }
147 152
148 Dart_Handle buildConstructorName(Dart_Handle typeName, Dart_Handle constructorNa me) 153 Dart_Handle buildConstructorName(Dart_Handle typeName, Dart_Handle constructorNa me)
149 { 154 {
150 Dart_Handle args[] = {typeName, constructorName}; 155 Dart_Handle args[] = {typeName, constructorName};
151 return DartUtilities::invokeUtilsMethod("buildConstructorName", 2, args); 156 return DartUtilities::invokeUtilsMethod("buildConstructorName", 2, args);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 225
221 // Skip setters as any setter we care to enumerate should have a mat ching getter. 226 // Skip setters as any setter we care to enumerate should have a mat ching getter.
222 // Setters without matching getters will still be callable but won't be enumerated. 227 // Setters without matching getters will still be callable but won't be enumerated.
223 if (isSetter) 228 if (isSetter)
224 continue; 229 continue;
225 } 230 }
226 231
227 // Strip off the leading typename from constructor name. 232 // Strip off the leading typename from constructor name.
228 if (isConstructor) 233 if (isConstructor)
229 functionName = stripClassName(functionName, Dart_TypeName(handle)); 234 functionName = stripClassName(functionName, Dart_TypeName(handle));
230 235
Jacob 2013/11/21 22:45:40 this is never getting called and would likely do t
rmacnak 2013/11/21 23:14:20 What is it the VM does incorrectly? Nothing seems
236 functionName = demangle(functionName);
231 properties->Set(*count, V8Converter::stringToV8(functionName)); 237 properties->Set(*count, V8Converter::stringToV8(functionName));
232 *count = *count + 1; 238 *count = *count + 1;
233 } 239 }
234 } 240 }
235 241
236 void addClassNames(Dart_Handle library, v8::Local<v8::Array>& properties, intptr _t* count) 242 void addClassNames(Dart_Handle library, v8::Local<v8::Array>& properties, intptr _t* count)
237 { 243 {
238 intptr_t length = 0; 244 intptr_t length = 0;
239 Dart_Handle typeNames = Dart_LibraryGetClassNames(library); 245 Dart_Handle typeNames = Dart_LibraryGetClassNames(library);
240 ASSERT(!Dart_IsNull(typeNames)); 246 ASSERT(!Dart_IsNull(typeNames));
241 ASSERT(Dart_IsList(typeNames)); 247 ASSERT(Dart_IsList(typeNames));
242 Dart_ListLength(typeNames, &length); 248 Dart_ListLength(typeNames, &length);
243 for (intptr_t i = 0; i < length; i++) { 249 for (intptr_t i = 0; i < length; i++) {
244 Dart_Handle typeName = Dart_ListGetAt(typeNames, i); 250 Dart_Handle typeName = Dart_ListGetAt(typeNames, i);
245 properties->Set(*count, V8Converter::stringToV8(typeName)); 251 properties->Set(*count, V8Converter::stringToV8(typeName));
246 *count = *count + 1; 252 *count = *count + 1;
247 } 253 }
248 } 254 }
249 255
250 void addFieldNames(Dart_Handle fieldNames, v8::Local<v8::Array>& properties, int ptr_t* count) 256 void addFieldNames(Dart_Handle fieldNames, v8::Local<v8::Array>& properties, int ptr_t* count)
251 { 257 {
252 ASSERT(!Dart_IsApiError(fieldNames)); 258 ASSERT(!Dart_IsApiError(fieldNames));
253 ASSERT(Dart_IsList(fieldNames)); 259 ASSERT(Dart_IsList(fieldNames));
254 intptr_t length = 0; 260 intptr_t length = 0;
255 Dart_ListLength(fieldNames, &length); 261 Dart_ListLength(fieldNames, &length);
256 for (intptr_t i = 0; i < length; i += 2) { 262 for (intptr_t i = 0; i < length; i += 2) {
257 Dart_Handle fieldName = Dart_ListGetAt(fieldNames, i); 263 Dart_Handle fieldName = Dart_ListGetAt(fieldNames, i);
258 properties->Set(*count, V8Converter::stringToV8(fieldName)); 264 properties->Set(*count, V8Converter::stringToV8(demangle(fieldName)));
Jacob 2013/11/21 22:45:40 do private fields in libraries show up correctly w
rmacnak 2013/11/21 23:14:20 I can see the value in the Scope Variables section
259 *count = *count + 1; 265 *count = *count + 1;
260 } 266 }
261 } 267 }
262 268
263 template<typename CallbackInfo> 269 template<typename CallbackInfo>
264 void setReturnValue(CallbackInfo info, Dart_Handle result) 270 void setReturnValue(CallbackInfo info, Dart_Handle result)
265 { 271 {
266 if (Dart_IsError(result)) { 272 if (Dart_IsError(result)) {
267 // FIXME: we would really prefer to call the following however it has 273 // FIXME: we would really prefer to call the following however it has
268 // bad unintended consequences as then JS cannot catch the thrown except ion. 274 // bad unintended consequences as then JS cannot catch the thrown except ion.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 // Add all library prefixes of imports to the library. 552 // Add all library prefixes of imports to the library.
547 Dart_Handle imports = Dart_GetLibraryImports(libraryId); 553 Dart_Handle imports = Dart_GetLibraryImports(libraryId);
548 ASSERT(!Dart_IsError(imports)); 554 ASSERT(!Dart_IsError(imports));
549 intptr_t length = 0; 555 intptr_t length = 0;
550 Dart_ListLength(imports, &length); 556 Dart_ListLength(imports, &length);
551 for (intptr_t i = 0; i < length; i += 2) { 557 for (intptr_t i = 0; i < length; i += 2) {
552 Dart_Handle importPrefix = Dart_ListGetAt(imports, i); 558 Dart_Handle importPrefix = Dart_ListGetAt(imports, i);
553 if (!Dart_IsNull(importPrefix)) { 559 if (!Dart_IsNull(importPrefix)) {
554 ASSERT(Dart_IsString(importPrefix)); 560 ASSERT(Dart_IsString(importPrefix));
555 properties->Set(count, V8Converter::stringToV8( 561 properties->Set(count, V8Converter::stringToV8(
556 stripTrailingDot(importPrefix))); 562 demangle(stripTrailingDot(importPrefix))));
557 count++; 563 count++;
558 } 564 }
559 bool equals = false; 565 bool equals = false;
560 } 566 }
561 } 567 }
562 568
563 info.Holder()->SetHiddenValue(v8::String::NewSymbol("cache"), properties); 569 info.Holder()->SetHiddenValue(v8::String::NewSymbol("cache"), properties);
564 v8SetReturnValue(info, properties); 570 v8SetReturnValue(info, properties);
565 } 571 }
566 572
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 for (intptr_t i = 0; i < length; i ++) 1203 for (intptr_t i = 0; i < length; i ++)
1198 dartFunctionArgs.append(Dart_ListGetAt(wrappedExpressionArgs, i)); 1204 dartFunctionArgs.append(Dart_ListGetAt(wrappedExpressionArgs, i));
1199 1205
1200 Dart_Handle result = Dart_InvokeClosure(closure, dartFunctionArgs.size(), da rtFunctionArgs.data()); 1206 Dart_Handle result = Dart_InvokeClosure(closure, dartFunctionArgs.size(), da rtFunctionArgs.data());
1201 if (Dart_IsError(result)) 1207 if (Dart_IsError(result))
1202 return V8ThrowException::throwError(v8::String::New(Dart_GetError(result )), v8::Isolate::GetCurrent()); 1208 return V8ThrowException::throwError(v8::String::New(Dart_GetError(result )), v8::Isolate::GetCurrent());
1203 return DartHandleProxy::create(result); 1209 return DartHandleProxy::create(result);
1204 } 1210 }
1205 1211
1206 } 1212 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698