Rename logging category to overte Make all V8 code use logging categories
Showing the changes to libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp (1 of 10 files). Show all
Unified · Split
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #include "ScriptContextV8Wrapper.h" | 23 | #include "ScriptContextV8Wrapper.h" |
| 24 | #include "ScriptValueV8Wrapper.h" | 24 | #include "ScriptValueV8Wrapper.h" |
| 25 | #include "ScriptEngineLoggingV8.h" | ||
| 25 | 26 | ||
| 26 | //V8TODO: is this needed for anything? It could cause trouble with multithreading if V8ScriptContext is v8::Persistent | 27 | //V8TODO: is this needed for anything? It could cause trouble with multithreading if V8ScriptContext is v8::Persistent |
| 27 | //Q_DECLARE_METATYPE(V8ScriptContext*) | 28 | //Q_DECLARE_METATYPE(V8ScriptContext*) |
| @@ -110,7 +111,7 @@ V8ScriptValue ScriptObjectV8Proxy::newQObject(ScriptEngineV8* engine, QObject* o · 82 unmodified lines | |||
| 110 | break; | 111 | break; |
| 111 | default: | 112 | default: |
| 112 | ownsObject = false; | 113 | ownsObject = false; |
| 113 | qCritical() << "Wrong ScriptEngine::ValueOwnership value: " << ownership; | 114 | qCCritical(scriptengine_v8) << "Wrong ScriptEngine::ValueOwnership value: " << ownership; |
| 114 | break; | 115 | break; |
| 115 | } | 116 | } |
| 116 | 117 | ||
| @@ -166,16 +167,16 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(const V8ScriptValue& val) · 49 unmodified lines | |||
| 166 | return nullptr; | 167 | return nullptr; |
| 167 | } | 168 | } |
| 168 | if (!v8Value->IsObject()) { | 169 | if (!v8Value->IsObject()) { |
| 169 | //qDebug(scriptengine) << "Cannot unwrap proxy - value is not an object"; | 170 | //qCDebug(scriptengine_v8) << "Cannot unwrap proxy - value is not an object"; |
| 170 | return nullptr; | 171 | return nullptr; |
| 171 | } | 172 | } |
| 172 | v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value); | 173 | v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value); |
| 173 | if (v8Object->InternalFieldCount() != 3) { | 174 | if (v8Object->InternalFieldCount() != 3) { |
| 174 | //qDebug(scriptengine) << "Cannot unwrap proxy - wrong number of internal fields"; | 175 | //qCDebug(scriptengine_v8) << "Cannot unwrap proxy - wrong number of internal fields"; |
| 175 | return nullptr; | 176 | return nullptr; |
| 176 | } | 177 | } |
| 177 | if (v8Object->GetAlignedPointerFromInternalField(0) != internalPointsToQObjectProxy) { | 178 | if (v8Object->GetAlignedPointerFromInternalField(0) != internalPointsToQObjectProxy) { |
| 178 | qDebug(scriptengine) << "Cannot unwrap proxy - internal fields don't point to object proxy"; | 179 | qCDebug(scriptengine_v8) << "Cannot unwrap proxy - internal fields don't point to object proxy"; |
| 179 | return nullptr; | 180 | return nullptr; |
| 180 | } | 181 | } |
| 181 | return reinterpret_cast<ScriptObjectV8Proxy*>(v8Object->GetAlignedPointerFromInternalField(1)); | 182 | return reinterpret_cast<ScriptObjectV8Proxy*>(v8Object->GetAlignedPointerFromInternalField(1)); |
| @@ -189,20 +190,20 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(v8::Isolate* isolate, v8:: · 7 unmodified lines | |||
| 189 | //v8::Local<v8::Context> context = val.constGetContext(); | 190 | //v8::Local<v8::Context> context = val.constGetContext(); |
| 190 | //v8::Context::Scope contextScope(context); | 191 | //v8::Context::Scope contextScope(context); |
| 191 | if (value->IsNullOrUndefined()) { | 192 | if (value->IsNullOrUndefined()) { |
| 192 | //qDebug(scriptengine) << "Cannot unwrap proxy - value is not an object"; | 193 | //qCDebug(scriptengine_v8) << "Cannot unwrap proxy - value is not an object"; |
| 193 | return nullptr; | 194 | return nullptr; |
| 194 | } | 195 | } |
| 195 | if (!value->IsObject()) { | 196 | if (!value->IsObject()) { |
| 196 | //qDebug(scriptengine) << "Cannot unwrap proxy - value is not an object"; | 197 | //qCDebug(scriptengine_v8) << "Cannot unwrap proxy - value is not an object"; |
| 197 | return nullptr; | 198 | return nullptr; |
| 198 | } | 199 | } |
| 199 | v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(value); | 200 | v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(value); |
| 200 | if (v8Object->InternalFieldCount() != 3) { | 201 | if (v8Object->InternalFieldCount() != 3) { |
| 201 | //qDebug(scriptengine) << "Cannot unwrap proxy - wrong number of internal fields"; | 202 | //qCDebug(scriptengine_v8) << "Cannot unwrap proxy - wrong number of internal fields"; |
| 202 | return nullptr; | 203 | return nullptr; |
| 203 | } | 204 | } |
| 204 | if (v8Object->GetAlignedPointerFromInternalField(0) != internalPointsToQObjectProxy) { | 205 | if (v8Object->GetAlignedPointerFromInternalField(0) != internalPointsToQObjectProxy) { |
| 205 | qDebug(scriptengine) << "Cannot unwrap proxy - internal fields don't point to object proxy"; | 206 | qCDebug(scriptengine_v8) << "Cannot unwrap proxy - internal fields don't point to object proxy"; |
| 206 | return nullptr; | 207 | return nullptr; |
| 207 | } | 208 | } |
| 208 | return reinterpret_cast<ScriptObjectV8Proxy*>(v8Object->GetAlignedPointerFromInternalField(1)); | 209 | return reinterpret_cast<ScriptObjectV8Proxy*>(v8Object->GetAlignedPointerFromInternalField(1)); |
| @@ -218,7 +219,7 @@ ScriptObjectV8Proxy::~ScriptObjectV8Proxy() { · 9 unmodified lines | |||
| 218 | v8::Locker locker(isolate); | 219 | v8::Locker locker(isolate); |
| 219 | v8::Isolate::Scope isolateScope(isolate); | 220 | v8::Isolate::Scope isolateScope(isolate); |
| 220 | v8::HandleScope handleScope(isolate); | 221 | v8::HandleScope handleScope(isolate); |
| 221 | if(_object) qDebug(scriptengine) << "Deleting object proxy: " << name(); | 222 | if(_object) qCDebug(scriptengine_v8) << "Deleting object proxy: " << name(); |
| 222 | // V8TODO: once WeakPersistent pointer is added we should check if it's valid before deleting | 223 | // V8TODO: once WeakPersistent pointer is added we should check if it's valid before deleting |
| 223 | Q_ASSERT(!_v8Object.Get(isolate)->IsNullOrUndefined()); | 224 | Q_ASSERT(!_v8Object.Get(isolate)->IsNullOrUndefined()); |
| 224 | // This prevents unwrap function from unwrapping proxy that was deleted | 225 | // This prevents unwrap function from unwrapping proxy that was deleted |
| @@ -234,7 +235,7 @@ void ScriptObjectV8Proxy::investigate() { · 9 unmodified lines | |||
| 234 | QObject* qobject = _object; | 235 | QObject* qobject = _object; |
| 235 | if (!qobject) { | 236 | if (!qobject) { |
| 236 | QStringList backtrace = _engine->currentContext()->backtrace(); | 237 | QStringList backtrace = _engine->currentContext()->backtrace(); |
| 237 | qDebug(scriptengine) << "ScriptObjectV8Proxy::investigate: Object pointer is NULL, " << backtrace; | 238 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::investigate: Object pointer is NULL, " << backtrace; |
| 238 | } | 239 | } |
| 239 | if (!qobject) return; | 240 | if (!qobject) return; |
| 240 | 241 | ||
| @@ -251,7 +252,7 @@ void ScriptObjectV8Proxy::investigate() { · 10 unmodified lines | |||
| 251 | 252 | ||
| 252 | const QMetaObject* metaObject = qobject->metaObject(); | 253 | const QMetaObject* metaObject = qobject->metaObject(); |
| 253 | 254 | ||
| 254 | //qDebug(scriptengine) << "Investigate: " << metaObject->className(); | 255 | //qCDebug(scriptengine_v8) << "Investigate: " << metaObject->className(); |
| 255 | if (QString("ConsoleScriptingInterface") == metaObject->className()) { | 256 | if (QString("ConsoleScriptingInterface") == metaObject->className()) { |
| 256 | printf("ConsoleScriptingInterface"); | 257 | printf("ConsoleScriptingInterface"); |
| 257 | } | 258 | } |
| @@ -262,7 +263,7 @@ void ScriptObjectV8Proxy::investigate() { · 4 unmodified lines | |||
| 262 | QMetaProperty prop = metaObject->property(idx); | 263 | QMetaProperty prop = metaObject->property(idx); |
| 263 | if (!prop.isScriptable()) continue; | 264 | if (!prop.isScriptable()) continue; |
| 264 | 265 | ||
| 265 | //qDebug(scriptengine) << "Investigate: " << metaObject->className() << " Property: " << prop.name(); | 266 | //qCDebug(scriptengine_v8) << "Investigate: " << metaObject->className() << " Property: " << prop.name(); |
| 266 | // always exclude child objects (at least until we decide otherwise) | 267 | // always exclude child objects (at least until we decide otherwise) |
| 267 | int metaTypeId = prop.userType(); | 268 | int metaTypeId = prop.userType(); |
| 268 | if (metaTypeId != QMetaType::UnknownType) { | 269 | if (metaTypeId != QMetaType::UnknownType) { |
| @@ -285,7 +286,7 @@ void ScriptObjectV8Proxy::investigate() { · 16 unmodified lines | |||
| 285 | QHash<V8ScriptString, int> methodNames; | 286 | QHash<V8ScriptString, int> methodNames; |
| 286 | for (int idx = startIdx; idx < num; ++idx) { | 287 | for (int idx = startIdx; idx < num; ++idx) { |
| 287 | QMetaMethod method = metaObject->method(idx); | 288 | QMetaMethod method = metaObject->method(idx); |
| 288 | //qDebug(scriptengine) << "Investigate: " << metaObject->className() << " Method: " << method.name(); | 289 | //qCDebug(scriptengine_v8) << "Investigate: " << metaObject->className() << " Method: " << method.name(); |
| 289 | 290 | ||
| 290 | // perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible | 291 | // perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible |
| 291 | /* if (method.access() != QMetaMethod::Public) continue;*/ | 292 | /* if (method.access() != QMetaMethod::Public) continue;*/ |
| @@ -319,9 +320,9 @@ void ScriptObjectV8Proxy::investigate() { · 27 unmodified lines | |||
| 319 | SignalDef& signalDef = _signals.insert(idx, SignalDef(_engine, name.get())).value(); | 320 | SignalDef& signalDef = _signals.insert(idx, SignalDef(_engine, name.get())).value(); |
| 320 | signalDef.name = name; | 321 | signalDef.name = name; |
| 321 | signalDef.signal = method; | 322 | signalDef.signal = method; |
| 322 | //qDebug(scriptengine) << "Utf8Value 1: " << QString(*v8::String::Utf8Value(const_cast<v8::Isolate*>(_engine->getIsolate()), nameString)); | 323 | //qCDebug(scriptengine_v8) << "Utf8Value 1: " << QString(*v8::String::Utf8Value(const_cast<v8::Isolate*>(_engine->getIsolate()), nameString)); |
| 323 | //qDebug(scriptengine) << "Utf8Value 2: " << QString(*v8::String::Utf8Value(const_cast<v8::Isolate*>(_engine->getIsolate()), name.constGet())); | 324 | //qCDebug(scriptengine_v8) << "Utf8Value 2: " << QString(*v8::String::Utf8Value(const_cast<v8::Isolate*>(_engine->getIsolate()), name.constGet())); |
| 324 | //qDebug(scriptengine) << "toQString: " << name.toQString(); | 325 | //qCDebug(scriptengine_v8) << "toQString: " << name.toQString(); |
| 325 | methodNames.insert(name, idx); | 326 | methodNames.insert(name, idx); |
| 326 | } else { | 327 | } else { |
| 327 | int originalMethodId = nameLookup.value(); | 328 | int originalMethodId = nameLookup.value(); |
| @@ -336,11 +337,11 @@ void ScriptObjectV8Proxy::investigate() { · 8 unmodified lines | |||
| 336 | } else { | 337 | } else { |
| 337 | int parameterCount = method.parameterCount(); | 338 | int parameterCount = method.parameterCount(); |
| 338 | if(method.returnType() == QMetaType::UnknownType) { | 339 | if(method.returnType() == QMetaType::UnknownType) { |
| 339 | qCritical(scriptengine) << "Method " << metaObject->className() << "::" << name.toQString() << " has QMetaType::UnknownType return value"; | 340 | qCCritical(scriptengine_v8) << "Method " << metaObject->className() << "::" << name.toQString() << " has QMetaType::UnknownType return value"; |
| 340 | } | 341 | } |
| 341 | for (int i = 0; i < method.parameterCount(); i++) { | 342 | for (int i = 0; i < method.parameterCount(); i++) { |
| 342 | if (method.parameterType(i) == QMetaType::UnknownType) { | 343 | if (method.parameterType(i) == QMetaType::UnknownType) { |
| 343 | qCritical(scriptengine) << "Parameter " << i << "in method " << metaObject->className() << "::" << name.toQString() << " is of type QMetaType::UnknownType"; | 344 | qCCritical(scriptengine_v8) << "Parameter " << i << "in method " << metaObject->className() << "::" << name.toQString() << " is of type QMetaType::UnknownType"; |
| 344 | } | 345 | } |
| 345 | } | 346 | } |
| 346 | if (nameLookup == methodNames.end()) { | 347 | if (nameLookup == methodNames.end()) { |
| @@ -403,7 +404,7 @@ ScriptObjectV8Proxy::QueryFlags ScriptObjectV8Proxy::queryProperty(const V8Scrip · 56 unmodified lines | |||
| 403 | // check for methods | 404 | // check for methods |
| 404 | for (MethodDefMap::const_iterator trans = _methods.cbegin(); trans != _methods.cend(); ++trans) { | 405 | for (MethodDefMap::const_iterator trans = _methods.cbegin(); trans != _methods.cend(); ++trans) { |
| 405 | v8::String::Utf8Value methodNameStr(isolate, trans.value().name.constGet()); | 406 | v8::String::Utf8Value methodNameStr(isolate, trans.value().name.constGet()); |
| 406 | //qDebug(scriptengine) << "queryProperty : " << *nameStr << " method: " << *methodNameStr; | 407 | //qCDebug(scriptengine_v8) << "queryProperty : " << *nameStr << " method: " << *methodNameStr; |
| 407 | if (!(trans.value().name == name)) continue; | 408 | if (!(trans.value().name == name)) continue; |
| 408 | *id = trans.key() | METHOD_TYPE; | 409 | *id = trans.key() | METHOD_TYPE; |
| 409 | return flags & (HandlesReadAccess | HandlesWriteAccess); | 410 | return flags & (HandlesReadAccess | HandlesWriteAccess); |
| @@ -458,17 +459,17 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall · 48 unmodified lines | |||
| 458 | v8::HandleScope handleScope(info.GetIsolate()); | 459 | v8::HandleScope handleScope(info.GetIsolate()); |
| 459 | //V8TODO: should there be a context scope here? | 460 | //V8TODO: should there be a context scope here? |
| 460 | v8::String::Utf8Value utf8Value(info.GetIsolate(), name); | 461 | v8::String::Utf8Value utf8Value(info.GetIsolate(), name); |
| 461 | //qDebug(scriptengine) << "Get: " << *utf8Value; | 462 | //qCDebug(scriptengine_v8) << "Get: " << *utf8Value; |
| 462 | v8::Local<v8::Value> objectV8 = info.This(); | 463 | v8::Local<v8::Value> objectV8 = info.This(); |
| 463 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); | 464 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 464 | if (!proxy) { | 465 | if (!proxy) { |
| 465 | qDebug(scriptengine) << "Proxy object not found when getting: " << *utf8Value; | 466 | qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Value; |
| 466 | return; | 467 | return; |
| 467 | } | 468 | } |
| 468 | V8ScriptValue object(proxy->_engine, objectV8); | 469 | V8ScriptValue object(proxy->_engine, objectV8); |
| 469 | if (!name->IsString() && !name->IsSymbol()) { | 470 | if (!name->IsString() && !name->IsSymbol()) { |
| 470 | QString notStringMessage("ScriptObjectV8Proxy::v8Get: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); | 471 | QString notStringMessage("ScriptObjectV8Proxy::v8Get: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); |
| 471 | qDebug(scriptengine) << notStringMessage; | 472 | qCDebug(scriptengine_v8) << notStringMessage; |
| 472 | Q_ASSERT(false); | 473 | Q_ASSERT(false); |
| 473 | } | 474 | } |
| 474 | v8::Local<v8::String> v8NameString; | 475 | v8::Local<v8::String> v8NameString; |
| @@ -481,7 +482,7 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall · 6 unmodified lines | |||
| 481 | } | 482 | } |
| 482 | 483 | ||
| 483 | if (name->IsSymbol()) { | 484 | if (name->IsSymbol()) { |
| 484 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); | 485 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); |
| 485 | }*/ | 486 | }*/ |
| 486 | if (name->IsString()) { | 487 | if (name->IsString()) { |
| 487 | V8ScriptString nameString(proxy->_engine, v8::Local<v8::String>::Cast(name)); | 488 | V8ScriptString nameString(proxy->_engine, v8::Local<v8::String>::Cast(name)); |
| @@ -498,7 +499,7 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall · 10 unmodified lines | |||
| 498 | if(info.This()->GetInternalField(2).As<v8::Object>()->Get(proxy->_engine->getContext(), name).ToLocal(&property)) { | 499 | if(info.This()->GetInternalField(2).As<v8::Object>()->Get(proxy->_engine->getContext(), name).ToLocal(&property)) { |
| 499 | info.GetReturnValue().Set(property); | 500 | info.GetReturnValue().Set(property); |
| 500 | } else { | 501 | } else { |
| 501 | qDebug(scriptengine) << "Value not found: " << *utf8Value; | 502 | qCDebug(scriptengine_v8) << "Value not found: " << *utf8Value; |
| 502 | } | 503 | } |
| 503 | } | 504 | } |
| 504 | 505 | ||
| @@ -506,17 +507,17 @@ void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> v · 1 unmodified line | |||
| 506 | v8::HandleScope handleScope(info.GetIsolate()); | 507 | v8::HandleScope handleScope(info.GetIsolate()); |
| 507 | //V8TODO: should there be a context scope here? | 508 | //V8TODO: should there be a context scope here? |
| 508 | v8::String::Utf8Value utf8Value(info.GetIsolate(), name); | 509 | v8::String::Utf8Value utf8Value(info.GetIsolate(), name); |
| 509 | //qDebug(scriptengine) << "Set: " << *utf8Value; | 510 | //qCDebug(scriptengine_v8) << "Set: " << *utf8Value; |
| 510 | v8::Local<v8::Value> objectV8 = info.This(); | 511 | v8::Local<v8::Value> objectV8 = info.This(); |
| 511 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); | 512 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 512 | if (!proxy) { | 513 | if (!proxy) { |
| 513 | qDebug(scriptengine) << "Proxy object not found when setting: " << *utf8Value; | 514 | qCDebug(scriptengine_v8) << "Proxy object not found when setting: " << *utf8Value; |
| 514 | return; | 515 | return; |
| 515 | } | 516 | } |
| 516 | V8ScriptValue object(proxy->_engine, objectV8); | 517 | V8ScriptValue object(proxy->_engine, objectV8); |
| 517 | if (!name->IsString() && !name->IsSymbol()) { | 518 | if (!name->IsString() && !name->IsSymbol()) { |
| 518 | QString notStringMessage("ScriptObjectV8Proxy::v8Set: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); | 519 | QString notStringMessage("ScriptObjectV8Proxy::v8Set: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); |
| 519 | qDebug(scriptengine) << notStringMessage; | 520 | qCDebug(scriptengine_v8) << notStringMessage; |
| 520 | Q_ASSERT(false); | 521 | Q_ASSERT(false); |
| 521 | } | 522 | } |
| 522 | /*v8::Local<v8::String> v8NameString; | 523 | /*v8::Local<v8::String> v8NameString; |
| @@ -528,7 +529,7 @@ void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> v · 5 unmodified lines | |||
| 528 | } | 529 | } |
| 529 | } | 530 | } |
| 530 | if (name->IsSymbol()) { | 531 | if (name->IsSymbol()) { |
| 531 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); | 532 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); |
| 532 | }*/ | 533 | }*/ |
| 533 | //V8ScriptString nameString(info.GetIsolate(), name->ToString(proxy->_engine->getContext()).ToLocalChecked()); | 534 | //V8ScriptString nameString(info.GetIsolate(), name->ToString(proxy->_engine->getContext()).ToLocalChecked()); |
| 534 | if (name->IsString()) { | 535 | if (name->IsString()) { |
| @@ -545,19 +546,19 @@ void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> v · 10 unmodified lines | |||
| 545 | if (info.This()->GetInternalField(2).As<v8::Object>()->Set(proxy->_engine->getContext(), name, value).FromMaybe(false)) { | 546 | if (info.This()->GetInternalField(2).As<v8::Object>()->Set(proxy->_engine->getContext(), name, value).FromMaybe(false)) { |
| 546 | info.GetReturnValue().Set(value); | 547 | info.GetReturnValue().Set(value); |
| 547 | } else { | 548 | } else { |
| 548 | qDebug(scriptengine) << "Set failed: " << *utf8Value; | 549 | qCDebug(scriptengine_v8) << "Set failed: " << *utf8Value; |
| 549 | } | 550 | } |
| 550 | } | 551 | } |
| 551 | 552 | ||
| 552 | void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) { | 553 | void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) { |
| 553 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; | 554 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; |
| 554 | v8::HandleScope handleScope(info.GetIsolate()); | 555 | v8::HandleScope handleScope(info.GetIsolate()); |
| 555 | auto context = info.GetIsolate()->GetCurrentContext(); | 556 | auto context = info.GetIsolate()->GetCurrentContext(); |
| 556 | v8::Context::Scope contextScope(context); | 557 | v8::Context::Scope contextScope(context); |
| 557 | v8::Local<v8::Value> objectV8 = info.This(); | 558 | v8::Local<v8::Value> objectV8 = info.This(); |
| 558 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); | 559 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 559 | if (!proxy) { | 560 | if (!proxy) { |
| 560 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames: Proxy object not found when listing"; | 561 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames: Proxy object not found when listing"; |
| 561 | return; | 562 | return; |
| 562 | } | 563 | } |
| 563 | V8ScriptValue object(proxy->_engine, objectV8); | 564 | V8ScriptValue object(proxy->_engine, objectV8); |
| @@ -568,7 +569,7 @@ void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8:: · 4 unmodified lines | |||
| 568 | if (info.This()->GetInternalField(2).As<v8::Object>()->GetPropertyNames(context).ToLocal(&objectProperties)) { | 569 | if (info.This()->GetInternalField(2).As<v8::Object>()->GetPropertyNames(context).ToLocal(&objectProperties)) { |
| 569 | for (uint32_t n = 0; n < objectProperties->Length(); n++) { | 570 | for (uint32_t n = 0; n < objectProperties->Length(); n++) { |
| 570 | if(!properties->Set(context, propertiesLength+n, objectProperties->Get(context, n).ToLocalChecked()).FromMaybe(false)) { | 571 | if(!properties->Set(context, propertiesLength+n, objectProperties->Get(context, n).ToLocalChecked()).FromMaybe(false)) { |
| 571 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames: Cannot add member name"; | 572 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames: Cannot add member name"; |
| 572 | } | 573 | } |
| 573 | } | 574 | } |
| 574 | } | 575 | } |
| @@ -587,17 +588,17 @@ v8::Local<v8::Array> ScriptObjectV8Proxy::getPropertyNames() { · 12 unmodified lines | |||
| 587 | uint32_t position = 0; | 588 | uint32_t position = 0; |
| 588 | for (PropertyDefMap::const_iterator i = _props.begin(); i != _props.end(); i++){ | 589 | for (PropertyDefMap::const_iterator i = _props.begin(); i != _props.end(); i++){ |
| 589 | if(!properties->Set(context, position++, i.value().name.constGet()).FromMaybe(false)) { | 590 | if(!properties->Set(context, position++, i.value().name.constGet()).FromMaybe(false)) { |
| 590 | qDebug(scriptengine) << "ScriptObjectV8Proxy::getPropertyNames: Cannot add property member name"; | 591 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::getPropertyNames: Cannot add property member name"; |
| 591 | } | 592 | } |
| 592 | } | 593 | } |
| 593 | for (MethodDefMap::const_iterator i = _methods.begin(); i != _methods.end(); i++){ | 594 | for (MethodDefMap::const_iterator i = _methods.begin(); i != _methods.end(); i++){ |
| 594 | if(!properties->Set(context, position++, i.value().name.constGet()).FromMaybe(false)) { | 595 | if(!properties->Set(context, position++, i.value().name.constGet()).FromMaybe(false)) { |
| 595 | qDebug(scriptengine) << "ScriptObjectV8Proxy::getPropertyNames: Cannot add property member name"; | 596 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::getPropertyNames: Cannot add property member name"; |
| 596 | } | 597 | } |
| 597 | } | 598 | } |
| 598 | for (SignalDefMap::const_iterator i = _signals.begin(); i != _signals.end(); i++){ | 599 | for (SignalDefMap::const_iterator i = _signals.begin(); i != _signals.end(); i++){ |
| 599 | if(!properties->Set(context, position++, i.value().name.constGet()).FromMaybe(false)) { | 600 | if(!properties->Set(context, position++, i.value().name.constGet()).FromMaybe(false)) { |
| 600 | qDebug(scriptengine) << "ScriptObjectV8Proxy::getPropertyNames: Cannot add property member name"; | 601 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::getPropertyNames: Cannot add property member name"; |
| 601 | } | 602 | } |
| 602 | } | 603 | } |
| 603 | return handleScope.Escape(properties); | 604 | return handleScope.Escape(properties); |
| @@ -639,7 +640,7 @@ V8ScriptValue ScriptObjectV8Proxy::property(const V8ScriptValue& object, const V · 35 unmodified lines | |||
| 639 | const MethodDef& methodDef = lookup.value(); | 640 | const MethodDef& methodDef = lookup.value(); |
| 640 | for (auto iter = methodDef.methods.begin(); iter != methodDef.methods.end(); iter++ ) { | 641 | for (auto iter = methodDef.methods.begin(); iter != methodDef.methods.end(); iter++ ) { |
| 641 | if((*iter).returnType() == QMetaType::UnknownType) { | 642 | if((*iter).returnType() == QMetaType::UnknownType) { |
| 642 | qDebug(scriptengine) << "Method with QMetaType::UnknownType " << metaObject->className() << " " << (*iter).name(); | 643 | qCDebug(scriptengine_v8) << "Method with QMetaType::UnknownType " << metaObject->className() << " " << (*iter).name(); |
| 643 | } | 644 | } |
| 644 | } //V8TODO: is new method created during every call? It needs to be cached instead | 645 | } //V8TODO: is new method created during every call? It needs to be cached instead |
| 645 | //bool isMethodDefined = false; | 646 | //bool isMethodDefined = false; |
| @@ -650,7 +651,7 @@ V8ScriptValue ScriptObjectV8Proxy::property(const V8ScriptValue& object, const V · 4 unmodified lines | |||
| 650 | } | 651 | } |
| 651 | } | 652 | } |
| 652 | Q_ASSERT(false); | 653 | Q_ASSERT(false); |
| 653 | qDebug(scriptengine) << "(This should not happen) Creating new method object for " << metaObject->className() << " " << name.toQString(); | 654 | qCDebug(scriptengine_v8) << "(This should not happen) Creating new method object for " << metaObject->className() << " " << name.toQString(); |
| 654 | return ScriptMethodV8Proxy::newMethod(_engine, qobject, object, methodDef.methods, methodDef.numMaxParms); | 655 | return ScriptMethodV8Proxy::newMethod(_engine, qobject, object, methodDef.methods, methodDef.numMaxParms); |
| 655 | } | 656 | } |
| 656 | case SIGNAL_TYPE: { | 657 | case SIGNAL_TYPE: { |
| @@ -828,7 +829,7 @@ void ScriptVariantV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCal · 171 unmodified lines | |||
| 828 | v8::Local<v8::Value> objectV8 = info.This(); | 829 | v8::Local<v8::Value> objectV8 = info.This(); |
| 829 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); | 830 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 830 | if (!proxy) { | 831 | if (!proxy) { |
| 831 | qDebug(scriptengine) << "Proxy object not found when getting: " << *utf8Name; | 832 | qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Name; |
| 832 | return; | 833 | return; |
| 833 | } | 834 | } |
| 834 | V8ScriptValue object(proxy->_engine, proxy->_v8Object.Get(info.GetIsolate())); | 835 | V8ScriptValue object(proxy->_engine, proxy->_v8Object.Get(info.GetIsolate())); |
| @@ -844,13 +845,13 @@ void ScriptVariantV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCal · 9 unmodified lines | |||
| 844 | } | 845 | } |
| 845 | } | 846 | } |
| 846 | 847 | ||
| 847 | qDebug(scriptengine) << "Value not found: " << *utf8Name; | 848 | qCDebug(scriptengine_v8) << "Value not found: " << *utf8Name; |
| 848 | // V8TODO: this is done differently for variant proxy - use internal field of _v8Object instead? | 849 | // V8TODO: this is done differently for variant proxy - use internal field of _v8Object instead? |
| 849 | /*v8::Local<v8::Value> property; | 850 | /*v8::Local<v8::Value> property; |
| 850 | if(info.This()->GetInternalField(2).As<v8::Object>()->Get(proxy->_engine->getContext(), name).ToLocal(&property)) { | 851 | if(info.This()->GetInternalField(2).As<v8::Object>()->Get(proxy->_engine->getContext(), name).ToLocal(&property)) { |
| 851 | info.GetReturnValue().Set(property); | 852 | info.GetReturnValue().Set(property); |
| 852 | } else { | 853 | } else { |
| 853 | qDebug(scriptengine) << "Value not found: " << *utf8Value; | 854 | qCDebug(scriptengine_v8) << "Value not found: " << *utf8Value; |
| 854 | }*/ | 855 | }*/ |
| 855 | } | 856 | } |
| 856 | 857 | ||
| @@ -860,14 +861,14 @@ void ScriptVariantV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> · 3 unmodified lines | |||
| 860 | v8::Local<v8::Value> objectV8 = info.This(); | 861 | v8::Local<v8::Value> objectV8 = info.This(); |
| 861 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); | 862 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 862 | if (!proxy) { | 863 | if (!proxy) { |
| 863 | qDebug(scriptengine) << "Proxy object not found when getting: " << *utf8Name; | 864 | qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Name; |
| 864 | return; | 865 | return; |
| 865 | } | 866 | } |
| 866 | 867 | ||
| 867 | V8ScriptValue object(proxy->_engine, objectV8); | 868 | V8ScriptValue object(proxy->_engine, objectV8); |
| 868 | if (!name->IsString() && !name->IsSymbol()) { | 869 | if (!name->IsString() && !name->IsSymbol()) { |
| 869 | QString notStringMessage("ScriptObjectV8Proxy::v8Set: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); | 870 | QString notStringMessage("ScriptObjectV8Proxy::v8Set: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); |
| 870 | qDebug(scriptengine) << notStringMessage; | 871 | qCDebug(scriptengine_v8) << notStringMessage; |
| 871 | Q_ASSERT(false); | 872 | Q_ASSERT(false); |
| 872 | } | 873 | } |
| 873 | 874 | ||
| @@ -885,21 +886,21 @@ void ScriptVariantV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> · 11 unmodified lines | |||
| 885 | /*if (info.This()->GetInternalField(2).As<v8::Object>()->Set(proxy->_engine->getContext(), name, value).FromMaybe(false)) { | 886 | /*if (info.This()->GetInternalField(2).As<v8::Object>()->Set(proxy->_engine->getContext(), name, value).FromMaybe(false)) { |
| 886 | info.GetReturnValue().Set(value); | 887 | info.GetReturnValue().Set(value); |
| 887 | } else { | 888 | } else { |
| 888 | qDebug(scriptengine) << "Set failed: " << *utf8Name; | 889 | qCDebug(scriptengine_v8) << "Set failed: " << *utf8Name; |
| 889 | }*/ | 890 | }*/ |
| 890 | qDebug(scriptengine) << "Set failed: " << *utf8Name; | 891 | qCDebug(scriptengine_v8) << "Set failed: " << *utf8Name; |
| 891 | } | 892 | } |
| 892 | 893 | ||
| 893 | void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) { | 894 | void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) { |
| 894 | //V8TODO: Only methods from the prototype should be listed. | 895 | //V8TODO: Only methods from the prototype should be listed. |
| 895 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; | 896 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; |
| 896 | v8::HandleScope handleScope(info.GetIsolate()); | 897 | v8::HandleScope handleScope(info.GetIsolate()); |
| 897 | auto context = info.GetIsolate()->GetCurrentContext(); | 898 | auto context = info.GetIsolate()->GetCurrentContext(); |
| 898 | v8::Context::Scope contextScope(context); | 899 | v8::Context::Scope contextScope(context); |
| 899 | v8::Local<v8::Value> objectV8 = info.This(); | 900 | v8::Local<v8::Value> objectV8 = info.This(); |
| 900 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); | 901 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 901 | if (!proxy) { | 902 | if (!proxy) { |
| 902 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames: Proxy object not found when listing"; | 903 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames: Proxy object not found when listing"; |
| 903 | return; | 904 | return; |
| 904 | } | 905 | } |
| 905 | V8ScriptValue object(proxy->_engine, objectV8); | 906 | V8ScriptValue object(proxy->_engine, objectV8); |
| @@ -910,7 +911,7 @@ void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8: · 4 unmodified lines | |||
| 910 | if (info.This()->GetInternalField(2).As<v8::Object>()->GetPropertyNames(context).ToLocal(&objectProperties)) { | 911 | if (info.This()->GetInternalField(2).As<v8::Object>()->GetPropertyNames(context).ToLocal(&objectProperties)) { |
| 911 | for (uint32_t n = 0; n < objectProperties->Length(); n++) { | 912 | for (uint32_t n = 0; n < objectProperties->Length(); n++) { |
| 912 | if(!properties->Set(context, propertiesLength+n, objectProperties->Get(context, n).ToLocalChecked()).FromMaybe(false)) { | 913 | if(!properties->Set(context, propertiesLength+n, objectProperties->Get(context, n).ToLocalChecked()).FromMaybe(false)) { |
| 913 | qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames: Cannot add member name"; | 914 | qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames: Cannot add member name"; |
| 914 | } | 915 | } |
| 915 | } | 916 | } |
| 916 | }*/ | 917 | }*/ |
| @@ -929,7 +930,7 @@ ScriptMethodV8Proxy::ScriptMethodV8Proxy(ScriptEngineV8* engine, QObject* object · 12 unmodified lines | |||
| 929 | } | 930 | } |
| 930 | 931 | ||
| 931 | ScriptMethodV8Proxy::~ScriptMethodV8Proxy() { | 932 | ScriptMethodV8Proxy::~ScriptMethodV8Proxy() { |
| 932 | qDebug(scriptengine) << "ScriptMethodV8Proxy destroyed"; | 933 | qCDebug(scriptengine_v8) << "ScriptMethodV8Proxy destroyed"; |
| 933 | printf("ScriptMethodV8Proxy destroyed"); | 934 | printf("ScriptMethodV8Proxy destroyed"); |
| 934 | } | 935 | } |
| 935 | 936 | ||
| @@ -1107,7 +1108,7 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 171 unmodified lines | |||
| 1107 | // nothing in there for return values so these need to be explicitly runtime-registered! | 1108 | // nothing in there for return values so these need to be explicitly runtime-registered! |
| 1108 | if (returnTypeId == QMetaType::UnknownType) { | 1109 | if (returnTypeId == QMetaType::UnknownType) { |
| 1109 | QString methodName = fullName(); | 1110 | QString methodName = fullName(); |
| 1110 | qDebug(scriptengine) << "returnTypeId == QMetaType::UnknownType for method " << methodName; | 1111 | qCDebug(scriptengine_v8) << "returnTypeId == QMetaType::UnknownType for method " << methodName; |
| 1111 | _engine->logBacktrace(""); | 1112 | _engine->logBacktrace(""); |
| 1112 | //Q_ASSERT(false); | 1113 | //Q_ASSERT(false); |
| 1113 | } | 1114 | } |
| @@ -1173,7 +1174,7 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 59 unmodified lines | |||
| 1173 | QByteArray argTypeName = _engine->valueType(V8ScriptValue(_engine, argVal)).toLatin1(); | 1174 | QByteArray argTypeName = _engine->valueType(V8ScriptValue(_engine, argVal)).toLatin1(); |
| 1174 | QString errorMessage = QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") | 1175 | QString errorMessage = QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") |
| 1175 | .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName); | 1176 | .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName); |
| 1176 | qDebug(scriptengine) << errorMessage << "\n Backtrace:" << _engine->currentContext()->backtrace(); | 1177 | qCDebug(scriptengine_v8) << errorMessage << "\n Backtrace:" << _engine->currentContext()->backtrace(); |
| 1177 | isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); | 1178 | isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); |
| 1178 | //context->throwError(V8ScriptContext::TypeError, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") | 1179 | //context->throwError(V8ScriptContext::TypeError, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") |
| 1179 | // .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName)); | 1180 | // .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName)); |
| @@ -1182,7 +1183,7 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 2 unmodified lines | |||
| 1182 | } | 1183 | } |
| 1183 | } | 1184 | } |
| 1184 | QString errorMessage = QString("Native call of %1 failed: could not locate an overload with the requested arguments").arg(fullName()); | 1185 | QString errorMessage = QString("Native call of %1 failed: could not locate an overload with the requested arguments").arg(fullName()); |
| 1185 | qDebug(scriptengine) << errorMessage; | 1186 | qCDebug(scriptengine_v8) << errorMessage; |
| 1186 | isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); | 1187 | isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); |
| 1187 | // V8TODO: it happens sometimes for some reason | 1188 | // V8TODO: it happens sometimes for some reason |
| 1188 | Q_ASSERT(false); // really shouldn't have gotten here -- it didn't work before and it's working now? | 1189 | Q_ASSERT(false); // really shouldn't have gotten here -- it didn't work before and it's working now? |
| @@ -1384,7 +1385,7 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu · 195 unmodified lines | |||
| 1384 | 1385 | ||
| 1385 | _callCounter++; | 1386 | _callCounter++; |
| 1386 | if (_callCounter % 10 == 0) { | 1387 | if (_callCounter % 10 == 0) { |
| 1387 | qDebug() << "Script engine: " << _engine->manager()->getFilename() << " Signal proxy " << fullName() | 1388 | qCDebug(scriptengine_v8) << "Script engine: " << _engine->manager()->getFilename() << " Signal proxy " << fullName() |
| 1388 | << " call count: " << _callCounter << " total time: " << _totalCallTime_s; | 1389 | << " call count: " << _callCounter << " total time: " << _totalCallTime_s; |
| 1389 | } | 1390 | } |
| 1390 | QElapsedTimer callTimer; | 1391 | QElapsedTimer callTimer; |
| @@ -1434,7 +1435,7 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu · 43 unmodified lines | |||
| 1434 | /*if (!conn.callback.get()->IsFunction()) { | 1435 | /*if (!conn.callback.get()->IsFunction()) { |
| 1435 | auto stringV8 = conn.callback.get()->ToDetailString(context).ToLocalChecked(); | 1436 | auto stringV8 = conn.callback.get()->ToDetailString(context).ToLocalChecked(); |
| 1436 | QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8); | 1437 | QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8); |
| 1437 | qDebug() << error; | 1438 | qCDebug(scriptengine_v8) << error; |
| 1438 | Q_ASSERT(false); | 1439 | Q_ASSERT(false); |
| 1439 | } | 1440 | } |
| 1440 | v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(conn.callback.get()); | 1441 | v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(conn.callback.get()); |
| @@ -1449,14 +1450,14 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu · 8 unmodified lines | |||
| 1449 | Q_ASSERT(!conn.callback.get().IsEmpty()); | 1450 | Q_ASSERT(!conn.callback.get().IsEmpty()); |
| 1450 | Q_ASSERT(!conn.callback.get()->IsUndefined()); | 1451 | Q_ASSERT(!conn.callback.get()->IsUndefined()); |
| 1451 | if (conn.callback.get()->IsNull()) { | 1452 | if (conn.callback.get()->IsNull()) { |
| 1452 | qDebug() << "ScriptSignalV8Proxy::qt_metacall: Connection callback is Null"; | 1453 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::qt_metacall: Connection callback is Null"; |
| 1453 | _engine->popContext(); | 1454 | _engine->popContext(); |
| 1454 | continue; | 1455 | continue; |
| 1455 | } | 1456 | } |
| 1456 | if (!conn.callback.get()->IsFunction()) { | 1457 | if (!conn.callback.get()->IsFunction()) { |
| 1457 | auto stringV8 = conn.callback.get()->ToDetailString(functionContext).ToLocalChecked(); | 1458 | auto stringV8 = conn.callback.get()->ToDetailString(functionContext).ToLocalChecked(); |
| 1458 | QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8); | 1459 | QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8); |
| 1459 | qDebug() << error; | 1460 | qCDebug(scriptengine_v8) << error; |
| 1460 | Q_ASSERT(false); | 1461 | Q_ASSERT(false); |
| 1461 | } | 1462 | } |
| 1462 | v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(conn.callback.get()); | 1463 | v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(conn.callback.get()); |
| @@ -1577,7 +1578,7 @@ void ScriptSignalV8Proxy::connect(ScriptValue arg0, ScriptValue arg1) { · 114 unmodified lines | |||
| 1577 | Q_ASSERT(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)); | 1578 | Q_ASSERT(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)); |
| 1578 | ScriptSignalV8Proxy* thisProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)->toQObject()); | 1579 | ScriptSignalV8Proxy* thisProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)->toQObject()); |
| 1579 | Q_ASSERT(thisProxy); | 1580 | Q_ASSERT(thisProxy); |
| 1580 | qDebug(scriptengine) << "ScriptSignalV8Proxy::connect: " << thisProxy->fullName() << " fullName: " << fullName(); | 1581 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::connect: " << thisProxy->fullName() << " fullName: " << fullName(); |
| 1581 | //Q_ASSERT(destFunction->InternalFieldCount() == 4); | 1582 | //Q_ASSERT(destFunction->InternalFieldCount() == 4); |
| 1582 | //Q_ASSERT(destData.get()->IsArray()); | 1583 | //Q_ASSERT(destData.get()->IsArray()); |
| 1583 | //v8::Local<v8::Value> destData = destFunction->GetInternalField(3); | 1584 | //v8::Local<v8::Value> destData = destFunction->GetInternalField(3); |
| @@ -1593,14 +1594,14 @@ void ScriptSignalV8Proxy::connect(ScriptValue arg0, ScriptValue arg1) { · 9 unmodified lines | |||
| 1593 | for (int idx = 0; idx < length && !foundIt; ++idx) { | 1594 | for (int idx = 0; idx < length && !foundIt; ++idx) { |
| 1594 | v8::Local<v8::Value> entry = destArray->Get(destFunctionContext, idx).ToLocalChecked(); | 1595 | v8::Local<v8::Value> entry = destArray->Get(destFunctionContext, idx).ToLocalChecked(); |
| 1595 | { | 1596 | { |
| 1596 | qDebug() << "ScriptSignalV8Proxy::connect: entry details: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, entry)); | 1597 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::connect: entry details: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, entry)); |
| 1597 | Q_ASSERT(entry->IsObject()); | 1598 | Q_ASSERT(entry->IsObject()); |
| 1598 | V8ScriptValue v8EntryObject(_engine, entry); | 1599 | V8ScriptValue v8EntryObject(_engine, entry); |
| 1599 | Q_ASSERT(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)); | 1600 | Q_ASSERT(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)); |
| 1600 | // For debugging | 1601 | // For debugging |
| 1601 | ScriptSignalV8Proxy* entryProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)->toQObject()); | 1602 | ScriptSignalV8Proxy* entryProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)->toQObject()); |
| 1602 | Q_ASSERT(thisProxy); | 1603 | Q_ASSERT(thisProxy); |
| 1603 | qDebug(scriptengine) << "ScriptSignalV8Proxy::connect: entry proxy: " << entryProxy->fullName(); | 1604 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::connect: entry proxy: " << entryProxy->fullName(); |
| 1604 | } | 1605 | } |
| 1605 | if (!newArray->Set(destFunctionContext, idx, entry).FromMaybe(false)) { | 1606 | if (!newArray->Set(destFunctionContext, idx, entry).FromMaybe(false)) { |
| 1606 | Q_ASSERT(false); | 1607 | Q_ASSERT(false); |
| @@ -1712,7 +1713,7 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 105 unmodified lines | |||
| 1712 | // For debugging | 1713 | // For debugging |
| 1713 | ScriptSignalV8Proxy* thisProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)->toQObject()); | 1714 | ScriptSignalV8Proxy* thisProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)->toQObject()); |
| 1714 | Q_ASSERT(thisProxy); | 1715 | Q_ASSERT(thisProxy); |
| 1715 | qDebug(scriptengine) << "ScriptSignalV8Proxy::disconnect: " << thisProxy->fullName() << " fullName: " << fullName(); | 1716 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::disconnect: " << thisProxy->fullName() << " fullName: " << fullName(); |
| 1716 | //V8ScriptValue destData = callback.data(); | 1717 | //V8ScriptValue destData = callback.data(); |
| 1717 | //Q_ASSERT(destData->IsArray()); | 1718 | //Q_ASSERT(destData->IsArray()); |
| 1718 | if (!destFunction->Get(destFunctionContext, destDataName).ToLocal(&destData)) { | 1719 | if (!destFunction->Get(destFunctionContext, destDataName).ToLocal(&destData)) { |
| @@ -1730,7 +1731,7 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 11 unmodified lines | |||
| 1730 | // For debugging: | 1731 | // For debugging: |
| 1731 | { | 1732 | { |
| 1732 | _engine->logBacktrace("ScriptSignalV8Proxy::disconnect"); | 1733 | _engine->logBacktrace("ScriptSignalV8Proxy::disconnect"); |
| 1733 | qDebug() << "ScriptSignalV8Proxy::disconnect: entry details: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, entry)) | 1734 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::disconnect: entry details: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, entry)) |
| 1734 | << " Array: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, destArray)); | 1735 | << " Array: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, destArray)); |
| 1735 | Q_ASSERT(entry->IsObject()); | 1736 | Q_ASSERT(entry->IsObject()); |
| 1736 | V8ScriptValue v8EntryObject(_engine, entry); | 1737 | V8ScriptValue v8EntryObject(_engine, entry); |
| @@ -1738,12 +1739,12 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 1 unmodified line | |||
| 1738 | // For debugging | 1739 | // For debugging |
| 1739 | ScriptSignalV8Proxy* entryProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)->toQObject()); | 1740 | ScriptSignalV8Proxy* entryProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)->toQObject()); |
| 1740 | Q_ASSERT(thisProxy); | 1741 | Q_ASSERT(thisProxy); |
| 1741 | qDebug(scriptengine) << "ScriptSignalV8Proxy::disconnect: entry proxy: " << entryProxy->fullName(); | 1742 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::disconnect: entry proxy: " << entryProxy->fullName(); |
| 1742 | } | 1743 | } |
| 1743 | if (entry->StrictEquals(v8ThisObject.get())) { | 1744 | if (entry->StrictEquals(v8ThisObject.get())) { |
| 1744 | //V8TODO: compare proxies instead? | 1745 | //V8TODO: compare proxies instead? |
| 1745 | foundIt = true; | 1746 | foundIt = true; |
| 1746 | qDebug() << "ScriptSignalV8Proxy::disconnect foundIt"; | 1747 | qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::disconnect foundIt"; |
| 1747 | //V8ScriptValueList args; | 1748 | //V8ScriptValueList args; |
| 1748 | //args << idx << 1; | 1749 | //args << idx << 1; |
| 1749 | //destData.property("splice").call(destData, args); | 1750 | //destData.property("splice").call(destData, args); |