History

fix implicit this

RTUnreal committed 1 year ago

Commit 86c5f2c1 parent 611faa942 files · +134 −135Browse files

Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 42 files). Show all

Unified · Split

libraries/script-engine/src/AssetScriptingInterface.cpp+8−8
@@ -76,7 +76,7 @@ void AssetScriptingInterface::uploadData(QString data, const ScriptValue& callba · 75 unmodified lines
76 Promise deferred = makePromise(__FUNCTION__);76 Promise deferred = makePromise(__FUNCTION__);
77 Q_ASSERT(engine());77 Q_ASSERT(engine());
78 auto scriptEngine = engine();78 auto scriptEngine = engine();
79 deferred->ready([=](QString error, QVariantMap result) {79 deferred->ready([=, this](QString error, QVariantMap result) {
80 auto url = result.value("url").toString();80 auto url = result.value("url").toString();
81 auto hash = result.value("hash").toString();81 auto hash = result.value("hash").toString();
82 jsCallback(handler, scriptEngine->newValue(url), scriptEngine->newValue(hash));82 jsCallback(handler, scriptEngine->newValue(url), scriptEngine->newValue(hash));
@@ -100,7 +100,7 @@ void AssetScriptingInterface::setMapping(QString path, QString hash, const Scrip · 17 unmodified lines
100 Promise deferred = makePromise(__FUNCTION__);100 Promise deferred = makePromise(__FUNCTION__);
101 Q_ASSERT(engine());101 Q_ASSERT(engine());
102 auto scriptEngine = engine();102 auto scriptEngine = engine();
103 deferred->ready([=](QString error, QVariantMap result) {103 deferred->ready([=, this](QString error, QVariantMap result) {
104 jsCallback(handler, scriptEngine->newValue(error), result);104 jsCallback(handler, scriptEngine->newValue(error), result);
105 });105 });
106 106
@@ -138,7 +138,7 @@ void AssetScriptingInterface::downloadData(QString urlString, const ScriptValue& · 31 unmodified lines
138 Promise deferred = makePromise(__FUNCTION__);138 Promise deferred = makePromise(__FUNCTION__);
139 Q_ASSERT(engine());139 Q_ASSERT(engine());
140 auto scriptEngine = engine();140 auto scriptEngine = engine();
141 deferred->ready([=](QString error, QVariantMap result) {141 deferred->ready([=, this](QString error, QVariantMap result) {
142 // FIXME: to remain backwards-compatible the signature here is "callback(data, n/a)"142 // FIXME: to remain backwards-compatible the signature here is "callback(data, n/a)"
143 jsCallback(handler, scriptEngine->newValue(result.value("data").toString()), { { "errorMessage", error } });143 jsCallback(handler, scriptEngine->newValue(result.value("data").toString()), { { "errorMessage", error } });
144 });144 });
@@ -202,7 +202,7 @@ void AssetScriptingInterface::getMapping(QString asset, const ScriptValue& callb · 57 unmodified lines
202 Promise promise = getAssetInfo(path);202 Promise promise = getAssetInfo(path);
203 Q_ASSERT(engine());203 Q_ASSERT(engine());
204 auto scriptEngine = engine();204 auto scriptEngine = engine();
205 promise->ready([=](QString error, QVariantMap result) {205 promise->ready([=, this](QString error, QVariantMap result) {
206 jsCallback(handler, scriptEngine->newValue(error), scriptEngine->newValue(result.value("hash").toString()));206 jsCallback(handler, scriptEngine->newValue(error), scriptEngine->newValue(result.value("hash").toString()));
207 });207 });
208}208}
@@ -317,7 +317,7 @@ void AssetScriptingInterface::getAsset(const ScriptValue& options, const ScriptV · 108 unmodified lines
317 317
318 Promise mapped = makePromise("mapped");318 Promise mapped = makePromise("mapped");
319 mapped->fail(fetched);319 mapped->fail(fetched);
320 mapped->then([=](QVariantMap result) {320 mapped->then([=, this](QVariantMap result) {
321 QString hash = result.value("hash").toString();321 QString hash = result.value("hash").toString();
322 QString url = result.value("url").toString();322 QString url = result.value("url").toString();
323 if (!AssetUtils::isValidHash(hash)) {323 if (!AssetUtils::isValidHash(hash)) {
@@ -397,7 +397,7 @@ void AssetScriptingInterface::decompressData(const ScriptValue& options, const S · 73 unmodified lines
397 if (responseType == "arraybuffer") {397 if (responseType == "arraybuffer") {
398 decompressed->ready(completed);398 decompressed->ready(completed);
399 } else {399 } else {
400 decompressed->ready([=](QString error, QVariantMap result) {400 decompressed->ready([=, this](QString error, QVariantMap result) {
401 Promise converted = convertBytes(result.value("data").toByteArray(), responseType);401 Promise converted = convertBytes(result.value("data").toByteArray(), responseType);
402 converted->mixin(result);402 converted->mixin(result);
403 converted->ready(completed);403 converted->ready(completed);
@@ -482,7 +482,7 @@ void AssetScriptingInterface::putAsset(const ScriptValue& options, const ScriptV · 78 unmodified lines
482 }482 }
483 483
484 prepared->fail(completed);484 prepared->fail(completed);
485 prepared->then([=](QVariantMap result) {485 prepared->then([=, this](QVariantMap result) {
486 Promise upload = uploadBytes(result.value("data").toByteArray());486 Promise upload = uploadBytes(result.value("data").toByteArray());
487 upload->mixin(result);487 upload->mixin(result);
488 upload->ready(uploaded);488 upload->ready(uploaded);
@@ -492,7 +492,7 @@ void AssetScriptingInterface::putAsset(const ScriptValue& options, const ScriptV · 3 unmodified lines
492 if (path.isEmpty()) {492 if (path.isEmpty()) {
493 uploaded->then(completed);493 uploaded->then(completed);
494 } else {494 } else {
495 uploaded->then([=](QVariantMap result) {495 uploaded->then([=, this](QVariantMap result) {
496 QString hash = result.value("hash").toString();496 QString hash = result.value("hash").toString();
497 if (!AssetUtils::isValidHash(hash)) {497 if (!AssetUtils::isValidHash(hash)) {
498 completed->reject("path mapping requested, but did not receive valid hash", result);498 completed->reject("path mapping requested, but did not receive valid hash", result);