MCPcopy Create free account
hub / github.com/NativeScript/android / Runtime

Method Runtime

test-app/runtime/src/main/cpp/Runtime.cpp:131–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131Runtime::Runtime(JNIEnv* env, jobject runtime, int id)
132 : m_id(id),
133 m_isolate(nullptr),
134 m_lastUsedMemory(0),
135 m_gcFunc(nullptr),
136 m_runGC(false) {
137 m_runtime = env->NewGlobalRef(runtime);
138 m_objectManager = new ObjectManager(m_runtime);
139 m_loopTimer = new MessageLoopTimer();
140 s_id2RuntimeCache.emplace(id, this);
141
142 if (GET_USED_MEMORY_METHOD_ID == nullptr) {
143 auto RUNTIME_CLASS = env->FindClass("com/tns/Runtime");
144 assert(RUNTIME_CLASS != nullptr);
145
146 GET_USED_MEMORY_METHOD_ID =
147 env->GetMethodID(RUNTIME_CLASS, "getUsedMemory", "()J");
148 assert(GET_USED_MEMORY_METHOD_ID != nullptr);
149 }
150}
151
152Runtime* Runtime::GetRuntime(int runtimeId) {
153 auto itFound = s_id2RuntimeCache.find(runtimeId);

Callers

nothing calls this directly

Calls 4

NewGlobalRefMethod · 0.80
emplaceMethod · 0.80
GetMethodIDMethod · 0.80
FindClassMethod · 0.45

Tested by

no test coverage detected