History

update code to support libnode24

RTUnreal committed 3 months ago

Commit f8fb2101 parent 26a7de46 files · +29 −22Browse files

Showing the changes to libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp (1 of 6 files). Show all

Unified · Split

libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp+17−12
@@ -13,6 +13,7 @@ · 12 unmodified lines
13//13//
14 14
15#include "ScriptObjectV8Proxy.h"15#include "ScriptObjectV8Proxy.h"
16#include <v8-template.h>
16 17
17#include <QElapsedTimer>18#include <QElapsedTimer>
18#include <QtCore/QList>19#include <QtCore/QList>
@@ -490,14 +491,14 @@ ScriptValue::PropertyFlags ScriptObjectV8Proxy::propertyFlags(const V8ScriptValu · 471 unmodified lines
490 return ScriptValue::PropertyFlags();491 return ScriptValue::PropertyFlags();
491}492}
492 493
493void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {494v8::Intercepted ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
494 v8::HandleScope handleScope(info.GetIsolate());495 v8::HandleScope handleScope(info.GetIsolate());
495 v8::String::Utf8Value utf8Value(info.GetIsolate(), name);496 v8::String::Utf8Value utf8Value(info.GetIsolate(), name);
496 v8::Local<v8::Value> objectV8 = info.This();497 v8::Local<v8::Value> objectV8 = info.This();
497 ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);498 ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);
498 if (!proxy) {499 if (!proxy) {
499 qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Value;500 qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Value;
500 return;501 return v8::Intercepted::kYes;
501 }502 }
502 V8ScriptValue object(proxy->_engine, objectV8);503 V8ScriptValue object(proxy->_engine, objectV8);
503 if (!name->IsString() && !name->IsSymbol()) {504 if (!name->IsString() && !name->IsSymbol()) {
@@ -516,7 +517,7 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall · 12 unmodified lines
516 if (flags) {517 if (flags) {
517 V8ScriptValue value = proxy->property(object, nameString, id);518 V8ScriptValue value = proxy->property(object, nameString, id);
518 info.GetReturnValue().Set(value.get());519 info.GetReturnValue().Set(value.get());
519 return;520 return v8::Intercepted::kYes;
520 }521 }
521 }522 }
522 523
@@ -526,16 +527,17 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall · 3 unmodified lines
526 } else {527 } else {
527 qCDebug(scriptengine_v8) << "Value not found: " << *utf8Value;528 qCDebug(scriptengine_v8) << "Value not found: " << *utf8Value;
528 }529 }
530 return v8::Intercepted::kYes;
529}531}
530 532
531void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {533v8::Intercepted ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) {
532 v8::HandleScope handleScope(info.GetIsolate());534 v8::HandleScope handleScope(info.GetIsolate());
533 v8::String::Utf8Value utf8Value(info.GetIsolate(), name);535 v8::String::Utf8Value utf8Value(info.GetIsolate(), name);
534 v8::Local<v8::Value> objectV8 = info.This();536 v8::Local<v8::Value> objectV8 = info.This();
535 ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);537 ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);
536 if (!proxy) {538 if (!proxy) {
537 qCDebug(scriptengine_v8) << "Proxy object not found when setting: " << *utf8Value;539 qCDebug(scriptengine_v8) << "Proxy object not found when setting: " << *utf8Value;
538 return;540 return v8::Intercepted::kYes;
539 }541 }
540 V8ScriptValue object(proxy->_engine, objectV8);542 V8ScriptValue object(proxy->_engine, objectV8);
541 if (!name->IsString() && !name->IsSymbol()) {543 if (!name->IsString() && !name->IsSymbol()) {
@@ -553,7 +555,7 @@ void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> v · 11 unmodified lines
553 if (flags) {555 if (flags) {
554 proxy->setProperty(object, nameString, id, V8ScriptValue(proxy->_engine, value));556 proxy->setProperty(object, nameString, id, V8ScriptValue(proxy->_engine, value));
555 info.GetReturnValue().Set(value);557 info.GetReturnValue().Set(value);
556 return;558 return v8::Intercepted::kYes;
557 }559 }
558 }560 }
559 561
@@ -562,6 +564,7 @@ void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> v · 2 unmodified lines
562 } else {564 } else {
563 qCDebug(scriptengine_v8) << "Set failed: " << *utf8Value;565 qCDebug(scriptengine_v8) << "Set failed: " << *utf8Value;
564 }566 }
567 return v8::Intercepted::kYes;
565}568}
566 569
567void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) {570void ScriptObjectV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) {
@@ -832,14 +835,14 @@ QVariant* ScriptVariantV8Proxy::unwrapQVariantPointer(v8::Isolate* isolate, cons · 264 unmodified lines
832}835}
833 836
834 837
835void ScriptVariantV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {838v8::Intercepted ScriptVariantV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
836 v8::HandleScope handleScope(info.GetIsolate());839 v8::HandleScope handleScope(info.GetIsolate());
837 v8::String::Utf8Value utf8Name(info.GetIsolate(), name);840 v8::String::Utf8Value utf8Name(info.GetIsolate(), name);
838 v8::Local<v8::Value> objectV8 = info.This();841 v8::Local<v8::Value> objectV8 = info.This();
839 ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);842 ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);
840 if (!proxy) {843 if (!proxy) {
841 qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Name;844 qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Name;
842 return;845 return v8::Intercepted::kYes;
843 }846 }
844 V8ScriptValue object(proxy->_engine, proxy->_v8Object.Get(info.GetIsolate()));847 V8ScriptValue object(proxy->_engine, proxy->_v8Object.Get(info.GetIsolate()));
845 848
@@ -852,21 +855,22 @@ void ScriptVariantV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCal · 6 unmodified lines
852 if (flags) {855 if (flags) {
853 V8ScriptValue value = proxy->property(object, nameString, id);856 V8ScriptValue value = proxy->property(object, nameString, id);
854 info.GetReturnValue().Set(value.get());857 info.GetReturnValue().Set(value.get());
855 return;858 return v8::Intercepted::kYes;
856 }859 }
857 }860 }
858 861
859 qCDebug(scriptengine_v8) << "Value not found: " << *utf8Name;862 qCDebug(scriptengine_v8) << "Value not found: " << *utf8Name;
863 return v8::Intercepted::kYes;
860}864}
861 865
862void ScriptVariantV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {866v8::Intercepted ScriptVariantV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) {
863 v8::HandleScope handleScope(info.GetIsolate());867 v8::HandleScope handleScope(info.GetIsolate());
864 v8::String::Utf8Value utf8Name(info.GetIsolate(), name);868 v8::String::Utf8Value utf8Name(info.GetIsolate(), name);
865 v8::Local<v8::Value> objectV8 = info.This();869 v8::Local<v8::Value> objectV8 = info.This();
866 ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);870 ScriptVariantV8Proxy *proxy = ScriptVariantV8Proxy::unwrapProxy(info.GetIsolate(), objectV8);
867 if (!proxy) {871 if (!proxy) {
868 qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Name;872 qCDebug(scriptengine_v8) << "Proxy object not found when getting: " << *utf8Name;
869 return;873 return v8::Intercepted::kYes;
870 }874 }
871 875
872 V8ScriptValue object(proxy->_engine, objectV8);876 V8ScriptValue object(proxy->_engine, objectV8);
@@ -884,10 +888,11 @@ void ScriptVariantV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> · 11 unmodified lines
884 if (flags) {888 if (flags) {
885 proxy->setProperty(object, nameString, id, V8ScriptValue(proxy->_engine, value));889 proxy->setProperty(object, nameString, id, V8ScriptValue(proxy->_engine, value));
886 info.GetReturnValue().Set(value);890 info.GetReturnValue().Set(value);
887 return;891 return v8::Intercepted::kYes;
888 }892 }
889 }893 }
890 qCDebug(scriptengine_v8) << "Set failed: " << *utf8Name;894 qCDebug(scriptengine_v8) << "Set failed: " << *utf8Name;
895 return v8::Intercepted::kYes;
891}896}
892 897
893void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) {898void ScriptVariantV8Proxy::v8GetPropertyNames(const v8::PropertyCallbackInfo<v8::Array>& info) {