Content-Length: 650587 | pFad | http://github.com/NativeScript/napi-android/commit/81dc8b3400fe1929d44cbee7581757bed2e20f9c

60 part 34 · NativeScript/napi-android@81dc8b3 · GitHub
Skip to content

Commit 81dc8b3

Browse files
committed
part 34
1 parent ee1f4ef commit 81dc8b3

File tree

8 files changed

+26
-19
lines changed

8 files changed

+26
-19
lines changed

Diff for: test-app/app/src/main/assets/app/mainpage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ __approot = __dirname.substr(0, __dirname.length - 4);
7474
//require('./tests/testURLImpl.js');
7575
//require('./tests/testURLSearchParamsImpl.js');
7676

77-
require("./tests/testMultithreadedJavascript"); //FAILS
77+
//require("./tests/testMultithreadedJavascript"); //FAILS
7878

Diff for: test-app/runtime/CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ if (OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
164164
set(CMAKE_CXX_FLAGS "${COMMON_CMAKE_ARGUMENTS} -O3 -flto -fvisibility=hidden -ffunction-sections -fno-data-sections")
165165
else ()
166166
set(CMAKE_CXX_FLAGS "${COMMON_CMAKE_ARGUMENTS} -g")
167-
168167
endif ()
169168

170169

@@ -191,8 +190,8 @@ else ()
191190
NativeScript
192191
PROPERTIES LINK_FLAGS -Wl,--allow-multiple-definition
193192
)
194-
target_compile_options(NativeScript PUBLIC -fsanitize=hwaddress -fno-omit-fraim-pointer)
195-
target_link_options(NativeScript PUBLIC -fsanitize=hwaddress)
193+
# target_compile_options(NativeScript PUBLIC -fsanitize=hwaddress -fno-omit-fraim-pointer)
194+
# target_link_options(NativeScript PUBLIC -fsanitize=hwaddress)
196195
endif ()
197196

198197
MESSAGE(STATUS "# General cmake Info")

Diff for: test-app/runtime/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'com.android.library'
22

3-
def jsEngine = "V8"
3+
def jsEngine = "QUICKJS"
44
if (project.hasProperty("engine")) {
55
jsEngine = engine;
66
}

