| 129 | } |
| 130 | |
| 131 | Runtime::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 | |
| 152 | Runtime* Runtime::GetRuntime(int runtimeId) { |
| 153 | auto itFound = s_id2RuntimeCache.find(runtimeId); |
nothing calls this directly
no test coverage detected