Rename logging category to overte Make all V8 code use logging categories
Showing the changes to libraries/script-engine/src/v8/ScriptEngineV8.cpp (1 of 10 files). Show all
Unified · Split
| @@ -51,6 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | #include "ScriptProgramV8Wrapper.h" |
| 52 | 52 | #include "ScriptValueV8Wrapper.h" |
| 53 | 53 | #include "V8Lambda.h" |
| 54 | +#include "ScriptEngineLoggingV8.h" | |
| 54 | 55 | |
| 55 | 56 | static const int MAX_DEBUG_VALUE_LENGTH { 80 }; |
| 56 | 57 | |
| @@ -62,11 +63,11 @@ bool ScriptEngineV8::IS_THREADSAFE_INVOCATION(const QThread* thread, const QStri · 5 unmodified lines | ||
| 62 | 63 | if (currentThread == thread) { |
| 63 | 64 | return true; |
| 64 | 65 | } |
| 65 | − qCCritical(scriptengine) << QString("Scripting::%1 @ %2 -- ignoring thread-unsafe call from %3") | |
| 66 | + qCCritical(scriptengine_v8) << QString("Scripting::%1 @ %2 -- ignoring thread-unsafe call from %3") | |
| 66 | 67 | .arg(method) |
| 67 | 68 | .arg(thread ? thread->objectName() : "(!thread)") |
| 68 | 69 | .arg(QThread::currentThread()->objectName()); |
| 69 | − qCDebug(scriptengine) << "(please resolve on the calling side by using invokeMethod, executeOnScriptThread, etc.)"; | |
| 70 | + qCDebug(scriptengine_v8) << "(please resolve on the calling side by using invokeMethod, executeOnScriptThread, etc.)"; | |
| 70 | 71 | Q_ASSERT(false); |
| 71 | 72 | return false; |
| 72 | 73 | } |
| @@ -206,7 +207,7 @@ QString Lambda::toString() const { · 133 unmodified lines | ||
| 206 | 207 | |
| 207 | 208 | Lambda::~Lambda() { |
| 208 | 209 | #ifdef DEBUG_JS_LAMBDA_FUNCS |
| 209 | − qDebug() << "~Lambda" | |
| 210 | + qCDebug(scriptengine_v8) << "~Lambda" | |
| 210 | 211 | << "this" << this; |
| 211 | 212 | #endif |
| 212 | 213 | } |
| @@ -217,7 +218,7 @@ Lambda::Lambda(ScriptEngineV8* engine, · 4 unmodified lines | ||
| 217 | 218 | _engine(engine), |
| 218 | 219 | _operation(operation), _data(data) { |
| 219 | 220 | #ifdef DEBUG_JS_LAMBDA_FUNCS |
| 220 | − qDebug() << "Lambda" << data.toString(); | |
| 221 | + qCDebug(scriptengine_v8) << "Lambda" << data.toString(); | |
| 221 | 222 | #endif |
| 222 | 223 | } |
| 223 | 224 | V8ScriptValue Lambda::call() { |
| @@ -285,10 +286,10 @@ ScriptEngineV8::ScriptEngineV8(ScriptManager *manager) : ScriptEngine(manager), · 61 unmodified lines | ||
| 285 | 286 | //v8::V8::SetFlagsFromString("--stack-size=256 --single-threaded"); |
| 286 | 287 | v8::Platform* platform = getV8Platform(); |
| 287 | 288 | v8::V8::InitializePlatform(platform); |
| 288 | − v8::V8::Initialize(); qCDebug(scriptengine) << "V8 platform initialized"; | |
| 289 | + v8::V8::Initialize(); qCDebug(scriptengine_v8) << "V8 platform initialized"; | |
| 289 | 290 | } ); |
| 290 | 291 | _v8InitMutex.unlock(); |
| 291 | − qDebug() << "Creating new script engine"; | |
| 292 | + qCDebug(scriptengine_v8) << "Creating new script engine"; | |
| 292 | 293 | { |
| 293 | 294 | v8::Isolate::CreateParams isolateParams; |
| 294 | 295 | isolateParams.array_buffer_allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator(); |
| @@ -342,7 +343,7 @@ ScriptEngineV8::ScriptEngineV8(ScriptManager *manager) : ScriptEngine(manager), · 47 unmodified lines | ||
| 342 | 343 | |
| 343 | 344 | void ScriptEngineV8::registerEnum(const QString& enumName, QMetaEnum newEnum) { |
| 344 | 345 | if (!newEnum.isValid()) { |
| 345 | − qCCritical(scriptengine) << "registerEnum called on invalid enum with name " << enumName; | |
| 346 | + qCCritical(scriptengine_v8) << "registerEnum called on invalid enum with name " << enumName; | |
| 346 | 347 | return; |
| 347 | 348 | } |
| 348 | 349 | v8::Locker locker(_v8Isolate); |
| @@ -360,7 +361,7 @@ void ScriptEngineV8::registerEnum(const QString& enumName, QMetaEnum newEnum) { · 11 unmodified lines | ||
| 360 | 361 | void ScriptEngineV8::registerValue(const QString& valueName, V8ScriptValue value) { |
| 361 | 362 | if (QThread::currentThread() != thread()) { |
| 362 | 363 | #ifdef THREAD_DEBUGGING |
| 363 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::registerValue() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]"; | |
| 364 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::registerValue() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]"; | |
| 364 | 365 | #endif |
| 365 | 366 | QMetaObject::invokeMethod(this, "registerValue", |
| 366 | 367 | Q_ARG(const QString&, valueName), |
| @@ -412,7 +413,7 @@ void ScriptEngineV8::registerValue(const QString& valueName, V8ScriptValue value · 45 unmodified lines | ||
| 412 | 413 | if (partsToGo > 0) { |
| 413 | 414 | if (!child->IsObject()) { |
| 414 | 415 | QString details = *v8::String::Utf8Value(_v8Isolate, child->ToDetailString(context).ToLocalChecked()); |
| 415 | − qCDebug(scriptengine) << "ScriptEngineV8::registerValue: Part of path is not an object: " << pathPart << " details: " << details; | |
| 416 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::registerValue: Part of path is not an object: " << pathPart << " details: " << details; | |
| 416 | 417 | Q_ASSERT(false); |
| 417 | 418 | } |
| 418 | 419 | partObject = v8::Local<v8::Object>::Cast(child); |
| @@ -423,7 +424,7 @@ void ScriptEngineV8::registerValue(const QString& valueName, V8ScriptValue value · 4 unmodified lines | ||
| 423 | 424 | void ScriptEngineV8::registerGlobalObject(const QString& name, QObject* object) { |
| 424 | 425 | if (QThread::currentThread() != thread()) { |
| 425 | 426 | #ifdef THREAD_DEBUGGING |
| 426 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::registerGlobalObject() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] name:" << name; | |
| 427 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::registerGlobalObject() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] name:" << name; | |
| 427 | 428 | #endif |
| 428 | 429 | QMetaObject::invokeMethod(this, "registerGlobalObject", |
| 429 | 430 | Q_ARG(const QString&, name), |
| @@ -431,7 +432,7 @@ void ScriptEngineV8::registerGlobalObject(const QString& name, QObject* object) · 1 unmodified line | ||
| 431 | 432 | return; |
| 432 | 433 | } |
| 433 | 434 | #ifdef THREAD_DEBUGGING |
| 434 | − qCDebug(scriptengine) << "ScriptEngineV8::registerGlobalObject() called on thread [" << QThread::currentThread() << "] name:" << name; | |
| 435 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::registerGlobalObject() called on thread [" << QThread::currentThread() << "] name:" << name; | |
| 435 | 436 | #endif |
| 436 | 437 | /*bool is_isolate_exit_needed = false; |
| 437 | 438 | if(!_v8Isolate->IsCurrent() && !_v8Locker) { |
| @@ -475,7 +476,7 @@ void ScriptEngineV8::registerFunction(const QString& name, ScriptEngine::Functio · 37 unmodified lines | ||
| 475 | 476 | //} |
| 476 | 477 | if (QThread::currentThread() != thread()) { |
| 477 | 478 | #ifdef THREAD_DEBUGGING |
| 478 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::registerFunction() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] name:" << name; | |
| 479 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::registerFunction() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] name:" << name; | |
| 479 | 480 | #endif |
| 480 | 481 | QMetaObject::invokeMethod(this, "registerFunction", |
| 481 | 482 | Q_ARG(const QString&, name), |
| @@ -484,7 +485,7 @@ void ScriptEngineV8::registerFunction(const QString& name, ScriptEngine::Functio · 2 unmodified lines | ||
| 484 | 485 | return; |
| 485 | 486 | } |
| 486 | 487 | #ifdef THREAD_DEBUGGING |
| 487 | − qCDebug(scriptengine) << "ScriptEngineV8::registerFunction() called on thread [" << QThread::currentThread() << "] name:" << name; | |
| 488 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::registerFunction() called on thread [" << QThread::currentThread() << "] name:" << name; | |
| 488 | 489 | #endif |
| 489 | 490 | |
| 490 | 491 | /*bool is_isolate_exit_needed = false; |
| @@ -514,7 +515,7 @@ void ScriptEngineV8::registerFunction(const QString& name, ScriptEngine::Functio · 23 unmodified lines | ||
| 514 | 515 | void ScriptEngineV8::registerFunction(const QString& parent, const QString& name, ScriptEngine::FunctionSignature functionSignature, int numArguments) { |
| 515 | 516 | if (QThread::currentThread() != thread()) { |
| 516 | 517 | #ifdef THREAD_DEBUGGING |
| 517 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::registerFunction() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] parent:" << parent << "name:" << name; | |
| 518 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::registerFunction() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] parent:" << parent << "name:" << name; | |
| 518 | 519 | #endif |
| 519 | 520 | QMetaObject::invokeMethod(this, "registerFunction", |
| 520 | 521 | Q_ARG(const QString&, name), |
| @@ -523,7 +524,7 @@ void ScriptEngineV8::registerFunction(const QString& parent, const QString& name · 2 unmodified lines | ||
| 523 | 524 | return; |
| 524 | 525 | } |
| 525 | 526 | #ifdef THREAD_DEBUGGING |
| 526 | − qCDebug(scriptengine) << "ScriptEngineV8::registerFunction() called on thread [" << QThread::currentThread() << "] parent:" << parent << "name:" << name; | |
| 527 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::registerFunction() called on thread [" << QThread::currentThread() << "] parent:" << parent << "name:" << name; | |
| 527 | 528 | #endif |
| 528 | 529 | |
| 529 | 530 | /*bool is_isolate_exit_needed = false; |
| @@ -554,7 +555,7 @@ void ScriptEngineV8::registerGetterSetter(const QString& name, ScriptEngine::Fun · 24 unmodified lines | ||
| 554 | 555 | ScriptEngine::FunctionSignature setter, const QString& parent) { |
| 555 | 556 | if (QThread::currentThread() != thread()) { |
| 556 | 557 | #ifdef THREAD_DEBUGGING |
| 557 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::registerGetterSetter() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " | |
| 558 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::registerGetterSetter() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " | |
| 558 | 559 | " name:" << name << "parent:" << parent; |
| 559 | 560 | #endif |
| 560 | 561 | QMetaObject::invokeMethod(this, "registerGetterSetter", |
| @@ -565,7 +566,7 @@ void ScriptEngineV8::registerGetterSetter(const QString& name, ScriptEngine::Fun · 4 unmodified lines | ||
| 565 | 566 | return; |
| 566 | 567 | } |
| 567 | 568 | #ifdef THREAD_DEBUGGING |
| 568 | − qCDebug(scriptengine) << "ScriptEngineV8::registerGetterSetter() called on thread [" << QThread::currentThread() << "] name:" << name << "parent:" << parent; | |
| 569 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::registerGetterSetter() called on thread [" << QThread::currentThread() << "] name:" << name << "parent:" << parent; | |
| 569 | 570 | #endif |
| 570 | 571 | |
| 571 | 572 | /*bool is_isolate_exit_needed = false; |
| @@ -639,20 +640,20 @@ void ScriptEngineV8::registerGetterSetter(const QString& name, ScriptEngine::Fun · 67 unmodified lines | ||
| 639 | 640 | v8ObjectToSetProperty = v8ParentObject; |
| 640 | 641 | } |
| 641 | 642 | if (!v8ObjectToSetProperty->DefineProperty(getContext(), v8propertyName, propertyDescriptor).FromMaybe(false)) { |
| 642 | − qCDebug(scriptengine) << "DefineProperty failed for registerGetterSetter \"" << name << "\" for parent: \"" | |
| 643 | + qCDebug(scriptengine_v8) << "DefineProperty failed for registerGetterSetter \"" << name << "\" for parent: \"" | |
| 643 | 644 | << parent << "\""; |
| 644 | 645 | } |
| 645 | 646 | //object.setProperty(name, setterFunction, ScriptValue::PropertySetter); |
| 646 | 647 | //object.setProperty(name, getterFunction, ScriptValue::PropertyGetter); |
| 647 | 648 | } else { |
| 648 | − qCDebug(scriptengine) << "Parent object \"" << parent << "\" for registerGetterSetter \"" << name | |
| 649 | + qCDebug(scriptengine_v8) << "Parent object \"" << parent << "\" for registerGetterSetter \"" << name | |
| 649 | 650 | << "\" is not valid: "; |
| 650 | 651 | } |
| 651 | 652 | } else { |
| 652 | 653 | v8::Local<v8::String> v8propertyName = |
| 653 | 654 | v8::String::NewFromUtf8(_v8Isolate, name.toStdString().c_str()).ToLocalChecked(); |
| 654 | 655 | if (!getContext()->Global()->DefineProperty(getContext(), v8propertyName, propertyDescriptor).FromMaybe(false)) { |
| 655 | − qCDebug(scriptengine) << "DefineProperty failed for registerGetterSetter \"" << name << "\" for global object"; | |
| 656 | + qCDebug(scriptengine_v8) << "DefineProperty failed for registerGetterSetter \"" << name << "\" for global object"; | |
| 656 | 657 | } |
| 657 | 658 | //globalObject().setProperty(name, setterFunction, ScriptValue::PropertySetter); |
| 658 | 659 | //globalObject().setProperty(name, getterFunction, ScriptValue::PropertyGetter); |
| @@ -697,7 +698,7 @@ void ScriptEngineV8::storeGlobalObjectContents() { · 38 unmodified lines | ||
| 697 | 698 | } |
| 698 | 699 | |
| 699 | 700 | _globalObjectContents.Reset(_v8Isolate, globalMemberObjects); |
| 700 | − qDebug() << "ScriptEngineV8::storeGlobalObjectContents: " << globalMemberNames->Length() << " objects stored"; | |
| 701 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::storeGlobalObjectContents: " << globalMemberNames->Length() << " objects stored"; | |
| 701 | 702 | areGlobalObjectContentsStored = true; |
| 702 | 703 | } |
| 703 | 704 | |
| @@ -725,7 +726,7 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 21 unmodified lines | ||
| 725 | 726 | unwrappedProgram = ScriptProgramV8Wrapper::unwrap(_program); |
| 726 | 727 | if (unwrappedProgram == nullptr) { |
| 727 | 728 | _evaluatingCounter--; |
| 728 | − qDebug(scriptengine) << "Cannot unwrap program for closure"; | |
| 729 | + qCDebug(scriptengine_v8) << "Cannot unwrap program for closure"; | |
| 729 | 730 | Q_ASSERT(false); |
| 730 | 731 | return nullValue(); |
| 731 | 732 | } |
| @@ -737,7 +738,7 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 5 unmodified lines | ||
| 737 | 738 | unwrappedClosure = ScriptValueV8Wrapper::unwrap(_closure); |
| 738 | 739 | if (unwrappedClosure == nullptr) { |
| 739 | 740 | _evaluatingCounter--; |
| 740 | − qDebug(scriptengine) << "Cannot unwrap closure"; | |
| 741 | + qCDebug(scriptengine_v8) << "Cannot unwrap closure"; | |
| 741 | 742 | Q_ASSERT(false); |
| 742 | 743 | return nullValue(); |
| 743 | 744 | } |
| @@ -746,27 +747,27 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 2 unmodified lines | ||
| 746 | 747 | //const V8ScriptProgram& program = unwrappedProgram->toV8Value(); |
| 747 | 748 | if (!closure.constGet()->IsObject()) { |
| 748 | 749 | _evaluatingCounter--; |
| 749 | − qDebug(scriptengine) << "Unwrapped closure is not an object"; | |
| 750 | + qCDebug(scriptengine_v8) << "Unwrapped closure is not an object"; | |
| 750 | 751 | Q_ASSERT(false); |
| 751 | 752 | return nullValue(); |
| 752 | 753 | } |
| 753 | 754 | Q_ASSERT(closure.constGet()->IsObject()); |
| 754 | 755 | closureObject = v8::Local<v8::Object>::Cast(closure.constGet()); |
| 755 | − qDebug() << "Closure object members:" << scriptValueDebugListMembersV8(closure); | |
| 756 | + qCDebug(scriptengine_v8) << "Closure object members:" << scriptValueDebugListMembersV8(closure); | |
| 756 | 757 | v8::Local<v8::Object> testObject = v8::Object::New(_v8Isolate); |
| 757 | 758 | if(!testObject->Set(getContext(), v8::String::NewFromUtf8(_v8Isolate, "test_value").ToLocalChecked(), closureObject).FromMaybe(false)) { |
| 758 | 759 | Q_ASSERT(false); |
| 759 | 760 | } |
| 760 | − qDebug() << "Test object members:" << scriptValueDebugListMembersV8(V8ScriptValue(this, testObject)); | |
| 761 | + qCDebug(scriptengine_v8) << "Test object members:" << scriptValueDebugListMembersV8(V8ScriptValue(this, testObject)); | |
| 761 | 762 | |
| 762 | 763 | if (!closureObject->Get(closure.constGetContext(), v8::String::NewFromUtf8(_v8Isolate, "global").ToLocalChecked()) |
| 763 | 764 | .ToLocal(&closureGlobal)) { |
| 764 | 765 | _evaluatingCounter--; |
| 765 | − qDebug(scriptengine) << "Cannot get global from unwrapped closure"; | |
| 766 | + qCDebug(scriptengine_v8) << "Cannot get global from unwrapped closure"; | |
| 766 | 767 | Q_ASSERT(false); |
| 767 | 768 | return nullValue(); |
| 768 | 769 | } |
| 769 | − //qDebug() << "Closure global details:" << scriptValueDebugDetailsV8(V8ScriptValue(_v8Isolate, closureGlobal)); | |
| 770 | + //qCDebug(scriptengine_v8) << "Closure global details:" << scriptValueDebugDetailsV8(V8ScriptValue(_v8Isolate, closureGlobal)); | |
| 770 | 771 | } |
| 771 | 772 | //oldGlobal = _v8Context.Get(_v8Isolate)->Global(); |
| 772 | 773 | v8::Local<v8::Context> closureContext; |
| @@ -794,7 +795,7 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 21 unmodified lines | ||
| 794 | 795 | v8::Context::Scope contextScope(closureContext); |
| 795 | 796 | //const V8ScriptValue& closure = unwrappedClosure->toV8Value(); |
| 796 | 797 | if (!unwrappedProgram->compile()) { |
| 797 | − qDebug(scriptengine) << "Can't compile script for evaluating in closure"; | |
| 798 | + qCDebug(scriptengine_v8) << "Can't compile script for evaluating in closure"; | |
| 798 | 799 | Q_ASSERT(false); |
| 799 | 800 | popContext(); |
| 800 | 801 | return nullValue(); |
| @@ -806,12 +807,12 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 5 unmodified lines | ||
| 806 | 807 | /*if (!closureObject->Get(closure.constGetContext(), v8::String::NewFromUtf8(_v8Isolate, "this").ToLocalChecked()) |
| 807 | 808 | .ToLocal(&thiz)) { |
| 808 | 809 | _evaluatingCounter--; |
| 809 | − qDebug(scriptengine) << "Empty this object in closure"; | |
| 810 | + qCDebug(scriptengine_v8) << "Empty this object in closure"; | |
| 810 | 811 | Q_ASSERT(false); |
| 811 | 812 | return nullValue(); |
| 812 | 813 | }*/ |
| 813 | 814 | //thiz = closure.property("this"); |
| 814 | − //qDebug() << "Closure this details:" << scriptValueDebugDetailsV8(V8ScriptValue(_v8Isolate, thiz)); | |
| 815 | + //qCDebug(scriptengine_v8) << "Closure this details:" << scriptValueDebugDetailsV8(V8ScriptValue(_v8Isolate, thiz)); | |
| 815 | 816 | // V8TODO: |
| 816 | 817 | /*if (thiz->IsObject()) { |
| 817 | 818 | #ifdef DEBUG_JS |
| @@ -837,7 +838,7 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 19 unmodified lines | ||
| 837 | 838 | Q_ASSERT(false); |
| 838 | 839 | } |
| 839 | 840 | } |
| 840 | − qDebug() << "ScriptEngineV8::evaluateInClosure: " << globalMemberNames->Length() << " objects added to global"; | |
| 841 | + qCDebug(scriptengine_v8) << "ScriptEngineV8::evaluateInClosure: " << globalMemberNames->Length() << " objects added to global"; | |
| 841 | 842 | |
| 842 | 843 | /*auto oldGlobalMemberNames = oldContext->Global()->GetPropertyNames(oldContext).ToLocalChecked(); |
| 843 | 844 | //auto oldGlobalMemberNames = oldContext->Global()->GetPropertyNames(closureContext).ToLocalChecked(); |
| @@ -874,15 +875,15 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 30 unmodified lines | ||
| 874 | 875 | } else { |
| 875 | 876 | membersString = QString(" Is not an object"); |
| 876 | 877 | }*/ |
| 877 | − //qDebug(scriptengine) << "Closure global before run:" << membersString; | |
| 878 | + //qCDebug(scriptengine_v8) << "Closure global before run:" << membersString; | |
| 878 | 879 | auto maybeResult = program.constGet()->GetUnboundScript()->BindToCurrentContext()->Run(closureContext); |
| 879 | − //qDebug(scriptengine) << "Closure after run:" << scriptValueDebugDetailsV8(closure); | |
| 880 | + //qCDebug(scriptengine_v8) << "Closure after run:" << scriptValueDebugDetailsV8(closure); | |
| 880 | 881 | v8::Local<v8::Value> v8Result; |
| 881 | 882 | if (!maybeResult.ToLocal(&v8Result)) { |
| 882 | 883 | v8::String::Utf8Value utf8Value(getIsolate(), tryCatch.Exception()); |
| 883 | 884 | QString errorMessage = QString(*utf8Value); |
| 884 | − qWarning(scriptengine) << __FUNCTION__ << "---------- hasCaught:" << errorMessage; | |
| 885 | − qWarning(scriptengine) << __FUNCTION__ << "---------- tryCatch details:" << formatErrorMessageFromTryCatch(tryCatch); | |
| 885 | + qCWarning(scriptengine_v8) << __FUNCTION__ << "---------- hasCaught:" << errorMessage; | |
| 886 | + qCWarning(scriptengine_v8) << __FUNCTION__ << "---------- tryCatch details:" << formatErrorMessageFromTryCatch(tryCatch); | |
| 886 | 887 | //V8TODO: better error reporting |
| 887 | 888 | } |
| 888 | 889 | |
| @@ -919,7 +920,7 @@ ScriptValue ScriptEngineV8::evaluate(const QString& sourceCode, const QString& f · 30 unmodified lines | ||
| 919 | 920 | if (QThread::currentThread() != thread()) { |
| 920 | 921 | ScriptValue result; |
| 921 | 922 | #ifdef THREAD_DEBUGGING |
| 922 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::evaluate() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " | |
| 923 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::evaluate() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " | |
| 923 | 924 | "sourceCode:" << sourceCode << " fileName:" << fileName; |
| 924 | 925 | #endif |
| 925 | 926 | BLOCKING_INVOKE_METHOD(this, "evaluate", |
| @@ -944,7 +945,7 @@ ScriptValue ScriptEngineV8::evaluate(const QString& sourceCode, const QString& f · 18 unmodified lines | ||
| 944 | 945 | _evaluatingCounter--; |
| 945 | 946 | return nullValue(); |
| 946 | 947 | } |
| 947 | − //qCDebug(scriptengine) << "Script compilation succesful: " << fileName; | |
| 948 | + //qCDebug(scriptengine_v8) << "Script compilation succesful: " << fileName; | |
| 948 | 949 | |
| 949 | 950 | //V8TODO |
| 950 | 951 | /*auto syntaxError = lintScript(sourceCode, fileName); |
| @@ -971,7 +972,7 @@ ScriptValue ScriptEngineV8::evaluate(const QString& sourceCode, const QString& f · 20 unmodified lines | ||
| 971 | 972 | Q_ASSERT(tryCatchRun.HasCaught()); |
| 972 | 973 | auto runError = tryCatchRun.Message(); |
| 973 | 974 | ScriptValue errorValue(new ScriptValueV8Wrapper(this, V8ScriptValue(this, runError->Get()))); |
| 974 | − qCDebug(scriptengine) << "Running script: \"" << fileName << "\" " << formatErrorMessageFromTryCatch(tryCatchRun); | |
| 975 | + qCDebug(scriptengine_v8) << "Running script: \"" << fileName << "\" " << formatErrorMessageFromTryCatch(tryCatchRun); | |
| 975 | 976 | //V8TODO |
| 976 | 977 | |
| 977 | 978 | |
| @@ -995,7 +996,7 @@ void ScriptEngineV8::setUncaughtEngineException(const QString &reason, const QSt · 17 unmodified lines | ||
| 995 | 996 | |
| 996 | 997 | void ScriptEngineV8::setUncaughtException(const v8::TryCatch &tryCatch, const QString& info) { |
| 997 | 998 | if (!tryCatch.HasCaught()) { |
| 998 | − qCWarning(scriptengine) << "setUncaughtException called without exception"; | |
| 999 | + qCWarning(scriptengine_v8) << "setUncaughtException called without exception"; | |
| 999 | 1000 | clearExceptions(); |
| 1000 | 1001 | return; |
| 1001 | 1002 | } |
| @@ -1041,7 +1042,7 @@ void ScriptEngineV8::setUncaughtException(const v8::TryCatch &tryCatch, const QS · 39 unmodified lines | ||
| 1041 | 1042 | } |
| 1042 | 1043 | |
| 1043 | 1044 | void ScriptEngineV8::setUncaughtException(std::shared_ptr<ScriptException> uncaughtException) { |
| 1044 | − qCDebug(scriptengine) << "Emitting exception:" << uncaughtException; | |
| 1045 | + qCDebug(scriptengine_v8) << "Emitting exception:" << uncaughtException; | |
| 1045 | 1046 | _uncaughtException = uncaughtException; |
| 1046 | 1047 | |
| 1047 | 1048 | auto copy = uncaughtException->clone(); |
| @@ -1105,7 +1106,7 @@ Q_INVOKABLE ScriptValue ScriptEngineV8::evaluate(const ScriptProgramPointer& pro · 57 unmodified lines | ||
| 1105 | 1106 | if (QThread::currentThread() != thread()) { |
| 1106 | 1107 | ScriptValue result; |
| 1107 | 1108 | #ifdef THREAD_DEBUGGING |
| 1108 | − qCDebug(scriptengine) << "*** WARNING *** ScriptEngineV8::evaluate() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " | |
| 1109 | + qCDebug(scriptengine_v8) << "*** WARNING *** ScriptEngineV8::evaluate() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " | |
| 1109 | 1110 | "sourceCode:" << sourceCode << " fileName:" << fileName; |
| 1110 | 1111 | #endif |
| 1111 | 1112 | BLOCKING_INVOKE_METHOD(this, "evaluate", |
| @@ -1498,14 +1499,14 @@ QThread* ScriptEngineV8::thread() const { · 386 unmodified lines | ||
| 1498 | 1499 | void ScriptEngineV8::setThread(QThread* thread) { |
| 1499 | 1500 | if (_v8Isolate->IsCurrent()) { |
| 1500 | 1501 | _v8Isolate->Exit(); |
| 1501 | − qDebug() << "Script engine " << objectName() << " exited isolate"; | |
| 1502 | + qCDebug(scriptengine_v8) << "Script engine " << objectName() << " exited isolate"; | |
| 1502 | 1503 | } |
| 1503 | 1504 | Q_ASSERT(QObject::thread() == QThread::currentThread()); |
| 1504 | 1505 | /*if (_v8Locker) { |
| 1505 | 1506 | _v8Locker.reset(); |
| 1506 | 1507 | }*/ |
| 1507 | 1508 | moveToThread(thread); |
| 1508 | − qDebug() << "Moved script engine " << objectName() << " to different thread"; | |
| 1509 | + qCDebug(scriptengine_v8) << "Moved script engine " << objectName() << " to different thread"; | |
| 1509 | 1510 | } |
| 1510 | 1511 | |
| 1511 | 1512 | /*void ScriptEngineV8::enterIsolateOnThisThread() { |
| @@ -1514,7 +1515,7 @@ void ScriptEngineV8::setThread(QThread* thread) { · 2 unmodified lines | ||
| 1514 | 1515 | _v8Locker.reset(new v8::Locker(_v8Isolate)); |
| 1515 | 1516 | if (!_v8Isolate->IsCurrent()) { |
| 1516 | 1517 | _v8Isolate->Enter(); |
| 1517 | − qDebug() << "Script engine " << objectName() << " entered isolate on a new thread"; | |
| 1518 | + qCDebug(scriptengine_v8) << "Script engine " << objectName() << " entered isolate on a new thread"; | |
| 1518 | 1519 | } |
| 1519 | 1520 | }*/ |
| 1520 | 1521 | |
| @@ -1534,14 +1535,14 @@ bool ScriptEngineV8::raiseException(const QString& error, const QString &reason) · 13 unmodified lines | ||
| 1534 | 1535 | bool ScriptEngineV8::raiseException(const ScriptValue& exception, const QString &reason) { |
| 1535 | 1536 | //V8TODO |
| 1536 | 1537 | //Q_ASSERT(false); |
| 1537 | −// qCritical() << "Script exception occurred: " << exception.toString(); | |
| 1538 | +// qCCritical(scriptengine_v8) << "Script exception occurred: " << exception.toString(); | |
| 1538 | 1539 | // ScriptValueV8Wrapper* unwrapped = ScriptValueV8Wrapper::unwrap(exception); |
| 1539 | 1540 | // V8ScriptValue qException = unwrapped ? unwrapped->toV8Value() : QScriptEngine::newVariant(exception.toVariant()); |
| 1540 | 1541 | |
| 1541 | 1542 | // emit |
| 1542 | 1543 | //return raiseException(qException); |
| 1543 | 1544 | |
| 1544 | −// qCCritical(scriptengine) << "Raise exception for reason" << reason << "NOT IMPLEMENTED!"; | |
| 1545 | +// qCCritical(scriptengine_v8) << "Raise exception for reason" << reason << "NOT IMPLEMENTED!"; | |
| 1545 | 1546 | // return false; |
| 1546 | 1547 | |
| 1547 | 1548 | return raiseException(ScriptValueV8Wrapper::fullUnwrap(this, exception)); |
| @@ -1615,9 +1616,9 @@ void ScriptEngineV8::compileTest() { · 67 unmodified lines | ||
| 1615 | 1616 | v8::Local<v8::Script> script; |
| 1616 | 1617 | v8::ScriptOrigin scriptOrigin(getIsolate(), v8::String::NewFromUtf8(getIsolate(),"test").ToLocalChecked()); |
| 1617 | 1618 | if (v8::Script::Compile(getContext(), v8::String::NewFromUtf8(getIsolate(), "print(\"hello world\");").ToLocalChecked(), &scriptOrigin).ToLocal(&script)) { |
| 1618 | − qCDebug(scriptengine) << "Compile test successful"; | |
| 1619 | + qCDebug(scriptengine_v8) << "Compile test successful"; | |
| 1619 | 1620 | } else { |
| 1620 | − qCDebug(scriptengine) << "Compile test failed"; | |
| 1621 | + qCDebug(scriptengine_v8) << "Compile test failed"; | |
| 1621 | 1622 | Q_ASSERT(false); |
| 1622 | 1623 | } |
| 1623 | 1624 | } |
| @@ -1683,9 +1684,9 @@ QString ScriptEngineV8::scriptValueDebugDetailsV8(const V8ScriptValue &v8Value) · 59 unmodified lines | ||
| 1683 | 1684 | |
| 1684 | 1685 | void ScriptEngineV8::logBacktrace(const QString &title) { |
| 1685 | 1686 | QStringList backtrace = currentContext()->backtrace(); |
| 1686 | − qDebug(scriptengine) << title; | |
| 1687 | + qCDebug(scriptengine_v8) << title; | |
| 1687 | 1688 | for (int n = 0; n < backtrace.length(); n++) { |
| 1688 | − qDebug(scriptengine) << backtrace[n]; | |
| 1689 | + qCDebug(scriptengine_v8) << backtrace[n]; | |
| 1689 | 1690 | } |
| 1690 | 1691 | } |
| 1691 | 1692 | |