mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #1053 - Remove android support from ipc except for ipc/chromium
This does not include android in the imported chromium code as specific research needs done on defines and logic.
This commit is contained in:
parent
a890ecd06f
commit
dd6048d3ec
13 changed files with 15 additions and 359 deletions
|
|
@ -18,10 +18,6 @@ include $(topsrcdir)/config/config.mk
|
|||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),android)
|
||||
#LIBS += ../contentproc/$(LIB_PREFIX)plugin-container.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT) #{
|
||||
# Note the manifest file exists in the tree, so we use the explicit filename
|
||||
# here.
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: sw=4 ts=4 et :
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <android/log.h>
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
// Check for the absolute minimum number of args we need to move
|
||||
// forward here. We expect the last arg to be the child process type.
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
|
||||
void *mozloader_handle = dlopen("libmozglue.so", RTLD_LAZY);
|
||||
if (!mozloader_handle) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad",
|
||||
"Couldn't load mozloader because %s", dlerror());
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef int (*ChildProcessInit_t)(int, char**);
|
||||
ChildProcessInit_t fChildProcessInit =
|
||||
(ChildProcessInit_t)dlsym(mozloader_handle, "ChildProcessInit");
|
||||
if (!fChildProcessInit) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad",
|
||||
"Couldn't load cpi_t because %s", dlerror());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return fChildProcessInit(argc, argv);
|
||||
}
|
||||
|
|
@ -4,21 +4,11 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Any changes that affect Android need to be made in pie/moz.build as well.
|
||||
GeckoProgram(CONFIG['MOZ_CHILD_PROCESS_NAME'], linkage='dependent')
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
Program(CONFIG['MOZ_CHILD_PROCESS_NAME'])
|
||||
SOURCES += [
|
||||
'MozillaRuntimeMainAndroid.cpp',
|
||||
]
|
||||
|
||||
DIRS += ['pie']
|
||||
else:
|
||||
GeckoProgram(CONFIG['MOZ_CHILD_PROCESS_NAME'], linkage='dependent')
|
||||
|
||||
SOURCES += [
|
||||
'MozillaRuntimeMain.cpp',
|
||||
]
|
||||
SOURCES += [
|
||||
'MozillaRuntimeMain.cpp',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
|
|
@ -29,13 +19,12 @@ LOCAL_INCLUDES += [
|
|||
|
||||
# We link GMPLoader into plugin-container on desktop so that its code is
|
||||
# covered by the desktop DRM vendor's voucher.
|
||||
if CONFIG['OS_TARGET'] != 'Android':
|
||||
SOURCES += [
|
||||
'../../dom/media/gmp/GMPLoader.cpp',
|
||||
]
|
||||
USE_LIBS += [
|
||||
'rlz',
|
||||
]
|
||||
SOURCES += [
|
||||
'../../dom/media/gmp/GMPLoader.cpp',
|
||||
]
|
||||
USE_LIBS += [
|
||||
'rlz',
|
||||
]
|
||||
|
||||
# DELAYLOAD_DLLS in this block ensures that the DLL blocklist is functional
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
Program(CONFIG['MOZ_CHILD_PROCESS_NAME_PIE'])
|
||||
SOURCES += [
|
||||
'../MozillaRuntimeMainAndroid.cpp',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/toolkit/xre',
|
||||
'/xpcom/base',
|
||||
]
|
||||
|
||||
LDFLAGS += ['-pie']
|
||||
|
|
@ -50,7 +50,7 @@ content_process_main(int argc, char* argv[])
|
|||
SetDllDirectoryW(L"");
|
||||
}
|
||||
#endif
|
||||
#if !defined(MOZ_WIDGET_ANDROID) && defined(MOZ_PLUGIN_CONTAINER)
|
||||
#ifdef MOZ_PLUGIN_CONTAINER
|
||||
// On desktop, the GMPLoader lives in plugin-container, so that its
|
||||
// code can be covered by an EME/GMP vendor's voucher.
|
||||
nsAutoPtr<mozilla::gmp::SandboxStarter> starter(MakeSandboxStarter());
|
||||
|
|
|
|||
|
|
@ -47,17 +47,6 @@
|
|||
using mozilla::MonitorAutoLock;
|
||||
using mozilla::ipc::GeckoChildProcessHost;
|
||||
|
||||
#ifdef ANDROID
|
||||
// Like its predecessor in nsExceptionHandler.cpp, this is
|
||||
// the magic number of a file descriptor remapping we must
|
||||
// preserve for the child process.
|
||||
static const int kMagicAndroidSystemPropFd = 5;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
#endif
|
||||
|
||||
static const bool kLowRightsSubprocesses =
|
||||
// We only attempted to drop privileges on gonk, because it
|
||||
// had no plugins or extensions to worry about breaking.
|
||||
|
|
@ -170,17 +159,7 @@ GeckoChildProcessHost::GetPathToBinary(FilePath& exePath, GeckoProcessType proce
|
|||
exePath = exePath.DirName();
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
exePath = exePath.AppendASCII("lib");
|
||||
|
||||
// We must use the PIE binary on 5.0 and higher
|
||||
const char* processName = mozilla::AndroidBridge::Bridge()->GetAPIVersion() >= 21 ?
|
||||
MOZ_CHILD_PROCESS_NAME_PIE : MOZ_CHILD_PROCESS_NAME;
|
||||
|
||||
exePath = exePath.AppendASCII(processName);
|
||||
#else
|
||||
exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_NAME);
|
||||
#endif
|
||||
|
||||
return BinaryPathType::PluginContainer;
|
||||
}
|
||||
|
|
@ -622,9 +601,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
|||
nsCString path;
|
||||
NS_CopyUnicodeToNative(nsDependentString(gGREBinPath), path);
|
||||
# if defined(OS_LINUX) || defined(OS_BSD)
|
||||
# if defined(MOZ_WIDGET_ANDROID)
|
||||
path += "/lib";
|
||||
# endif // MOZ_WIDGET_ANDROID
|
||||
const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
|
||||
nsCString new_ld_lib_path(path.get());
|
||||
|
||||
|
|
@ -668,28 +644,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
|||
FilePath exePath;
|
||||
BinaryPathType pathType = GetPathToBinary(exePath, mProcessType);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// The java wrapper unpacks this for us but can't make it executable
|
||||
chmod(exePath.value().c_str(), 0700);
|
||||
#endif // MOZ_WIDGET_ANDROID
|
||||
|
||||
#ifdef ANDROID
|
||||
// Remap the Android property workspace to a well-known int,
|
||||
// and update the environment to reflect the new value for the
|
||||
// child process.
|
||||
const char *apws = getenv("ANDROID_PROPERTY_WORKSPACE");
|
||||
if (apws) {
|
||||
int fd = atoi(apws);
|
||||
mFileMap.push_back(std::pair<int, int>(fd, kMagicAndroidSystemPropFd));
|
||||
|
||||
char buf[32];
|
||||
char *szptr = strchr(apws, ',');
|
||||
|
||||
snprintf(buf, sizeof(buf), "%d%s", kMagicAndroidSystemPropFd, szptr);
|
||||
newEnvVars["ANDROID_PROPERTY_WORKSPACE"] = buf;
|
||||
}
|
||||
#endif // ANDROID
|
||||
|
||||
// remap the IPC socket fd to a well-known int, as the OS does for
|
||||
// STDOUT_FILENO, for example
|
||||
int srcChannelFd, dstChannelFd;
|
||||
|
|
|
|||
|
|
@ -183,9 +183,7 @@ LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid,
|
|||
aOtherPid, aTopLevelProtocol,
|
||||
aContextDescription,
|
||||
StringFromIPCMessageType(aMessageId));
|
||||
#ifdef ANDROID
|
||||
__android_log_write(ANDROID_LOG_INFO, "GeckoIPC", logMessage.get());
|
||||
#endif
|
||||
|
||||
fputs(logMessage.get(), stderr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
#include "MainThreadUtils.h"
|
||||
|
||||
#if defined(ANDROID) && defined(DEBUG)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
template<typename T> class nsTHashtable;
|
||||
template<typename T> class nsPtrHashKey;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
#ifndef mozilla_ipc_SharedMemoryBasic_h
|
||||
#define mozilla_ipc_SharedMemoryBasic_h
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "mozilla/ipc/SharedMemoryBasic_android.h"
|
||||
#elif defined(XP_DARWIN)
|
||||
#ifdef XP_DARWIN
|
||||
# include "mozilla/ipc/SharedMemoryBasic_mach.h"
|
||||
#else
|
||||
# include "mozilla/ipc/SharedMemoryBasic_chromium.h"
|
||||
|
|
|
|||
|
|
@ -1,139 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <android/log.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/process_util.h"
|
||||
|
||||
#include "SharedMemoryBasic.h"
|
||||
|
||||
//
|
||||
// Temporarily go directly to the kernel interface until we can
|
||||
// interact better with libcutils.
|
||||
//
|
||||
#include <linux/ashmem.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
static void
|
||||
LogError(const char* what)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Gecko",
|
||||
"%s: %s (%d)", what, strerror(errno), errno);
|
||||
}
|
||||
|
||||
SharedMemoryBasic::SharedMemoryBasic()
|
||||
: mShmFd(-1)
|
||||
, mMemory(nullptr)
|
||||
{ }
|
||||
|
||||
SharedMemoryBasic::~SharedMemoryBasic()
|
||||
{
|
||||
Unmap();
|
||||
CloseHandle();
|
||||
}
|
||||
|
||||
bool
|
||||
SharedMemoryBasic::SetHandle(const Handle& aHandle)
|
||||
{
|
||||
MOZ_ASSERT(-1 == mShmFd, "Already Create()d");
|
||||
mShmFd = aHandle.fd;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedMemoryBasic::Create(size_t aNbytes)
|
||||
{
|
||||
MOZ_ASSERT(-1 == mShmFd, "Already Create()d");
|
||||
|
||||
// Carve a new instance off of /dev/ashmem
|
||||
int shmfd = open("/" ASHMEM_NAME_DEF, O_RDWR, 0600);
|
||||
if (-1 == shmfd) {
|
||||
LogError("ShmemAndroid::Create():open");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ioctl(shmfd, ASHMEM_SET_SIZE, aNbytes)) {
|
||||
LogError("ShmemAndroid::Unmap():ioctl(SET_SIZE)");
|
||||
close(shmfd);
|
||||
return false;
|
||||
}
|
||||
|
||||
mShmFd = shmfd;
|
||||
Created(aNbytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedMemoryBasic::Map(size_t nBytes)
|
||||
{
|
||||
MOZ_ASSERT(nullptr == mMemory, "Already Map()d");
|
||||
|
||||
mMemory = mmap(nullptr, nBytes,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED,
|
||||
mShmFd,
|
||||
0);
|
||||
if (MAP_FAILED == mMemory) {
|
||||
LogError("ShmemAndroid::Map()");
|
||||
mMemory = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
Mapped(nBytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedMemoryBasic::ShareToProcess(base::ProcessId/*unused*/,
|
||||
Handle* aNewHandle)
|
||||
{
|
||||
MOZ_ASSERT(mShmFd >= 0, "Should have been Create()d by now");
|
||||
|
||||
int shmfdDup = dup(mShmFd);
|
||||
if (-1 == shmfdDup) {
|
||||
LogError("ShmemAndroid::ShareToProcess()");
|
||||
return false;
|
||||
}
|
||||
|
||||
aNewHandle->fd = shmfdDup;
|
||||
aNewHandle->auto_close = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
SharedMemoryBasic::Unmap()
|
||||
{
|
||||
if (!mMemory) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (munmap(mMemory, Size())) {
|
||||
LogError("ShmemAndroid::Unmap()");
|
||||
}
|
||||
mMemory = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
SharedMemoryBasic::CloseHandle()
|
||||
{
|
||||
if (mShmFd != -1) {
|
||||
close(mShmFd);
|
||||
mShmFd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ipc_SharedMemoryBasic_android_h
|
||||
#define mozilla_ipc_SharedMemoryBasic_android_h
|
||||
|
||||
#include "base/file_descriptor_posix.h"
|
||||
|
||||
#include "SharedMemory.h"
|
||||
|
||||
//
|
||||
// This is a low-level wrapper around platform shared memory. Don't
|
||||
// use it directly; use Shmem allocated through IPDL interfaces.
|
||||
//
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
class SharedMemoryBasic final : public SharedMemoryCommon<base::FileDescriptor>
|
||||
{
|
||||
public:
|
||||
SharedMemoryBasic();
|
||||
|
||||
virtual bool SetHandle(const Handle& aHandle) override;
|
||||
|
||||
virtual bool Create(size_t aNbytes) override;
|
||||
|
||||
virtual bool Map(size_t nBytes) override;
|
||||
|
||||
virtual void CloseHandle() override;
|
||||
|
||||
virtual void* memory() const override
|
||||
{
|
||||
return mMemory;
|
||||
}
|
||||
|
||||
virtual SharedMemoryType Type() const override
|
||||
{
|
||||
return TYPE_BASIC;
|
||||
}
|
||||
|
||||
static Handle NULLHandle()
|
||||
{
|
||||
return Handle();
|
||||
}
|
||||
|
||||
virtual bool IsHandleValid(const Handle &aHandle) const override
|
||||
{
|
||||
return aHandle.fd >= 0;
|
||||
}
|
||||
|
||||
virtual bool ShareToProcess(base::ProcessId aProcessId,
|
||||
Handle* aNewHandle) override;
|
||||
|
||||
private:
|
||||
~SharedMemoryBasic();
|
||||
|
||||
void Unmap();
|
||||
|
||||
// The /dev/ashmem fd we allocate.
|
||||
int mShmFd;
|
||||
// Pointer to mapped region, null if unmapped.
|
||||
void *mMemory;
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // ifndef mozilla_ipc_SharedMemoryBasic_android_h
|
||||
|
|
@ -78,15 +78,7 @@ else:
|
|||
'CrossProcessMutex_unimplemented.cpp',
|
||||
]
|
||||
|
||||
# Android has its own,
|
||||
# almost-but-not-quite-compatible-with-POSIX-or-/dev/shm shared memory
|
||||
# impl.
|
||||
if CONFIG['OS_TARGET'] == 'Android':
|
||||
EXPORTS.mozilla.ipc += ['SharedMemoryBasic_android.h']
|
||||
UNIFIED_SOURCES += [
|
||||
'SharedMemoryBasic_android.cpp',
|
||||
]
|
||||
elif CONFIG['OS_ARCH'] == 'Darwin':
|
||||
if CONFIG['OS_ARCH'] == 'Darwin':
|
||||
EXPORTS.mozilla.ipc += ['SharedMemoryBasic_mach.h']
|
||||
SOURCES += [
|
||||
'SharedMemoryBasic_mach.mm',
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
DIRS += [
|
||||
'chromium',
|
||||
'contentproc',
|
||||
'glue',
|
||||
'ipdl',
|
||||
'testshell',
|
||||
|
|
@ -14,9 +15,6 @@ DIRS += [
|
|||
if CONFIG['MOZ_ENABLE_DBUS']:
|
||||
DIRS += ['dbus']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
|
||||
DIRS += ['contentproc']
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DIRS += ['mscom']
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue