| OLD | NEW |
| 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 v8::Local<v8::Array> propertyNames = commandLineApi->GetOwnPropertyN
ames(); | 1194 v8::Local<v8::Array> propertyNames = commandLineApi->GetOwnPropertyN
ames(); |
| 1195 uint32_t length = propertyNames->Length(); | 1195 uint32_t length = propertyNames->Length(); |
| 1196 ASSERT(length > 0); | 1196 ASSERT(length > 0); |
| 1197 for (uint32_t i = 0; i < length; i++) { | 1197 for (uint32_t i = 0; i < length; i++) { |
| 1198 v8::Handle<v8::String> propertyName = propertyNames->Get(i).As<v
8::String>(); | 1198 v8::Handle<v8::String> propertyName = propertyNames->Get(i).As<v
8::String>(); |
| 1199 ASSERT(!propertyNames.IsEmpty()); | 1199 ASSERT(!propertyNames.IsEmpty()); |
| 1200 v8::Handle<v8::Value> propertyValue = commandLineApi->Get(proper
tyName); | 1200 v8::Handle<v8::Value> propertyValue = commandLineApi->Get(proper
tyName); |
| 1201 | 1201 |
| 1202 Dart_Handle dartValue; | 1202 Dart_Handle dartValue; |
| 1203 if (propertyValue->IsFunction()) { | 1203 if (propertyValue->IsFunction()) { |
| 1204 dartValue = JsInterop::toDart(propertyValue); | 1204 dartValue = JsInterop::toDart(propertyValue, true); |
| 1205 // We need to wrap the JsFunction object we get back | 1205 // We need to wrap the JsFunction object we get back |
| 1206 // from the vanila JsInterop library so that users can | 1206 // from the vanila JsInterop library so that users can |
| 1207 // call it like a normal Dart function instead of | 1207 // call it like a normal Dart function instead of |
| 1208 // having to use the apply method. | 1208 // having to use the apply method. |
| 1209 dartValue = Dart_Invoke(domData->jsLibrary(), Dart_NewString
FromCString("_wrapAsDebuggerVarArgsFunction"), 1, &dartValue); | 1209 dartValue = Dart_Invoke(domData->jsLibrary(), Dart_NewString
FromCString("_wrapAsDebuggerVarArgsFunction"), 1, &dartValue); |
| 1210 } else { | 1210 } else { |
| 1211 dartValue = JsInterop::toDart(propertyValue); | 1211 dartValue = JsInterop::toDart(propertyValue, true); |
| 1212 } | 1212 } |
| 1213 locals.append(V8Converter::stringToDart(propertyName)); | 1213 locals.append(V8Converter::stringToDart(propertyName)); |
| 1214 locals.append(dartValue); | 1214 locals.append(dartValue); |
| 1215 } | 1215 } |
| 1216 } | 1216 } |
| 1217 localVariables = DartUtilities::toList(locals, exception); | 1217 localVariables = DartUtilities::toList(locals, exception); |
| 1218 ASSERT(!exception); | 1218 ASSERT(!exception); |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 Dart_Handle wrapExpressionArgs[2] = { expression, localVariables }; | 1221 Dart_Handle wrapExpressionArgs[2] = { expression, localVariables }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1241 for (intptr_t i = 0; i < length; i ++) | 1241 for (intptr_t i = 0; i < length; i ++) |
| 1242 dartFunctionArgs.append(Dart_ListGetAt(wrappedExpressionArgs, i)); | 1242 dartFunctionArgs.append(Dart_ListGetAt(wrappedExpressionArgs, i)); |
| 1243 | 1243 |
| 1244 Dart_Handle result = Dart_InvokeClosure(closure, dartFunctionArgs.size(), da
rtFunctionArgs.data()); | 1244 Dart_Handle result = Dart_InvokeClosure(closure, dartFunctionArgs.size(), da
rtFunctionArgs.data()); |
| 1245 if (Dart_IsError(result)) | 1245 if (Dart_IsError(result)) |
| 1246 return V8ThrowException::throwException(v8::String::NewFromUtf8(v8Isolat
e, Dart_GetError(result)), v8::Isolate::GetCurrent()); | 1246 return V8ThrowException::throwException(v8::String::NewFromUtf8(v8Isolat
e, Dart_GetError(result)), v8::Isolate::GetCurrent()); |
| 1247 return DartHandleProxy::create(result); | 1247 return DartHandleProxy::create(result); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 } | 1250 } |
| OLD | NEW |