summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-22 22:44:01 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:52:59 +0200
commit57383be95da385b336d988ff713b8e3bf097ce0f (patch)
tree06392b9c4ca8701a49fe1976f25d10bc4e1582bd
parent6ef03f136bac6d677d67d1bcc4e110e891e7c4ca (diff)
downloadUXP-57383be95da385b336d988ff713b8e3bf097ce0f.tar
UXP-57383be95da385b336d988ff713b8e3bf097ce0f.tar.gz
UXP-57383be95da385b336d988ff713b8e3bf097ce0f.tar.lz
UXP-57383be95da385b336d988ff713b8e3bf097ce0f.tar.xz
UXP-57383be95da385b336d988ff713b8e3bf097ce0f.zip
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.
-rw-r--r--ipc/app/Makefile.in4
-rw-r--r--ipc/app/MozillaRuntimeMainAndroid.cpp35
-rw-r--r--ipc/app/moz.build31
-rw-r--r--ipc/app/pie/moz.build19
-rw-r--r--ipc/contentproc/plugin-container.cpp2
-rw-r--r--ipc/glue/GeckoChildProcessHost.cpp46
-rw-r--r--ipc/glue/ProtocolUtils.cpp4
-rw-r--r--ipc/glue/ProtocolUtils.h4
-rw-r--r--ipc/glue/SharedMemoryBasic.h4
-rw-r--r--ipc/glue/SharedMemoryBasic_android.cpp139
-rw-r--r--ipc/glue/SharedMemoryBasic_android.h72
-rw-r--r--ipc/glue/moz.build10
-rw-r--r--ipc/moz.build4
13 files changed, 15 insertions, 359 deletions
diff --git a/ipc/app/Makefile.in b/ipc/app/Makefile.in
index d5593724c..c25119ac3 100644
--- a/ipc/app/Makefile.in
+++ b/ipc/app/Makefile.in
@@ -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.
diff --git a/ipc/app/MozillaRuntimeMainAndroid.cpp b/ipc/app/MozillaRuntimeMainAndroid.cpp
deleted file mode 100644
index 81b89eef5..000000000
--- a/ipc/app/MozillaRuntimeMainAndroid.cpp
+++ /dev/null
@@ -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);
-}
diff --git a/ipc/app/moz.build b/ipc/app/moz.build
index 3e6461584..306446a86 100644
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -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':
diff --git a/ipc/app/pie/moz.build b/ipc/app/pie/moz.build
deleted file mode 100644
index 6924199b5..000000000
--- a/ipc/app/pie/moz.build
+++ /dev/null
@@ -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']
diff --git a/ipc/contentproc/plugin-container.cpp b/ipc/contentproc/plugin-container.cpp
index 2fb9bd4f5..0e59e9d7a 100644
--- a/ipc/contentproc/plugin-container.cpp
+++ b/ipc/contentproc/plugin-container.cpp
@@ -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());
diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp
index 9e83a8729..a14be5693 100644
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -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;
diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp
index 7d8a1153c..eb18bb987 100644
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -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);
}
diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h
index 83860d93a..e22f16c1c 100644
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -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;
diff --git a/ipc/glue/SharedMemoryBasic.h b/ipc/glue/SharedMemoryBasic.h
index d8720271f..2bf4a93a0 100644
--- a/ipc/glue/SharedMemoryBasic.h
+++ b/ipc/glue/SharedMemoryBasic.h
@@ -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"
diff --git a/ipc/glue/SharedMemoryBasic_android.cpp b/ipc/glue/SharedMemoryBasic_android.cpp
deleted file mode 100644
index 05c9ca9ad..000000000
--- a/ipc/glue/SharedMemoryBasic_android.cpp
+++ /dev/null
@@ -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
diff --git a/ipc/glue/SharedMemoryBasic_android.h b/ipc/glue/SharedMemoryBasic_android.h
deleted file mode 100644
index 488390d9f..000000000
--- a/ipc/glue/SharedMemoryBasic_android.h
+++ /dev/null
@@ -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
diff --git a/ipc/glue/moz.build b/ipc/glue/moz.build
index 85d7f8fa0..51e6538ff 100644
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -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',
diff --git a/ipc/moz.build b/ipc/moz.build
index 320d8c5f0..4c9fb6b38 100644
--- a/ipc/moz.build
+++ b/ipc/moz.build
@@ -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']