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 | 23 | #include "ScriptContextV8Wrapper.h" |
| 24 | 24 | #include "ScriptValueV8Wrapper.h" |
| 25 | +#include "ScriptEngineLoggingV8.h" | |
| 25 | 26 | |
| 26 | 27 | //V8TODO: is this needed for anything? It could cause trouble with multithreading if V8ScriptContext is v8::Persistent |
| 27 | 28 | //Q_DECLARE_METATYPE(V8ScriptContext*) |
| @@ -110,7 +111,7 @@ V8ScriptValue ScriptObjectV8Proxy::newQObject(ScriptEngineV8* engine, QObject* o · 82 unmodified lines | ||
| 110 | 111 | break; |
| 111 | 112 | default: |
| 112 | 113 | ownsObject = false; |
| 113 | − qCritical() << "Wrong ScriptEngine::ValueOwnership value: " << ownership; | |
| 114 | + qCCritical(scriptengine_v8) << "Wrong ScriptEngine::ValueOwnership value: " << ownership; | |
| 114 | 115 | break; |
| 115 | 116 | } |
| 116 | 117 | |
| @@ -166,16 +167,16 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(const V8ScriptValue& val) · 49 unmodified lines | ||
| 166 | 167 | return nullptr; |
| 167 | 168 | } |
| 168 | 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 | 171 | return nullptr; |
| 171 | 172 | } |
| 172 | 173 | v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value); |
| 173 | 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 | 176 | return nullptr; |
| 176 | 177 | } |
| 177 | 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 | 180 | return nullptr; |
| 180 | 181 | } |
| 181 | 182 | return reinterpret_cast<ScriptObjectV8Proxy*>(v8Object->GetAlignedPointerFromInternalField(1)); |
| @@ -189,20 +190,20 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(v8::Isolate* isolate, v8:: · 7 unmodified lines | ||
| 189 | 190 | //v8::Local<v8::Context> context = val.constGetContext(); |
| 190 | 191 | //v8::Context::Scope contextScope(context); |
| 191 | 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 | 194 | return nullptr; |
| 194 | 195 | } |
| 195 | 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 | 198 | return nullptr; |
| 198 | 199 | } |
| 199 | 200 | v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(value); |
| 200 | 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 | 203 | return nullptr; |
| 203 | 204 | } |
| 204 | 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 | 207 | return nullptr; |
| 207 | 208 | } |
| 208 | 209 | return reinterpret_cast<ScriptObjectV8Proxy*>(v8Object->GetAlignedPointerFromInternalField(1)); |
| @@ -218,7 +219,7 @@ ScriptObjectV8Proxy::~ScriptObjectV8Proxy() { · 9 unmodified lines | ||
| 218 | 219 | v8::Locker locker(isolate); |
| 219 | 220 | v8::Isolate::Scope isolateScope(isolate); |
| 220 | 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 | 223 | // V8TODO: once WeakPersistent pointer is added we should check if it's valid before deleting |
| 223 | 224 | Q_ASSERT(!_v8Object.Get(isolate)->IsNullOrUndefined()); |
| 224 | 225 | // This prevents unwrap function from unwrapping proxy that was deleted |
| @@ -234,7 +235,7 @@ void ScriptObjectV8Proxy::investigate() { · 9 unmodified lines | ||
| 234 | 235 | QObject* qobject = _object; |
| 235 | 236 | if (!qobject) { |
| 236 | 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 | 240 | if (!qobject) return; |
| 240 | 241 | |
| @@ -251,7 +252,7 @@ void ScriptObjectV8Proxy::investigate() { · 10 unmodified lines | ||
| 251 | 252 | |
| 252 | 253 | const QMetaObject* metaObject = qobject->metaObject(); |
| 253 | 254 | |
| 254 | − //qDebug(scriptengine) << "Investigate: " << metaObject->className(); | |
| 255 | + //qCDebug(scriptengine_v8) << "Investigate: " << metaObject->className(); | |
| 255 | 256 | if (QString("ConsoleScriptingInterface") == metaObject->className()) { |
| 256 | 257 | printf("ConsoleScriptingInterface"); |
| 257 | 258 | } |
| @@ -262,7 +263,7 @@ void ScriptObjectV8Proxy::investigate() { · 4 unmodified lines | ||
| 262 | 263 | QMetaProperty prop = metaObject->property(idx); |
| 263 | 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 | 267 | // always exclude child objects (at least until we decide otherwise) |
| 267 | 268 | int metaTypeId = prop.userType(); |
| 268 | 269 | if (metaTypeId != QMetaType::UnknownType) { |
| @@ -285,7 +286,7 @@ void ScriptObjectV8Proxy::investigate() { · 16 unmodified lines | ||
| 285 | 286 | QHash<V8ScriptString, int> methodNames; |
| 286 | 287 | for (int idx = startIdx; idx < num; ++idx) { |
| 287 | 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 | 291 | // perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible |
| 291 | 292 | /* if (method.access() != QMetaMethod::Public) continue;*/ |
| @@ -319,9 +320,9 @@ void ScriptObjectV8Proxy::investigate() { · 27 unmodified lines | ||
| 319 | 320 | SignalDef& signalDef = _signals.insert(idx, SignalDef(_engine, name.get())).value(); |
| 320 | 321 | signalDef.name = name; |
| 321 | 322 | signalDef.signal = method; |
| 322 | − //qDebug(scriptengine) << "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 | − //qDebug(scriptengine) << "toQString: " << name.toQString(); | |
| 323 | + //qCDebug(scriptengine_v8) << "Utf8Value 1: " << QString(*v8::String::Utf8Value(const_cast<v8::Isolate*>(_engine->getIsolate()), nameString)); | |
| 324 | + //qCDebug(scriptengine_v8) << "Utf8Value 2: " << QString(*v8::String::Utf8Value(const_cast<v8::Isolate*>(_engine->getIsolate()), name.constGet())); | |
| 325 | + //qCDebug(scriptengine_v8) << "toQString: " << name.toQString(); | |
| 325 | 326 | methodNames.insert(name, idx); |
| 326 | 327 | } else { |
| 327 | 328 | int originalMethodId = nameLookup.value(); |
| @@ -336,11 +337,11 @@ void ScriptObjectV8Proxy::investigate() { · 8 unmodified lines | ||
| 336 | 337 | } else { |
| 337 | 338 | int parameterCount = method.parameterCount(); |
| 338 | 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 | 342 | for (int i = 0; i < method.parameterCount(); i++) { |
| 342 | 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 | 347 | if (nameLookup == methodNames.end()) { |
| @@ -403,7 +404,7 @@ ScriptObjectV8Proxy::QueryFlags ScriptObjectV8Proxy::queryProperty(const V8Scrip · 56 unmodified lines | ||
| 403 | 404 | // check for methods |
| 404 | 405 | for (MethodDefMap::const_iterator trans = _methods.cbegin(); trans != _methods.cend(); ++trans) { |
| 405 | 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 | 408 | if (!(trans.value().name == name)) continue; |
| 408 | 409 | *id = trans.key() | METHOD_TYPE; |
| 409 | 410 | return flags & (HandlesReadAccess | HandlesWriteAccess); |
| @@ -458,17 +459,17 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall · 48 unmodified lines | ||
| 458 | 459 | v8::HandleScope handleScope(info.GetIsolate()); |
| 459 | 460 | //V8TODO: should there be a context scope here? |
| 460 | 461 | v8::String::Utf8Value utf8Value(info.GetIsolate(), name); |
| 461 | − //qDebug(scriptengine) << "Get: " << *utf8Value; | |
| 462 | + //qCDebug(scriptengine_v8) << "Get: " << *utf8Value; | |
| 462 | 463 | v8::Local<v8::Value> objectV8 = info.This(); |
| 463 | 464 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 464 | 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 | 467 | return; |
| 467 | 468 | } |
| 468 | 469 | V8ScriptValue object(proxy->_engine, objectV8); |
| 469 | 470 | if (!name->IsString() && !name->IsSymbol()) { |
| 470 | 471 | QString notStringMessage("ScriptObjectV8Proxy::v8Get: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); |
| 471 | − qDebug(scriptengine) << notStringMessage; | |
| 472 | + qCDebug(scriptengine_v8) << notStringMessage; | |
| 472 | 473 | Q_ASSERT(false); |
| 473 | 474 | } |
| 474 | 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 | 484 | if (name->IsSymbol()) { |
| 484 | − qDebug(scriptengine) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); | |
| 485 | + qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); | |
| 485 | 486 | }*/ |
| 486 | 487 | if (name->IsString()) { |
| 487 | 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 | 499 | if(info.This()->GetInternalField(2).As<v8::Object>()->Get(proxy->_engine->getContext(), name).ToLocal(&property)) { |
| 499 | 500 | info.GetReturnValue().Set(property); |
| 500 | 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 | 507 | v8::HandleScope handleScope(info.GetIsolate()); |
| 507 | 508 | //V8TODO: should there be a context scope here? |
| 508 | 509 | v8::String::Utf8Value utf8Value(info.GetIsolate(), name); |
| 509 | − //qDebug(scriptengine) << "Set: " << *utf8Value; | |
| 510 | + //qCDebug(scriptengine_v8) << "Set: " << *utf8Value; | |
| 510 | 511 | v8::Local<v8::Value> objectV8 = info.This(); |
| 511 | 512 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 512 | 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 | 515 | return; |
| 515 | 516 | } |
| 516 | 517 | V8ScriptValue object(proxy->_engine, objectV8); |
| 517 | 518 | if (!name->IsString() && !name->IsSymbol()) { |
| 518 | 519 | QString notStringMessage("ScriptObjectV8Proxy::v8Set: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); |
| 519 | − qDebug(scriptengine) << notStringMessage; | |
| 520 | + qCDebug(scriptengine_v8) << notStringMessage; | |
| 520 | 521 | Q_ASSERT(false); |
| 521 | 522 | } |
| 522 | 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 | 531 | if (name->IsSymbol()) { |
| 531 | − qDebug(scriptengine) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); | |
| 532 | + qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8Set: symbol: " + nameString.toQString(); | |
| 532 | 533 | }*/ |
| 533 | 534 | //V8ScriptString nameString(info.GetIsolate(), name->ToString(proxy->_engine->getContext()).ToLocalChecked()); |
| 534 | 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 | 546 | if (info.This()->GetInternalField(2).As<v8::Object>()->Set(proxy->_engine->getContext(), name, value).FromMaybe(false)) { |
| 546 | 547 | info.GetReturnValue().Set(value); |
| 547 | 548 | } else { |
| 548 | − qDebug(scriptengine) << "Set failed: " << *utf8Value; | |
| 549 | + qCDebug(scriptengine_v8) << "Set failed: " << *utf8Value; | |
| 549 | 550 | } |
| 550 | 551 | } |
| 551 | 552 | |
| 552 | 553 | void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) { |
| 553 | − qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; | |
| 554 | + qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; | |
| 554 | 555 | v8::HandleScope handleScope(info.GetIsolate()); |
| 555 | 556 | auto context = info.GetIsolate()->GetCurrentContext(); |
| 556 | 557 | v8::Context::Scope contextScope(context); |
| 557 | 558 | v8::Local<v8::Value> objectV8 = info.This(); |
| 558 | 559 | ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 559 | 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 | 562 | return; |
| 562 | 563 | } |
| 563 | 564 | V8ScriptValue object(proxy->_engine, objectV8); |
| @@ -568,7 +569,7 @@ void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8:: · 4 unmodified lines | ||
| 568 | 569 | if (info.This()->GetInternalField(2).As<v8::Object>()->GetPropertyNames(context).ToLocal(&objectProperties)) { |
| 569 | 570 | for (uint32_t n = 0; n < objectProperties->Length(); n++) { |
| 570 | 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 | 588 | uint32_t position = 0; |
| 588 | 589 | for (PropertyDefMap::const_iterator i = _props.begin(); i != _props.end(); i++){ |
| 589 | 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 | 594 | for (MethodDefMap::const_iterator i = _methods.begin(); i != _methods.end(); i++){ |
| 594 | 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 | 599 | for (SignalDefMap::const_iterator i = _signals.begin(); i != _signals.end(); i++){ |
| 599 | 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 | 604 | return handleScope.Escape(properties); |
| @@ -639,7 +640,7 @@ V8ScriptValue ScriptObjectV8Proxy::property(const V8ScriptValue& object, const V · 35 unmodified lines | ||
| 639 | 640 | const MethodDef& methodDef = lookup.value(); |
| 640 | 641 | for (auto iter = methodDef.methods.begin(); iter != methodDef.methods.end(); iter++ ) { |
| 641 | 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 | 645 | } //V8TODO: is new method created during every call? It needs to be cached instead |
| 645 | 646 | //bool isMethodDefined = false; |
| @@ -650,7 +651,7 @@ V8ScriptValue ScriptObjectV8Proxy::property(const V8ScriptValue& object, const V · 4 unmodified lines | ||
| 650 | 651 | } |
| 651 | 652 | } |
| 652 | 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 | 655 | return ScriptMethodV8Proxy::newMethod(_engine, qobject, object, methodDef.methods, methodDef.numMaxParms); |
| 655 | 656 | } |
| 656 | 657 | case SIGNAL_TYPE: { |
| @@ -828,7 +829,7 @@ void ScriptVariantV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCal · 171 unmodified lines | ||
| 828 | 829 | v8::Local<v8::Value> objectV8 = info.This(); |
| 829 | 830 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 830 | 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 | 833 | return; |
| 833 | 834 | } |
| 834 | 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 | 849 | // V8TODO: this is done differently for variant proxy - use internal field of _v8Object instead? |
| 849 | 850 | /*v8::Local<v8::Value> property; |
| 850 | 851 | if(info.This()->GetInternalField(2).As<v8::Object>()->Get(proxy->_engine->getContext(), name).ToLocal(&property)) { |
| 851 | 852 | info.GetReturnValue().Set(property); |
| 852 | 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 | 861 | v8::Local<v8::Value> objectV8 = info.This(); |
| 861 | 862 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 862 | 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 | 865 | return; |
| 865 | 866 | } |
| 866 | 867 | |
| 867 | 868 | V8ScriptValue object(proxy->_engine, objectV8); |
| 868 | 869 | if (!name->IsString() && !name->IsSymbol()) { |
| 869 | 870 | QString notStringMessage("ScriptObjectV8Proxy::v8Set: " + proxy->_engine->scriptValueDebugDetailsV8(V8ScriptValue(proxy->_engine, name))); |
| 870 | − qDebug(scriptengine) << notStringMessage; | |
| 871 | + qCDebug(scriptengine_v8) << notStringMessage; | |
| 871 | 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 | 886 | /*if (info.This()->GetInternalField(2).As<v8::Object>()->Set(proxy->_engine->getContext(), name, value).FromMaybe(false)) { |
| 886 | 887 | info.GetReturnValue().Set(value); |
| 887 | 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 | 894 | void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) { |
| 894 | 895 | //V8TODO: Only methods from the prototype should be listed. |
| 895 | − qDebug(scriptengine) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; | |
| 896 | + qCDebug(scriptengine_v8) << "ScriptObjectV8Proxy::v8GetPropertyNames called"; | |
| 896 | 897 | v8::HandleScope handleScope(info.GetIsolate()); |
| 897 | 898 | auto context = info.GetIsolate()->GetCurrentContext(); |
| 898 | 899 | v8::Context::Scope contextScope(context); |
| 899 | 900 | v8::Local<v8::Value> objectV8 = info.This(); |
| 900 | 901 | ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8); |
| 901 | 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 | 904 | return; |
| 904 | 905 | } |
| 905 | 906 | V8ScriptValue object(proxy->_engine, objectV8); |
| @@ -910,7 +911,7 @@ void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8: · 4 unmodified lines | ||
| 910 | 911 | if (info.This()->GetInternalField(2).As<v8::Object>()->GetPropertyNames(context).ToLocal(&objectProperties)) { |
| 911 | 912 | for (uint32_t n = 0; n < objectProperties->Length(); n++) { |
| 912 | 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 | 932 | ScriptMethodV8Proxy::~ScriptMethodV8Proxy() { |
| 932 | − qDebug(scriptengine) << "ScriptMethodV8Proxy destroyed"; | |
| 933 | + qCDebug(scriptengine_v8) << "ScriptMethodV8Proxy destroyed"; | |
| 933 | 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 | 1108 | // nothing in there for return values so these need to be explicitly runtime-registered! |
| 1108 | 1109 | if (returnTypeId == QMetaType::UnknownType) { |
| 1109 | 1110 | QString methodName = fullName(); |
| 1110 | − qDebug(scriptengine) << "returnTypeId == QMetaType::UnknownType for method " << methodName; | |
| 1111 | + qCDebug(scriptengine_v8) << "returnTypeId == QMetaType::UnknownType for method " << methodName; | |
| 1111 | 1112 | _engine->logBacktrace(""); |
| 1112 | 1113 | //Q_ASSERT(false); |
| 1113 | 1114 | } |
| @@ -1173,7 +1174,7 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 59 unmodified lines | ||
| 1173 | 1174 | QByteArray argTypeName = _engine->valueType(V8ScriptValue(_engine, argVal)).toLatin1(); |
| 1174 | 1175 | QString errorMessage = QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") |
| 1175 | 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 | 1178 | isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); |
| 1178 | 1179 | //context->throwError(V8ScriptContext::TypeError, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") |
| 1179 | 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 | 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 | 1187 | isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); |
| 1187 | 1188 | // V8TODO: it happens sometimes for some reason |
| 1188 | 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 | 1386 | _callCounter++; |
| 1386 | 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 | 1389 | << " call count: " << _callCounter << " total time: " << _totalCallTime_s; |
| 1389 | 1390 | } |
| 1390 | 1391 | QElapsedTimer callTimer; |
| @@ -1434,7 +1435,7 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu · 43 unmodified lines | ||
| 1434 | 1435 | /*if (!conn.callback.get()->IsFunction()) { |
| 1435 | 1436 | auto stringV8 = conn.callback.get()->ToDetailString(context).ToLocalChecked(); |
| 1436 | 1437 | QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8); |
| 1437 | − qDebug() << error; | |
| 1438 | + qCDebug(scriptengine_v8) << error; | |
| 1438 | 1439 | Q_ASSERT(false); |
| 1439 | 1440 | } |
| 1440 | 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 | 1450 | Q_ASSERT(!conn.callback.get().IsEmpty()); |
| 1450 | 1451 | Q_ASSERT(!conn.callback.get()->IsUndefined()); |
| 1451 | 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 | 1454 | _engine->popContext(); |
| 1454 | 1455 | continue; |
| 1455 | 1456 | } |
| 1456 | 1457 | if (!conn.callback.get()->IsFunction()) { |
| 1457 | 1458 | auto stringV8 = conn.callback.get()->ToDetailString(functionContext).ToLocalChecked(); |
| 1458 | 1459 | QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8); |
| 1459 | − qDebug() << error; | |
| 1460 | + qCDebug(scriptengine_v8) << error; | |
| 1460 | 1461 | Q_ASSERT(false); |
| 1461 | 1462 | } |
| 1462 | 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 | 1578 | Q_ASSERT(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)); |
| 1578 | 1579 | ScriptSignalV8Proxy* thisProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)->toQObject()); |
| 1579 | 1580 | Q_ASSERT(thisProxy); |
| 1580 | − qDebug(scriptengine) << "ScriptSignalV8Proxy::connect: " << thisProxy->fullName() << " fullName: " << fullName(); | |
| 1581 | + qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::connect: " << thisProxy->fullName() << " fullName: " << fullName(); | |
| 1581 | 1582 | //Q_ASSERT(destFunction->InternalFieldCount() == 4); |
| 1582 | 1583 | //Q_ASSERT(destData.get()->IsArray()); |
| 1583 | 1584 | //v8::Local<v8::Value> destData = destFunction->GetInternalField(3); |
| @@ -1593,14 +1594,14 @@ void ScriptSignalV8Proxy::connect(ScriptValue arg0, ScriptValue arg1) { · 9 unmodified lines | ||
| 1593 | 1594 | for (int idx = 0; idx < length && !foundIt; ++idx) { |
| 1594 | 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 | 1598 | Q_ASSERT(entry->IsObject()); |
| 1598 | 1599 | V8ScriptValue v8EntryObject(_engine, entry); |
| 1599 | 1600 | Q_ASSERT(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)); |
| 1600 | 1601 | // For debugging |
| 1601 | 1602 | ScriptSignalV8Proxy* entryProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)->toQObject()); |
| 1602 | 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 | 1606 | if (!newArray->Set(destFunctionContext, idx, entry).FromMaybe(false)) { |
| 1606 | 1607 | Q_ASSERT(false); |
| @@ -1712,7 +1713,7 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 105 unmodified lines | ||
| 1712 | 1713 | // For debugging |
| 1713 | 1714 | ScriptSignalV8Proxy* thisProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8ThisObject)->toQObject()); |
| 1714 | 1715 | Q_ASSERT(thisProxy); |
| 1715 | − qDebug(scriptengine) << "ScriptSignalV8Proxy::disconnect: " << thisProxy->fullName() << " fullName: " << fullName(); | |
| 1716 | + qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::disconnect: " << thisProxy->fullName() << " fullName: " << fullName(); | |
| 1716 | 1717 | //V8ScriptValue destData = callback.data(); |
| 1717 | 1718 | //Q_ASSERT(destData->IsArray()); |
| 1718 | 1719 | if (!destFunction->Get(destFunctionContext, destDataName).ToLocal(&destData)) { |
| @@ -1730,7 +1731,7 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 11 unmodified lines | ||
| 1730 | 1731 | // For debugging: |
| 1731 | 1732 | { |
| 1732 | 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 | 1735 | << " Array: " << _engine->scriptValueDebugDetailsV8(V8ScriptValue(_engine, destArray)); |
| 1735 | 1736 | Q_ASSERT(entry->IsObject()); |
| 1736 | 1737 | V8ScriptValue v8EntryObject(_engine, entry); |
| @@ -1738,12 +1739,12 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 1 unmodified line | ||
| 1738 | 1739 | // For debugging |
| 1739 | 1740 | ScriptSignalV8Proxy* entryProxy = dynamic_cast<ScriptSignalV8Proxy*>(ScriptObjectV8Proxy::unwrapProxy(v8EntryObject)->toQObject()); |
| 1740 | 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 | 1744 | if (entry->StrictEquals(v8ThisObject.get())) { |
| 1744 | 1745 | //V8TODO: compare proxies instead? |
| 1745 | 1746 | foundIt = true; |
| 1746 | − qDebug() << "ScriptSignalV8Proxy::disconnect foundIt"; | |
| 1747 | + qCDebug(scriptengine_v8) << "ScriptSignalV8Proxy::disconnect foundIt"; | |
| 1747 | 1748 | //V8ScriptValueList args; |
| 1748 | 1749 | //args << idx << 1; |
| 1749 | 1750 | //destData.property("splice").call(destData, args); |