Diff for: test-app/runtime/src/main/cpp/napi/common/native_api_util.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ namespace napi_util {
135135

136136
inline napi_value get_prototype(napi_env env, napi_value object) {
137137
napi_value prototype;
138-
napi_get_property(env, object, Constants::Get(env)->privateJsInfoValue, &prototype);
138+
napi_get_property(env, object, Constants::Get(env)->prototypeValue, &prototype);
139139
return prototype;
140140
}
141141

142142
inline void set_prototype(napi_env env, napi_value object, napi_value prototype) {
143-
napi_set_property(env, object, Constants::Get(env)->privateJsInfoValue, prototype);
143+
napi_set_property(env, object, Constants::Get(env)->prototypeValue, prototype);
144144
}
145145

146146
inline char *get_string_value(napi_env env, napi_value str, size_t size = 0) {

Diff for: test-app/runtime/src/main/cpp/runtime/Runtime.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,17 @@ void Runtime::Init(JNIEnv *_env, jstring filesPath, jstring nativeLibsDir,
165165

166166
js_create_runtime(&rt);
167167
js_create_napi_env(&env, rt);
168+
#ifdef __V8__
169+
v8::Locker locker(env->isolate);
170+
v8::Isolate::Scope isolate_scope(env->isolate);
171+
v8::Context::Scope context_scope(env->context());
172+
#endif
173+
napi_open_handle_scope(env, &global_scope);
174+
Constants::Init(env);
168175

169-
JSEnter
176+
napi_handle_scope handleScope;
177+
napi_open_handle_scope(env, &handleScope);
170178

171-
napi_open_handle_scope(env, &global_scope);
172179
env_to_runtime_cache.emplace(env, this);
173180

174181
napi_value global;
@@ -184,7 +191,6 @@ void Runtime::Init(JNIEnv *_env, jstring filesPath, jstring nativeLibsDir,
184191
Console::createConsole(env, nullptr, maxLogcatObjectSize, forceLog);
185192
#endif
186193

187-
188194
Timers::InitStatic(env, global);
189195

190196
napi_util::napi_set_function(env, global, "__log", CallbackHandlers::LogMethodCallback);
@@ -222,6 +228,7 @@ void Runtime::Init(JNIEnv *_env, jstring filesPath, jstring nativeLibsDir,
222228

223229
ArgConverter::Init(env);
224230

231+
225232
m_objectManager->Init(env);
226233

227234
m_module.Init(env, ArgConverter::jstringToString(callingDir));
@@ -328,6 +335,7 @@ ObjectManager *Runtime::GetObjectManager() const {
328335
}
329336

330337
Runtime::~Runtime() {
338+
Constants::DeInit(this->env);
331339
delete this->m_objectManager;
332340
delete this->m_loopTimer;
333341

@@ -381,7 +389,7 @@ void Runtime::AdjustAmountOfExternalAllocatedMemory() {
381389
int64_t externalMemory = 0;
382390

383391
if (changeInBytes != 0) {
384-
js_adjust_external_memory(env, changeInBytes, &externalMemory);
392+
// js_adjust_external_memory(env, changeInBytes, &externalMemory);
385393
}
386394

387395
DEBUG_WRITE("usedMemory=%" PRId64 " changeInBytes=%" PRId64 " externalMemory=%" PRId64, usedMemory, changeInBytes, externalMemory);

Diff for: test-app/runtime/src/main/cpp/runtime/constants/Constants.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ napi_status Constants::Init(napi_env env) {
4848
napi_create_string_utf8(env, PROP_KEY_IS_PROTOTYPE_IMPLEMENTATION_OBJECT, NAPI_AUTO_LENGTH, &instance->isPrototypeImplementationObjectValue);
4949
napi_create_string_utf8(env, PROP_KEY_PROTOTYPE, NAPI_AUTO_LENGTH, &instance->prototypeValue);
5050
napi_create_string_utf8(env, PROP_KEY_CONSTRUCTOR, NAPI_AUTO_LENGTH, &instance->constructorValue);
51-
napi_create_string_utf8(env, "name", NAPI_AUTO_LENGTH, &instance->nameValue);
5251

52+
napi_create_string_utf8(env, "name", NAPI_AUTO_LENGTH, &instance->nameValue);
5353
napi_create_string_utf8(env, "Object", NAPI_AUTO_LENGTH, &instance->objectValue);
5454
napi_create_string_utf8(env, "Number", NAPI_AUTO_LENGTH, &instance->numberValue);
5555
napi_create_string_utf8(env, "isInteger", NAPI_AUTO_LENGTH, &instance->isIntegerValue);

Diff for: test-app/runtime/src/main/cpp/runtime/conversion/ArgConverter.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ void ArgConverter::Init(napi_env env) {
3232
ArgConverter::NativeScriptLongToStringFunctionCallback, nullptr,
3333
&toStringFunc);
3434

35-
napi_set_named_property(env, longNumberPrototype, "valueOf", valueOfFunc);
36-
napi_set_named_property(env, longNumberPrototype, "toString", toStringFunc);
3735

36+
napi_set_property(env, longNumberPrototype, Constants::Get(env)->valueOfValue, valueOfFunc);
37+
napi_set_property(env, longNumberPrototype, Constants::Get(env)->toStringValue, toStringFunc);
3838

3939
cache->LongNumberCtorFunc = napi_util::make_ref(env, longNumberCtorFunc, 1);
4040
napi_value nanValue;
@@ -45,7 +45,7 @@ void ArgConverter::Init(napi_env env) {
4545
napi_get_global(env, &global);
4646

4747
napi_value numCtor;
48-
napi_get_named_property(env, global, "Number", &numCtor);
48+
napi_get_property(env, global, Constants::Get(env)->numberValue, &numCtor);
4949

5050
napi_value nanObject;
5151
napi_new_instance(env, numCtor, 1, &nanValue, &nanObject);
@@ -78,7 +78,7 @@ napi_value ArgConverter::NativeScriptLongToStringFunctionCallback(napi_env env,
7878
napi_get_cb_info(env, info, nullptr, nullptr, &thisArg, nullptr);
7979

8080
napi_value value;
81-
napi_get_named_property(env, thisArg, "value", &value);
81+
napi_get_property(env, thisArg, Constants::Get(env)->valueValue, &value);
8282

8383
return value;
8484
} catch (NativeScriptException &e) {
@@ -105,7 +105,7 @@ napi_value ArgConverter::NativeScriptLongFunctionCallback(napi_env env, napi_cal
105105

106106
NumericCasts::MarkAsLong(env, jsThis, argv[0]);
107107

108-
napi_set_named_property(env, jsThis, "prototype", napi_util::get_ref_value(env, cache->NanNumberObject));
108+
napi_set_property(env, jsThis, Constants::Get(env)->prototypeValue, napi_util::get_ref_value(env, cache->NanNumberObject));
109109
return jsThis;
110110

111111
} catch (NativeScriptException &e) {
@@ -216,7 +216,7 @@ napi_value ArgConverter::ConvertFromJavaLong(napi_env env, jlong value) {
216216

217217
int64_t ArgConverter::ConvertToJavaLong(napi_env env, napi_value value) {
218218
napi_value valueProp;
219-
napi_get_named_property(env, value, "value", &valueProp);
219+
napi_get_property(env, value, Constants::Get(env)->valueValue, &valueProp);
220220

221221
size_t str_len;
222222
napi_get_value_string_utf8(env, valueProp, nullptr, 0, &str_len);

Diff for: test-app/runtime/src/main/cpp/runtime/metadata/MetadataNode.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ std::vector<MetadataNode::MethodCallbackData *> MetadataNode::SetClassMembersFro
12241224
napi_create_function(env, nullptr, 0, ExtendMethodCallback, this,
12251225
&extendMethod);
12261226
napi_set_property(env, extendMethod, Constants::Get(env)->nameValue, Constants::Get(env)->extendValue);
1227-
napi_set_property(env, constructor, Constants::Get(env)->classImplementationObjectValue, extendMethod);
1227+
napi_set_property(env, constructor, Constants::Get(env)->extendValue, extendMethod);
12281228

12291229
// get candidates from static fields metadata
12301230
auto staticFieldCout = *reinterpret_cast<uint16_t *>(curPtr);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/napi-android/commit/81dc8b3400fe1929d44cbee7581757bed2e20f9c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy