diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index 043ab708a835..9838bd8e406b 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -1273,11 +1273,11 @@ GeckoChildProcessHost::LaunchAndroidService(const char* type, ProcessHandle* process_handle) { MOZ_ASSERT((fds_to_remap.size() > 0) && (fds_to_remap.size() <= 2)); - JNIEnv* env = mozilla::jni::GetEnvForThread(); + JNIEnv* const env = mozilla::jni::GetEnvForThread(); MOZ_ASSERT(env); - int argvSize = argv.size(); - jni::ObjectArray::LocalRef jargs = jni::ObjectArray::LocalRef::Adopt(env->NewObjectArray(argvSize, env->FindClass("java/lang/String"), nullptr)); + const int argvSize = argv.size(); + jni::ObjectArray::LocalRef jargs = jni::ObjectArray::New(argvSize); for (int ix = 0; ix < argvSize; ix++) { jargs->SetElement(ix, jni::StringParam(argv[ix].c_str(), env)); } @@ -1286,7 +1286,7 @@ GeckoChildProcessHost::LaunchAndroidService(const char* type, it++; // If the Crash Reporter is disabled, there will not be a second file descriptor. int32_t crashFd = (it != fds_to_remap.end()) ? it->first : -1; - int32_t handle = java::GeckoAppShell::StartGeckoServiceChildProcess(type, jargs, crashFd, ipcFd); + int32_t handle = java::GeckoProcessManager::Start(type, jargs, crashFd, ipcFd); if (process_handle) { *process_handle = handle; diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java index 258a07ab7803..512028d4098f 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java @@ -1810,11 +1810,6 @@ public class GeckoAppShell return sScreenSize; } - @WrapForJNI - private static int startGeckoServiceChildProcess(String type, String[] args, int crashFd, int ipcFd) { - return GeckoProcessManager.getInstance().start(type, args, crashFd, ipcFd); - } - @WrapForJNI(calledFrom = "gecko") public static int getAudioOutputFramesPerBuffer() { if (SysInfo.getVersion() < 17) { diff --git a/widget/android/GeneratedJNIWrappers.cpp b/widget/android/GeneratedJNIWrappers.cpp index 47a65c5821a9..6b19759f629d 100644 --- a/widget/android/GeneratedJNIWrappers.cpp +++ b/widget/android/GeneratedJNIWrappers.cpp @@ -557,14 +557,6 @@ auto GeckoAppShell::ShowNotification(mozilla::jni::String::Param a0, mozilla::jn return mozilla::jni::Method::Call(GeckoAppShell::Context(), nullptr, a0, a1, a2, a3, a4, a5, a6); } -constexpr char GeckoAppShell::StartGeckoServiceChildProcess_t::name[]; -constexpr char GeckoAppShell::StartGeckoServiceChildProcess_t::signature[]; - -auto GeckoAppShell::StartGeckoServiceChildProcess(mozilla::jni::String::Param a0, mozilla::jni::ObjectArray::Param a1, int32_t a2, int32_t a3) -> int32_t -{ - return mozilla::jni::Method::Call(GeckoAppShell::Context(), nullptr, a0, a1, a2, a3); -} - constexpr char GeckoAppShell::UnlockProfile_t::name[]; constexpr char GeckoAppShell::UnlockProfile_t::signature[]; @@ -2471,6 +2463,14 @@ const char GeckoProcessManager::name[] = constexpr char GeckoProcessManager::GetEditableParent_t::name[]; constexpr char GeckoProcessManager::GetEditableParent_t::signature[]; +constexpr char GeckoProcessManager::Start_t::name[]; +constexpr char GeckoProcessManager::Start_t::signature[]; + +auto GeckoProcessManager::Start(mozilla::jni::String::Param a0, mozilla::jni::ObjectArray::Param a1, int32_t a2, int32_t a3) -> int32_t +{ + return mozilla::jni::Method::Call(GeckoProcessManager::Context(), nullptr, a0, a1, a2, a3); +} + const char GeckoServiceChildProcess::name[] = "org/mozilla/gecko/process/GeckoServiceChildProcess"; diff --git a/widget/android/GeneratedJNIWrappers.h b/widget/android/GeneratedJNIWrappers.h index f798cda792aa..b3b786f6149f 100644 --- a/widget/android/GeneratedJNIWrappers.h +++ b/widget/android/GeneratedJNIWrappers.h @@ -1571,29 +1571,6 @@ public: static auto ShowNotification(mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param) -> void; - struct StartGeckoServiceChildProcess_t { - typedef GeckoAppShell Owner; - typedef int32_t ReturnType; - typedef int32_t SetterType; - typedef mozilla::jni::Args< - mozilla::jni::String::Param, - mozilla::jni::ObjectArray::Param, - int32_t, - int32_t> Args; - static constexpr char name[] = "startGeckoServiceChildProcess"; - static constexpr char signature[] = - "(Ljava/lang/String;[Ljava/lang/String;II)I"; - static const bool isStatic = true; - static const mozilla::jni::ExceptionMode exceptionMode = - mozilla::jni::ExceptionMode::ABORT; - static const mozilla::jni::CallingThread callingThread = - mozilla::jni::CallingThread::ANY; - static const mozilla::jni::DispatchTarget dispatchTarget = - mozilla::jni::DispatchTarget::CURRENT; - }; - - static auto StartGeckoServiceChildProcess(mozilla::jni::String::Param, mozilla::jni::ObjectArray::Param, int32_t, int32_t) -> int32_t; - struct UnlockProfile_t { typedef GeckoAppShell Owner; typedef bool ReturnType; @@ -7002,6 +6979,29 @@ public: mozilla::jni::DispatchTarget::CURRENT; }; + struct Start_t { + typedef GeckoProcessManager Owner; + typedef int32_t ReturnType; + typedef int32_t SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::ObjectArray::Param, + int32_t, + int32_t> Args; + static constexpr char name[] = "start"; + static constexpr char signature[] = + "(Ljava/lang/String;[Ljava/lang/String;II)I"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Start(mozilla::jni::String::Param, mozilla::jni::ObjectArray::Param, int32_t, int32_t) -> int32_t; + static const mozilla::jni::CallingThread callingThread = mozilla::jni::CallingThread::ANY;