Bug 1404144 - 2. Move start child process JNI call to GeckoProcessManager; r=rbarker

Avoid going through GeckoAppShell and move the start child process JNI
call directly to GeckoProcessManager.

MozReview-Commit-ID: KU62TiHVQJX

--HG--
extra : rebase_source : 0e8546da502257e1c59bc00b79f50c79a314f3e6
This commit is contained in:
Jim Chen 2017-10-04 22:28:43 -04:00
parent ffe3e86076
commit f281c874c0
4 changed files with 35 additions and 40 deletions

View File

@ -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<jni::String>(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;

View File

@ -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) {

View File

@ -557,14 +557,6 @@ auto GeckoAppShell::ShowNotification(mozilla::jni::String::Param a0, mozilla::jn
return mozilla::jni::Method<ShowNotification_t>::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<StartGeckoServiceChildProcess_t>::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<Start_t>::Call(GeckoProcessManager::Context(), nullptr, a0, a1, a2, a3);
}
const char GeckoServiceChildProcess::name[] =
"org/mozilla/gecko/process/GeckoServiceChildProcess";

View File

@ -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;