diff --git a/tools/minibrowser/src/main/java/org/wpewebkit/tools/minibrowser/MainActivity.kt b/tools/minibrowser/src/main/java/org/wpewebkit/tools/minibrowser/MainActivity.kt index 142a970d7..884e09b70 100644 --- a/tools/minibrowser/src/main/java/org/wpewebkit/tools/minibrowser/MainActivity.kt +++ b/tools/minibrowser/src/main/java/org/wpewebkit/tools/minibrowser/MainActivity.kt @@ -28,12 +28,13 @@ import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity import androidx.navigation.fragment.NavHostFragment -import org.wpewebkit.tools.minibrowser.R import org.wpewebkit.tools.minibrowser.databinding.ActivityMainBinding class MainActivity : AppCompatActivity(R.layout.activity_main) { + private val TAG = "MiniBrowser" + private val navHost by lazy { supportFragmentManager.primaryNavigationFragment as NavHostFragment } @@ -42,12 +43,12 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - Log.d("Browser", "onCreate") + Log.d(TAG, "onCreate") binding = ActivityMainBinding.inflate(layoutInflater) } override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) - Log.d("Browser", "onConfigurationChanged") + Log.d(TAG, "onConfigurationChanged") } } diff --git a/tools/webdriver/src/main/java/org/wpewebkit/tools/webdriver/WebDriverActivity.kt b/tools/webdriver/src/main/java/org/wpewebkit/tools/webdriver/WebDriverActivity.kt index 515c549de..8a44e28b4 100644 --- a/tools/webdriver/src/main/java/org/wpewebkit/tools/webdriver/WebDriverActivity.kt +++ b/tools/webdriver/src/main/java/org/wpewebkit/tools/webdriver/WebDriverActivity.kt @@ -27,7 +27,7 @@ import android.os.ParcelFileDescriptor import android.util.Log import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import org.wpewebkit.wpe.ProcessType +import org.wpewebkit.wpe.WKProcessType import org.wpewebkit.wpe.services.WPEServiceConnection import org.wpewebkit.wpe.services.WPEServiceConnectionListener import org.wpewebkit.wpeview.WPEChromeClient @@ -109,7 +109,7 @@ class WebDriverActivity : AppCompatActivity() { } try { - val processType = ProcessType.WebDriverProcess + val processType = WKProcessType.WebDriverProcess val serviceClass = Class.forName("org.wpewebkit.wpe.services." + processType.name + "Service") val parcelFd = ParcelFileDescriptor.fromFd(0) diff --git a/wpe/src/main/cpp/CMakeLists.txt b/wpe/src/main/cpp/CMakeLists.txt index a98091b41..ea71cab95 100644 --- a/wpe/src/main/cpp/CMakeLists.txt +++ b/wpe/src/main/cpp/CMakeLists.txt @@ -104,21 +104,21 @@ target_link_libraries(WPEAndroidCommon ${android-lib} ${log-lib} ${sync-lib}) # libWPEAndroidBrowser add_library( WPEAndroidBrowser SHARED - Browser/Browser.cpp - Browser/EntryPoint.cpp - Browser/Fence.cpp - Browser/InputMethodContext.cpp - Browser/LooperThread.cpp - Browser/MessagePump.cpp - Browser/WKWebView.cpp - Browser/WKSettings.cpp - Browser/RendererSurfaceControl.cpp - Browser/SurfaceControl.cpp - Browser/WKCallback.cpp - Browser/WKCookieManager.cpp - Browser/WKNetworkSession.cpp - Browser/WKWebContext.cpp - Browser/WKWebsiteDataManager.cpp) + Runtime/EntryPoint.cpp + Runtime/Fence.cpp + Runtime/InputMethodContext.cpp + Runtime/LooperThread.cpp + Runtime/MessagePump.cpp + Runtime/RendererSurfaceControl.cpp + Runtime/SurfaceControl.cpp + Runtime/WKCallback.cpp + Runtime/WKCookieManager.cpp + Runtime/WKNetworkSession.cpp + Runtime/WKRuntime.cpp + Runtime/WKWebContext.cpp + Runtime/WKSettings.cpp + Runtime/WKWebsiteDataManager.cpp + Runtime/WKWebView.cpp) target_configure_quality(WPEAndroidBrowser) target_compile_definitions(WPEAndroidBrowser PRIVATE WPE_ENABLE_PROCESS) target_link_libraries( diff --git a/wpe/src/main/cpp/Browser/EntryPoint.cpp b/wpe/src/main/cpp/Runtime/EntryPoint.cpp similarity index 95% rename from wpe/src/main/cpp/Browser/EntryPoint.cpp rename to wpe/src/main/cpp/Runtime/EntryPoint.cpp index 5f6e8d49b..ea2564e28 100644 --- a/wpe/src/main/cpp/Browser/EntryPoint.cpp +++ b/wpe/src/main/cpp/Runtime/EntryPoint.cpp @@ -17,10 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Browser.h" #include "WKCallback.h" #include "WKCookieManager.h" #include "WKNetworkSession.h" +#include "WKRuntime.h" #include "WKSettings.h" #include "WKWebContext.h" #include "WKWebView.h" @@ -31,7 +31,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* javaVM, void* /*reserved*/) try { JNI::initVM(javaVM); - Browser::configureJNIMappings(); + WKRuntime::configureJNIMappings(); WKCallback::configureJNIMappings(); WKCookieManager::configureJNIMappings(); WKNetworkSession::configureJNIMappings(); diff --git a/wpe/src/main/cpp/Browser/Fence.cpp b/wpe/src/main/cpp/Runtime/Fence.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/Fence.cpp rename to wpe/src/main/cpp/Runtime/Fence.cpp diff --git a/wpe/src/main/cpp/Browser/Fence.h b/wpe/src/main/cpp/Runtime/Fence.h similarity index 100% rename from wpe/src/main/cpp/Browser/Fence.h rename to wpe/src/main/cpp/Runtime/Fence.h diff --git a/wpe/src/main/cpp/Browser/InputMethodContext.cpp b/wpe/src/main/cpp/Runtime/InputMethodContext.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/InputMethodContext.cpp rename to wpe/src/main/cpp/Runtime/InputMethodContext.cpp diff --git a/wpe/src/main/cpp/Browser/InputMethodContext.h b/wpe/src/main/cpp/Runtime/InputMethodContext.h similarity index 100% rename from wpe/src/main/cpp/Browser/InputMethodContext.h rename to wpe/src/main/cpp/Runtime/InputMethodContext.h diff --git a/wpe/src/main/cpp/Browser/LooperThread.cpp b/wpe/src/main/cpp/Runtime/LooperThread.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/LooperThread.cpp rename to wpe/src/main/cpp/Runtime/LooperThread.cpp diff --git a/wpe/src/main/cpp/Browser/LooperThread.h b/wpe/src/main/cpp/Runtime/LooperThread.h similarity index 100% rename from wpe/src/main/cpp/Browser/LooperThread.h rename to wpe/src/main/cpp/Runtime/LooperThread.h diff --git a/wpe/src/main/cpp/Browser/MessagePump.cpp b/wpe/src/main/cpp/Runtime/MessagePump.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/MessagePump.cpp rename to wpe/src/main/cpp/Runtime/MessagePump.cpp diff --git a/wpe/src/main/cpp/Browser/MessagePump.h b/wpe/src/main/cpp/Runtime/MessagePump.h similarity index 100% rename from wpe/src/main/cpp/Browser/MessagePump.h rename to wpe/src/main/cpp/Runtime/MessagePump.h diff --git a/wpe/src/main/cpp/Browser/Renderer.h b/wpe/src/main/cpp/Runtime/Renderer.h similarity index 100% rename from wpe/src/main/cpp/Browser/Renderer.h rename to wpe/src/main/cpp/Runtime/Renderer.h diff --git a/wpe/src/main/cpp/Browser/RendererSurfaceControl.cpp b/wpe/src/main/cpp/Runtime/RendererSurfaceControl.cpp similarity index 99% rename from wpe/src/main/cpp/Browser/RendererSurfaceControl.cpp rename to wpe/src/main/cpp/Runtime/RendererSurfaceControl.cpp index 6694f0e7a..b9291cb2d 100644 --- a/wpe/src/main/cpp/Browser/RendererSurfaceControl.cpp +++ b/wpe/src/main/cpp/Runtime/RendererSurfaceControl.cpp @@ -24,10 +24,10 @@ #include #include -#include "Browser.h" #include "Fence.h" #include "Logging.h" #include "SurfaceControl.h" +#include "WKRuntime.h" RendererSurfaceControl::RendererSurfaceControl(WPEAndroidViewBackend* viewBackend, uint32_t width, uint32_t height) : m_viewBackend(viewBackend) diff --git a/wpe/src/main/cpp/Browser/RendererSurfaceControl.h b/wpe/src/main/cpp/Runtime/RendererSurfaceControl.h similarity index 100% rename from wpe/src/main/cpp/Browser/RendererSurfaceControl.h rename to wpe/src/main/cpp/Runtime/RendererSurfaceControl.h diff --git a/wpe/src/main/cpp/Browser/ScopedFD.h b/wpe/src/main/cpp/Runtime/ScopedFD.h similarity index 100% rename from wpe/src/main/cpp/Browser/ScopedFD.h rename to wpe/src/main/cpp/Runtime/ScopedFD.h diff --git a/wpe/src/main/cpp/Browser/ScopedWPEAndroidBuffer.h b/wpe/src/main/cpp/Runtime/ScopedWPEAndroidBuffer.h similarity index 100% rename from wpe/src/main/cpp/Browser/ScopedWPEAndroidBuffer.h rename to wpe/src/main/cpp/Runtime/ScopedWPEAndroidBuffer.h diff --git a/wpe/src/main/cpp/Browser/SurfaceControl.cpp b/wpe/src/main/cpp/Runtime/SurfaceControl.cpp similarity index 98% rename from wpe/src/main/cpp/Browser/SurfaceControl.cpp rename to wpe/src/main/cpp/Runtime/SurfaceControl.cpp index 521f9b5d1..867a0fff2 100644 --- a/wpe/src/main/cpp/Browser/SurfaceControl.cpp +++ b/wpe/src/main/cpp/Runtime/SurfaceControl.cpp @@ -19,8 +19,8 @@ #include "SurfaceControl.h" -#include "Browser.h" #include "ScopedWPEAndroidBuffer.h" +#include "WKRuntime.h" namespace { @@ -58,7 +58,7 @@ void onTransactionCommitedOnAnyThread(void* context, ASurfaceTransactionStats* / // API documentation states that this callback can be dispatched from any thread. // Let's relay the transaction completion to the UI thread. - Browser::instance().invokeOnUiThread( + WKRuntime::instance().invokeOnUiThread( +[](void* userData) { auto* ackCtx = reinterpret_cast(userData); std::move(ackCtx->m_commitCallback)(); @@ -74,7 +74,7 @@ void onTransactionCompletedOnAnyThread(void* context, ASurfaceTransactionStats* // API documentation states that this callback can be dispatched from any thread. // Let's relay the transaction completion to the UI thread. - Browser::instance().invokeOnUiThread( + WKRuntime::instance().invokeOnUiThread( +[](void* userData) { auto* ackCtx = reinterpret_cast(userData); std::move(ackCtx->m_completeCallback)(std::move(ackCtx->m_stats)); diff --git a/wpe/src/main/cpp/Browser/SurfaceControl.h b/wpe/src/main/cpp/Runtime/SurfaceControl.h similarity index 100% rename from wpe/src/main/cpp/Browser/SurfaceControl.h rename to wpe/src/main/cpp/Runtime/SurfaceControl.h diff --git a/wpe/src/main/cpp/Browser/WKCallback.cpp b/wpe/src/main/cpp/Runtime/WKCallback.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/WKCallback.cpp rename to wpe/src/main/cpp/Runtime/WKCallback.cpp diff --git a/wpe/src/main/cpp/Browser/WKCallback.h b/wpe/src/main/cpp/Runtime/WKCallback.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKCallback.h rename to wpe/src/main/cpp/Runtime/WKCallback.h diff --git a/wpe/src/main/cpp/Browser/WKCookieManager.cpp b/wpe/src/main/cpp/Runtime/WKCookieManager.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/WKCookieManager.cpp rename to wpe/src/main/cpp/Runtime/WKCookieManager.cpp diff --git a/wpe/src/main/cpp/Browser/WKCookieManager.h b/wpe/src/main/cpp/Runtime/WKCookieManager.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKCookieManager.h rename to wpe/src/main/cpp/Runtime/WKCookieManager.h diff --git a/wpe/src/main/cpp/Browser/WKNetworkSession.cpp b/wpe/src/main/cpp/Runtime/WKNetworkSession.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/WKNetworkSession.cpp rename to wpe/src/main/cpp/Runtime/WKNetworkSession.cpp diff --git a/wpe/src/main/cpp/Browser/WKNetworkSession.h b/wpe/src/main/cpp/Runtime/WKNetworkSession.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKNetworkSession.h rename to wpe/src/main/cpp/Runtime/WKNetworkSession.h diff --git a/wpe/src/main/cpp/Browser/Browser.cpp b/wpe/src/main/cpp/Runtime/WKRuntime.cpp similarity index 88% rename from wpe/src/main/cpp/Browser/Browser.cpp rename to wpe/src/main/cpp/Runtime/WKRuntime.cpp index 74dc2e3de..2d60c513c 100644 --- a/wpe/src/main/cpp/Browser/Browser.cpp +++ b/wpe/src/main/cpp/Runtime/WKRuntime.cpp @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Browser.h" +#include "WKRuntime.h" #include "Environment.h" #include "Logging.h" @@ -30,10 +30,10 @@ #include /*********************************************************************************************************************** - * JNI mapping with Java Browser class + * JNI mapping with Java WKRuntime class **********************************************************************************************************************/ -DECLARE_JNI_CLASS_SIGNATURE(JNIBrowser, "org/wpewebkit/wpe/Browser"); +DECLARE_JNI_CLASS_SIGNATURE(JNIBrowser, "org/wpewebkit/wpe/WKRuntime"); class JNIBrowserCache final : public JNI::TypedClass { public: @@ -82,13 +82,13 @@ JNIBrowserCache::JNIBrowserCache() registerNativeMethods(JNI::StaticNativeMethod( "startNativeLooper", +[](JNIEnv* /*env*/, jclass /*klass*/) { - Logging::logDebug("Browser::startNativeLooper() [tid %d]", gettid()); + Logging::logDebug("WKRuntime::startNativeLooper() [tid %d]", gettid()); LooperThread::instance().startLooper(); }), JNI::StaticNativeMethod( "setupNativeEnvironment", +[](JNIEnv* /*env*/, jclass /*klass*/, jstringArray envStringsArray) { - Logging::logDebug("Browser::setupNativeEnvironment() [tid %d]", gettid()); + Logging::logDebug("WKRuntime::setupNativeEnvironment() [tid %d]", gettid()); Logging::pipeStdoutToLogcat(); Environment::configureEnvironment(envStringsArray); }), @@ -97,11 +97,11 @@ JNIBrowserCache::JNIBrowserCache() +[](JNIEnv* env, jobject obj) { getJNIBrowserCache().m_browserJavaInstance = JNI::createTypedProtectedRef(env, reinterpret_cast(obj), true); - Browser::instance().jniInit(); + WKRuntime::instance().jniInit(); }), JNI::NativeMethod( "nativeShut", +[](JNIEnv*, jobject) { - Browser::instance().jniShut(); + WKRuntime::instance().jniShut(); getJNIBrowserCache().m_browserJavaInstance = nullptr; })); } @@ -145,7 +145,7 @@ void wpeTerminateProcess(void* /*backend*/, int64_t pid) } } // namespace -void Browser::configureJNIMappings() +void WKRuntime::configureJNIMappings() { getJNIBrowserCache(); @@ -161,22 +161,22 @@ void Browser::configureJNIMappings() wpe_process_provider_register_interface(&s_processProviderInterface); } -void Browser::jniInit() +void WKRuntime::jniInit() { - Logging::logDebug("Browser::jniInit() [tid %d]", gettid()); + Logging::logDebug("WKRuntime::jniInit() [tid %d]", gettid()); m_messagePump = std::make_unique(); } -void Browser::jniShut() noexcept +void WKRuntime::jniShut() noexcept { try { - Logging::logDebug("Browser::jniShut() [tid %d]", gettid()); + Logging::logDebug("WKRuntime::jniShut() [tid %d]", gettid()); m_messagePump = nullptr; } catch (...) { } } -void Browser::invokeOnUiThread(void (*onExec)(void*), void (*onDestroy)(void*), void* userData) const noexcept +void WKRuntime::invokeOnUiThread(void (*onExec)(void*), void (*onDestroy)(void*), void* userData) const noexcept { m_messagePump->invoke(onExec, onDestroy, userData); } diff --git a/wpe/src/main/cpp/Browser/Browser.h b/wpe/src/main/cpp/Runtime/WKRuntime.h similarity index 80% rename from wpe/src/main/cpp/Browser/Browser.h rename to wpe/src/main/cpp/Runtime/WKRuntime.h index ca02c1089..c01effc79 100644 --- a/wpe/src/main/cpp/Browser/Browser.h +++ b/wpe/src/main/cpp/Runtime/WKRuntime.h @@ -24,27 +24,27 @@ #include "MessagePump.h" -class Browser final { +class WKRuntime final { public: static void configureJNIMappings(); - static Browser& instance() noexcept + static WKRuntime& instance() noexcept { - static Browser s_singleton; + static WKRuntime s_singleton; return s_singleton; } - Browser(Browser&&) = delete; - Browser& operator=(Browser&&) = delete; - Browser(const Browser&) = delete; - Browser& operator=(const Browser&) = delete; + WKRuntime(WKRuntime&&) = delete; + WKRuntime& operator=(WKRuntime&&) = delete; + WKRuntime(const WKRuntime&) = delete; + WKRuntime& operator=(const WKRuntime&) = delete; - ~Browser() { jniShut(); } + ~WKRuntime() { jniShut(); } void invokeOnUiThread(void (*onExec)(void*), void (*onDestroy)(void*), void* userData) const noexcept; private: - Browser() = default; + WKRuntime() = default; friend class JNIBrowserCache; void jniInit(); diff --git a/wpe/src/main/cpp/Browser/WKSettings.cpp b/wpe/src/main/cpp/Runtime/WKSettings.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/WKSettings.cpp rename to wpe/src/main/cpp/Runtime/WKSettings.cpp diff --git a/wpe/src/main/cpp/Browser/WKSettings.h b/wpe/src/main/cpp/Runtime/WKSettings.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKSettings.h rename to wpe/src/main/cpp/Runtime/WKSettings.h diff --git a/wpe/src/main/cpp/Browser/WKWebContext.cpp b/wpe/src/main/cpp/Runtime/WKWebContext.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/WKWebContext.cpp rename to wpe/src/main/cpp/Runtime/WKWebContext.cpp diff --git a/wpe/src/main/cpp/Browser/WKWebContext.h b/wpe/src/main/cpp/Runtime/WKWebContext.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKWebContext.h rename to wpe/src/main/cpp/Runtime/WKWebContext.h diff --git a/wpe/src/main/cpp/Browser/WKWebView.cpp b/wpe/src/main/cpp/Runtime/WKWebView.cpp similarity index 99% rename from wpe/src/main/cpp/Browser/WKWebView.cpp rename to wpe/src/main/cpp/Runtime/WKWebView.cpp index dc4569b65..eacfedd83 100644 --- a/wpe/src/main/cpp/Browser/WKWebView.cpp +++ b/wpe/src/main/cpp/Runtime/WKWebView.cpp @@ -22,10 +22,10 @@ #include "WKWebView.h" -#include "Browser.h" #include "Logging.h" #include "RendererSurfaceControl.h" #include "WKCallback.h" +#include "WKRuntime.h" #include "WKWebContext.h" #include diff --git a/wpe/src/main/cpp/Browser/WKWebView.h b/wpe/src/main/cpp/Runtime/WKWebView.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKWebView.h rename to wpe/src/main/cpp/Runtime/WKWebView.h diff --git a/wpe/src/main/cpp/Browser/WKWebsiteDataManager.cpp b/wpe/src/main/cpp/Runtime/WKWebsiteDataManager.cpp similarity index 100% rename from wpe/src/main/cpp/Browser/WKWebsiteDataManager.cpp rename to wpe/src/main/cpp/Runtime/WKWebsiteDataManager.cpp diff --git a/wpe/src/main/cpp/Browser/WKWebsiteDataManager.h b/wpe/src/main/cpp/Runtime/WKWebsiteDataManager.h similarity index 100% rename from wpe/src/main/cpp/Browser/WKWebsiteDataManager.h rename to wpe/src/main/cpp/Runtime/WKWebsiteDataManager.h diff --git a/wpe/src/main/java/org/wpewebkit/wpe/AuxiliaryProcessesContainer.java b/wpe/src/main/java/org/wpewebkit/wpe/AuxiliaryProcessesContainer.java index 794c395b9..940e68037 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/AuxiliaryProcessesContainer.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/AuxiliaryProcessesContainer.java @@ -29,11 +29,12 @@ final class AuxiliaryProcessesContainer { private static final int MAX_AUX_PROCESSES = 40; - private final AuxiliaryProcess[][] processes = new AuxiliaryProcess[ProcessType.values().length][MAX_AUX_PROCESSES]; + private final AuxiliaryProcess[][] processes = + new AuxiliaryProcess[WKProcessType.values().length][MAX_AUX_PROCESSES]; private final Map pidToProcessMap = new HashMap<>(); - private final int[] firstAvailableSlot = new int[ProcessType.values().length]; + private final int[] firstAvailableSlot = new int[WKProcessType.values().length]; - public int getFirstAvailableSlot(@NonNull ProcessType processType) { + public int getFirstAvailableSlot(@NonNull WKProcessType processType) { return firstAvailableSlot[processType.getValue()]; } @@ -77,8 +78,8 @@ public AuxiliaryProcess(int processSlot, @NonNull WPEServiceConnection connectio public int getProcessSlot() { return processSlot; } - public ProcessType getProcessType() { return serviceConnection.getProcessType(); } + public WKProcessType getProcessType() { return serviceConnection.getProcessType(); } - public void terminate() { Browser.getInstance().getApplicationContext().unbindService(serviceConnection); } + public void terminate() { WKRuntime.getInstance().getApplicationContext().unbindService(serviceConnection); } } } diff --git a/wpe/src/main/java/org/wpewebkit/wpe/ProcessType.java b/wpe/src/main/java/org/wpewebkit/wpe/WKProcessType.java similarity index 86% rename from wpe/src/main/java/org/wpewebkit/wpe/ProcessType.java rename to wpe/src/main/java/org/wpewebkit/wpe/WKProcessType.java index 40ad10713..aa7f40bda 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/ProcessType.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/WKProcessType.java @@ -22,17 +22,17 @@ import androidx.annotation.NonNull; -public enum ProcessType { +public enum WKProcessType { WebProcess(0), NetworkProcess(1), WebDriverProcess(2); private final int value; - ProcessType(int value) { this.value = value; } + WKProcessType(int value) { this.value = value; } - public static @NonNull ProcessType fromValue(int value) { - for (ProcessType entry : ProcessType.values()) { + public static @NonNull WKProcessType fromValue(int value) { + for (WKProcessType entry : WKProcessType.values()) { if (entry.getValue() == value) return entry; } diff --git a/wpe/src/main/java/org/wpewebkit/wpe/Browser.java b/wpe/src/main/java/org/wpewebkit/wpe/WKRuntime.java similarity index 96% rename from wpe/src/main/java/org/wpewebkit/wpe/Browser.java rename to wpe/src/main/java/org/wpewebkit/wpe/WKRuntime.java index c8276d034..3f6f66777 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/Browser.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/WKRuntime.java @@ -35,7 +35,6 @@ import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; -import org.wpewebkit.wpe.AuxiliaryProcessesContainer; import org.wpewebkit.wpe.services.WPEServiceConnection; import org.wpewebkit.wpe.services.WPEServiceConnectionListener; @@ -44,7 +43,7 @@ import java.util.List; @UiThread -public final class Browser { +public final class WKRuntime { private static final String LOGTAG = "WPEBrowser"; static { System.loadLibrary("WPEAndroidBrowser"); } @@ -54,11 +53,11 @@ public final class Browser { private native void nativeInit(); private native void nativeShut(); - private static final Browser singleton = new Browser(); + private static final WKRuntime singleton = new WKRuntime(); - public static @NonNull Browser getInstance() { return singleton; } + public static @NonNull WKRuntime getInstance() { return singleton; } - private Browser() { Log.v(LOGTAG, "WPE Browser creation"); } + private WKRuntime() { Log.v(LOGTAG, "WPE WKRuntime creation"); } private Context applicationContext = null; @@ -134,7 +133,7 @@ public void onServiceDisconnected(@NonNull WPEServiceConnection connection) { @Keep @WorkerThread public void launchProcess(long pid, int type, int fd) { - ProcessType processType = ProcessType.fromValue(type); + WKProcessType processType = WKProcessType.fromValue(type); Log.d(LOGTAG, "launchProcess " + processType.name() + " (pid: " + pid + ", fd: " + fd + ")"); int processSlot = auxiliaryProcesses.getFirstAvailableSlot(processType); diff --git a/wpe/src/main/java/org/wpewebkit/wpe/WKWebContext.java b/wpe/src/main/java/org/wpewebkit/wpe/WKWebContext.java index 3076d2eca..48e2f6acd 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/WKWebContext.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/WKWebContext.java @@ -26,7 +26,7 @@ public interface Client { public WKWebContext(@NonNull Context context, int inspectorPort, boolean automationMode) { this.context = context; - Browser.getInstance().initialize(context, inspectorPort); + WKRuntime.getInstance().initialize(context, inspectorPort); nativePtr = nativeInit(automationMode); diff --git a/wpe/src/main/java/org/wpewebkit/wpe/services/NetworkProcessService.java b/wpe/src/main/java/org/wpewebkit/wpe/services/NetworkProcessService.java index 9e55da9b1..8bea6c6a6 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/services/NetworkProcessService.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/services/NetworkProcessService.java @@ -27,7 +27,7 @@ import androidx.annotation.NonNull; -import org.wpewebkit.wpe.ProcessType; +import org.wpewebkit.wpe.WKProcessType; import java.io.File; @@ -69,6 +69,6 @@ protected void setupServiceEnvironment() { protected void initializeServiceMain(long pid, @NonNull ParcelFileDescriptor parcelFd) { Log.d(LOGTAG, "initializeServiceMain() pid: " + pid + ", fd: " + parcelFd + ", native value: " + parcelFd.getFd()); - initializeNativeMain(pid, ProcessType.NetworkProcess.getValue(), parcelFd.detachFd()); + initializeNativeMain(pid, WKProcessType.NetworkProcess.getValue(), parcelFd.detachFd()); } } diff --git a/wpe/src/main/java/org/wpewebkit/wpe/services/WPEServiceConnection.java b/wpe/src/main/java/org/wpewebkit/wpe/services/WPEServiceConnection.java index d6be297ed..2c96bd77b 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/services/WPEServiceConnection.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/services/WPEServiceConnection.java @@ -35,19 +35,19 @@ import org.wpewebkit.wpe.IWPEService; import org.wpewebkit.wpe.IWPEServiceHost; -import org.wpewebkit.wpe.ProcessType; +import org.wpewebkit.wpe.WKProcessType; public final class WPEServiceConnection implements ServiceConnection { private static final String LOGTAG = "WPEServiceConnection"; private final long pid; - private final ProcessType processType; + private final WKProcessType processType; private ParcelFileDescriptor parcelFd; protected final WPEServiceConnectionListener listener; protected final Handler handler = new Handler(Looper.myLooper()); - public WPEServiceConnection(long pid, @NonNull ProcessType processType, @NonNull ParcelFileDescriptor parcelFd, + public WPEServiceConnection(long pid, @NonNull WKProcessType processType, @NonNull ParcelFileDescriptor parcelFd, @NonNull WPEServiceConnectionListener listener) { this.pid = pid; this.processType = processType; @@ -56,7 +56,7 @@ public WPEServiceConnection(long pid, @NonNull ProcessType processType, @NonNull } public long getPid() { return pid; } - public @NonNull ProcessType getProcessType() { return processType; } + public @NonNull WKProcessType getProcessType() { return processType; } @Override public void onServiceConnected(@NonNull ComponentName name, IBinder service) { diff --git a/wpe/src/main/java/org/wpewebkit/wpe/services/WebDriverProcessService.java b/wpe/src/main/java/org/wpewebkit/wpe/services/WebDriverProcessService.java index d7089621b..e3e8d8083 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/services/WebDriverProcessService.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/services/WebDriverProcessService.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; -import org.wpewebkit.wpe.ProcessType; +import org.wpewebkit.wpe.WKProcessType; import java.io.File; @@ -48,6 +48,6 @@ protected void setupServiceEnvironment() { protected void initializeServiceMain(long pid, @NonNull ParcelFileDescriptor parcelFd) { Log.d(LOGTAG, "initializeServiceMain()"); - initializeNativeMain(pid, ProcessType.WebDriverProcess.getValue(), 0); + initializeNativeMain(pid, WKProcessType.WebDriverProcess.getValue(), 0); } } diff --git a/wpe/src/main/java/org/wpewebkit/wpe/services/WebProcessService.java b/wpe/src/main/java/org/wpewebkit/wpe/services/WebProcessService.java index 289bdfd7e..809fa7506 100644 --- a/wpe/src/main/java/org/wpewebkit/wpe/services/WebProcessService.java +++ b/wpe/src/main/java/org/wpewebkit/wpe/services/WebProcessService.java @@ -31,7 +31,7 @@ import androidx.annotation.NonNull; import org.freedesktop.gstreamer.GStreamer; -import org.wpewebkit.wpe.ProcessType; +import org.wpewebkit.wpe.WKProcessType; import java.io.File; import java.io.FileInputStream; @@ -176,6 +176,6 @@ protected void setupServiceEnvironment() { protected void initializeServiceMain(long pid, @NonNull ParcelFileDescriptor parcelFd) { Log.d(LOGTAG, "initializeServiceMain() pid: " + pid + ", fd: " + parcelFd + ", native value: " + parcelFd.getFd()); - initializeNativeMain(pid, ProcessType.WebProcess.getValue(), parcelFd.detachFd()); + initializeNativeMain(pid, WKProcessType.WebProcess.getValue(), parcelFd.detachFd()); } }