Skip to content

Commit

Permalink
[TIMOB-23901] Android: Fix KrollRuntime init on main thread (#8426)
Browse files Browse the repository at this point in the history
* [TIMOB-23901] Fix KrollRuntime init on main thread

* [TIMOB-23901] Fix IdleNotificationDeadline() duration in nativeIdle()
  • Loading branch information
Gary Mathews authored and sgtcoolguy committed Sep 30, 2016
1 parent adba30b commit f78f8cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,12 @@ private static void syncInit()
synchronized (runtimeState) {
if (runtimeState == State.DISPOSED) {
instance.initLatch = new CountDownLatch(1);
instance.handler.sendEmptyMessage(MSG_INIT);

if (instance.isRuntimeThread()) {
instance.doInit();
} else {
instance.handler.sendEmptyMessage(MSG_INIT);
}

} else if (runtimeState == State.RELEASED) {
runtimeState = State.RELAUNCHED;
Expand Down
4 changes: 2 additions & 2 deletions android/runtime/v8/src/native/V8Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ JNIEXPORT jboolean JNICALL Java_org_appcelerator_kroll_runtime_v8_V8Runtime_nati
//}

// FIXME What is a good value to use here? We're basically giving it 100 ms to run right now
double deadline_in_ms = (V8Runtime::platform->MonotonicallyIncreasingTime() * static_cast<double>(1000)) + 100.0;
return V8Runtime::v8_isolate->IdleNotificationDeadline(deadline_in_ms);
double deadline_in_s = V8Runtime::platform->MonotonicallyIncreasingTime() + 0.1;
return V8Runtime::v8_isolate->IdleNotificationDeadline(deadline_in_s);
}

/*
Expand Down

0 comments on commit f78f8cc

Please sign in to comment.