| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 static v8::Local<v8::FunctionTemplate> frameProxyTemplate(); | 56 static v8::Local<v8::FunctionTemplate> frameProxyTemplate(); |
| 57 | 57 |
| 58 DartPersistentValue* DartHandleProxy::readPointerFromProxy(v8::Handle<v8::Value>
proxy) | 58 DartPersistentValue* DartHandleProxy::readPointerFromProxy(v8::Handle<v8::Value>
proxy) |
| 59 { | 59 { |
| 60 void* pointer = proxy.As<v8::Object>()->GetAlignedPointerFromInternalField(0
); | 60 void* pointer = proxy.As<v8::Object>()->GetAlignedPointerFromInternalField(0
); |
| 61 return static_cast<DartPersistentValue*>(pointer); | 61 return static_cast<DartPersistentValue*>(pointer); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool DartHandleProxy::isDartProxy(v8::Handle<v8::Value> value) | 64 bool DartHandleProxy::isDartProxy(v8::Handle<v8::Value> value) |
| 65 { | 65 { |
| 66 return isDartProxy(value, v8::Isolate::GetCurrent()); |
| 67 } |
| 68 |
| 69 bool DartHandleProxy::isDartProxy(v8::Handle<v8::Value> value, v8::Isolate* v8Is
olate) |
| 70 { |
| 66 if (!value.IsEmpty() && value->IsObject()) { | 71 if (!value.IsEmpty() && value->IsObject()) { |
| 67 v8::Isolate* v8Isolate = v8::Isolate::GetCurrent(); | |
| 68 v8::Local<v8::Value> hiddenValue = value.As<v8::Object>()->GetHiddenValu
e(v8::String::NewFromUtf8(v8Isolate, "dartProxy")); | 72 v8::Local<v8::Value> hiddenValue = value.As<v8::Object>()->GetHiddenValu
e(v8::String::NewFromUtf8(v8Isolate, "dartProxy")); |
| 69 return *hiddenValue && hiddenValue->IsBoolean(); | 73 return *hiddenValue && hiddenValue->IsBoolean(); |
| 70 } | 74 } |
| 71 return false; | 75 return false; |
| 72 } | 76 } |
| 73 | 77 |
| 74 bool isGlobalObjectProxy(v8::Handle<v8::Object> value) | 78 bool isGlobalObjectProxy(v8::Handle<v8::Object> value) |
| 75 { | 79 { |
| 76 v8::Isolate* v8Isolate = v8::Isolate::GetCurrent(); | 80 v8::Isolate* v8Isolate = v8::Isolate::GetCurrent(); |
| 77 v8::Local<v8::Value> hiddenValue = value.As<v8::Object>()->GetHiddenValue(v8
::String::NewFromUtf8(v8Isolate, "asGlobal")); | 81 v8::Local<v8::Value> hiddenValue = value.As<v8::Object>()->GetHiddenValue(v8
::String::NewFromUtf8(v8Isolate, "asGlobal")); |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 for (intptr_t i = 0; i < length; i ++) | 1245 for (intptr_t i = 0; i < length; i ++) |
| 1242 dartFunctionArgs.append(Dart_ListGetAt(wrappedExpressionArgs, i)); | 1246 dartFunctionArgs.append(Dart_ListGetAt(wrappedExpressionArgs, i)); |
| 1243 | 1247 |
| 1244 Dart_Handle result = Dart_InvokeClosure(closure, dartFunctionArgs.size(), da
rtFunctionArgs.data()); | 1248 Dart_Handle result = Dart_InvokeClosure(closure, dartFunctionArgs.size(), da
rtFunctionArgs.data()); |
| 1245 if (Dart_IsError(result)) | 1249 if (Dart_IsError(result)) |
| 1246 return V8ThrowException::throwException(v8::String::NewFromUtf8(v8Isolat
e, Dart_GetError(result)), v8::Isolate::GetCurrent()); | 1250 return V8ThrowException::throwException(v8::String::NewFromUtf8(v8Isolat
e, Dart_GetError(result)), v8::Isolate::GetCurrent()); |
| 1247 return DartHandleProxy::create(result); | 1251 return DartHandleProxy::create(result); |
| 1248 } | 1252 } |
| 1249 | 1253 |
| 1250 } | 1254 } |
| OLD | NEW |