Skip to content

Commit

Permalink
fix(android): recordNativeInitEndTime after initJSBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 committed Nov 4, 2024
1 parent a84fda7 commit 82eaecf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ void notifyEngineInitialized(final EngineInitStatus statusCode, final Throwable
}

private void onEngineInitialized(EngineInitStatus statusCode, Throwable error) {
mEngineContext.getJsDriver().recordNativeInitEndTime(mInitStartTime, System.currentTimeMillis());
mGlobalConfigs.getEngineMonitorAdapter().onEngineInitialized(statusCode);
for (EngineListener listener : mEventListeners) {
listener.onInitialized(statusCode, error == null ? null : error.toString());
Expand Down Expand Up @@ -879,7 +878,7 @@ public HippyEngineContextImpl(@Nullable DomManager domManager) throws RuntimeExc
mJsDriver = new JsDriver();
mBridgeManager = new HippyBridgeManagerImpl(this, mCoreBundleLoader,
getBridgeType(), enableV8Serialization, mDebugMode,
mServerHost, mGroupId, mThirdPartyAdapter, v8InitParams, mJsDriver);
mServerHost, mGroupId, mThirdPartyAdapter, v8InitParams, mJsDriver, mInitStartTime);
mDomManager = (domManager != null) ? domManager : new DomManager(mGroupId);
mRenderer = createRenderer(RenderConnector.NATIVE_RENDERER);
mDomManager.attachToRenderer(mRenderer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public enum BridgeState {
final boolean mEnableV8Serialization;
ArrayList<String> mLoadedBundleInfo = null;
private final int mGroupId;
private long mInitStartTime = 0;
private final HippyThirdPartyAdapter mThirdPartyAdapter;
private StringBuilder mStringBuilder;
private SafeHeapWriter safeHeapWriter;
Expand All @@ -111,10 +112,11 @@ public enum BridgeState {
public HippyBridgeManagerImpl(HippyEngineContext context, HippyBundleLoader coreBundleLoader,
int bridgeType, boolean enableV8Serialization, boolean isDevModule,
String debugServerHost, int groupId, HippyThirdPartyAdapter thirdPartyAdapter,
V8InitParams v8InitParams, @NonNull JsDriver jsDriver) {
V8InitParams v8InitParams, @NonNull JsDriver jsDriver, long initStartTime) {
mContext = context;
mCoreBundleLoader = coreBundleLoader;
mGroupId = groupId;
mInitStartTime = initStartTime;
mThirdPartyAdapter = thirdPartyAdapter;
mEnableV8Serialization = enableV8Serialization;
mHippyBridge = new HippyBridgeImpl(context, this, bridgeType == BRIDGE_TYPE_SINGLE_THREAD,
Expand Down Expand Up @@ -257,6 +259,7 @@ public void Call(long result, Message message, String action,
if (mThirdPartyAdapter != null) {
mThirdPartyAdapter.onRuntimeInit(runtimeId);
}
mContext.getJsDriver().recordNativeInitEndTime(mInitStartTime, System.currentTimeMillis());
if (mCoreBundleLoader != null) {
timeMonitor.addPoint(TimeMonitor.MONITOR_GROUP_INIT_ENGINE,
TimeMonitor.MONITOR_POINT_LOAD_VENDOR_JS);
Expand Down

0 comments on commit 82eaecf

Please sign in to comment.