Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): add BaseEngineContext interface #3800

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,25 @@
import com.tencent.devtools.DevtoolsManager;
import com.tencent.mtt.hippy.HippyEngine.ModuleLoadStatus;
import com.tencent.mtt.hippy.bridge.HippyBridgeManager;
import com.tencent.mtt.hippy.common.BaseEngineContext;
import com.tencent.mtt.hippy.common.HippyMap;
import com.tencent.mtt.hippy.common.ThreadExecutor;
import com.tencent.mtt.hippy.devsupport.DevSupportManager;
import com.tencent.mtt.hippy.modules.HippyModuleManager;
import com.tencent.mtt.hippy.utils.TimeMonitor;
import com.tencent.vfs.VfsManager;
import java.util.HashMap;

public interface HippyEngineContext {
public interface HippyEngineContext extends BaseEngineContext {

String getComponentName();

@Nullable
HashMap<String, Object> getNativeParams();

@Nullable
HippyMap getJsParams();

@NonNull
VfsManager getVfsManager();

Expand Down Expand Up @@ -73,8 +78,6 @@ public interface HippyEngineContext {

void handleException(Throwable throwable);

int getEngineId();

int getDomManagerId();

int getVfsId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,12 @@ public HashMap<String, Object> getNativeParams() {
return mNativeParams;
}

@Override
@Nullable
public HippyMap getJsParams() {
return moduleLoadParams != null ? moduleLoadParams.jsParams : null;
}

@Override
public HippyGlobalConfigs getGlobalConfigs() {
return mGlobalConfigs;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Tencent is pleased to support the open source community by making Hippy available.
* Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.tencent.mtt.hippy.common;

public interface BaseEngineContext {

int getEngineId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.mtt.hippy.common.BaseEngineContext;
import com.tencent.mtt.hippy.common.LogAdapter;
import com.tencent.renderer.component.image.ImageDecoderAdapter;
import com.tencent.renderer.component.text.FontAdapter;
Expand Down Expand Up @@ -47,6 +48,9 @@ public interface FrameworkProxy {
@Nullable
String getBundlePath();

@NonNull
BaseEngineContext getEngineContext();

int getEngineId();

void onFirstPaint();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import androidx.annotation.Nullable;

import com.tencent.mtt.hippy.HippyInstanceLifecycleEventListener;
import com.tencent.mtt.hippy.common.BaseEngineContext;
import com.tencent.mtt.hippy.uimanager.RenderManager;

import com.tencent.renderer.component.image.ImageDecoderAdapter;
Expand Down Expand Up @@ -63,6 +64,9 @@ public interface NativeRender extends RenderExceptionHandler, RenderLogHandler {
@Nullable
Executor getBackgroundExecutor();

@Nullable
BaseEngineContext getEngineContext();

int getEngineId();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.tencent.mtt.hippy.common.BaseEngineContext;
import com.tencent.mtt.hippy.common.Callback;
import com.tencent.mtt.hippy.common.LogAdapter;
import com.tencent.mtt.hippy.serialization.nio.reader.BinaryReader;
Expand Down Expand Up @@ -280,12 +281,15 @@ public void onReceiveRenderLogMessage(int level, @NonNull String tag, @NonNull S
}
}

@Override
@Nullable
public BaseEngineContext getEngineContext() {
return (mFrameworkProxy != null) ? mFrameworkProxy.getEngineContext() : null;
}

@Override
public int getEngineId() {
if (mFrameworkProxy != null) {
return mFrameworkProxy.getEngineId();
}
return -1;
return (mFrameworkProxy != null) ? mFrameworkProxy.getEngineId() : -1;
}

@Override
Expand Down
Loading