mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-24 09:27:31 +09:00
Issue #1053 - Remove android support from mozglue
Yes, I checked for unsaved files this time...
This commit is contained in:
parent
bb8b180863
commit
a890ecd06f
26 changed files with 19 additions and 2748 deletions
|
|
@ -1,140 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 <pthread.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <android/log.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include "mozilla/Alignment.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define NS_EXPORT __attribute__ ((visibility("default")))
|
||||
|
||||
#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
|
||||
/* Android doesn't have pthread_atfork(), so we need to use our own. */
|
||||
struct AtForkFuncs {
|
||||
void (*prepare)(void);
|
||||
void (*parent)(void);
|
||||
void (*child)(void);
|
||||
};
|
||||
|
||||
/* jemalloc's initialization calls pthread_atfork. When pthread_atfork (see
|
||||
* further below) stores the corresponding data, it's going to allocate memory,
|
||||
* which will loop back to jemalloc's initialization, leading to a dead-lock.
|
||||
* So, for that specific vector, we use a special allocator that returns a
|
||||
* static buffer for small sizes, and force the initial vector capacity to
|
||||
* a size enough to store one atfork function table. */
|
||||
template <typename T>
|
||||
struct SpecialAllocator: public std::allocator<T>
|
||||
{
|
||||
SpecialAllocator(): bufUsed(false) {}
|
||||
|
||||
inline typename std::allocator<T>::pointer allocate(typename std::allocator<T>::size_type n, const void * = 0) {
|
||||
if (!bufUsed && n == 1) {
|
||||
bufUsed = true;
|
||||
return buf.addr();
|
||||
}
|
||||
return reinterpret_cast<T *>(::operator new(sizeof(T) * n));
|
||||
}
|
||||
|
||||
inline void deallocate(typename std::allocator<T>::pointer p, typename std::allocator<T>::size_type n) {
|
||||
if (p == buf.addr())
|
||||
bufUsed = false;
|
||||
else
|
||||
::operator delete(p);
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
struct rebind {
|
||||
typedef SpecialAllocator<U> other;
|
||||
};
|
||||
|
||||
private:
|
||||
mozilla::AlignedStorage2<T> buf;
|
||||
bool bufUsed;
|
||||
};
|
||||
|
||||
static std::vector<AtForkFuncs, SpecialAllocator<AtForkFuncs> > atfork;
|
||||
#endif
|
||||
|
||||
#define cpuacct_add(x)
|
||||
|
||||
#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
|
||||
extern "C" NS_EXPORT int
|
||||
pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
|
||||
{
|
||||
AtForkFuncs funcs;
|
||||
funcs.prepare = prepare;
|
||||
funcs.parent = parent;
|
||||
funcs.child = child;
|
||||
if (!atfork.capacity())
|
||||
atfork.reserve(1);
|
||||
atfork.push_back(funcs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT pid_t __fork(void);
|
||||
|
||||
extern "C" NS_EXPORT pid_t
|
||||
fork(void)
|
||||
{
|
||||
pid_t pid;
|
||||
for (auto it = atfork.rbegin();
|
||||
it < atfork.rend(); ++it)
|
||||
if (it->prepare)
|
||||
it->prepare();
|
||||
|
||||
switch ((pid = syscall(__NR_clone, SIGCHLD, NULL, NULL, NULL, NULL))) {
|
||||
case 0:
|
||||
cpuacct_add(getuid());
|
||||
for (auto it = atfork.begin();
|
||||
it < atfork.end(); ++it)
|
||||
if (it->child)
|
||||
it->child();
|
||||
break;
|
||||
default:
|
||||
for (auto it = atfork.begin();
|
||||
it < atfork.end(); ++it)
|
||||
if (it->parent)
|
||||
it->parent();
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" NS_EXPORT int
|
||||
raise(int sig)
|
||||
{
|
||||
// Bug 741272: Bionic incorrectly uses kill(), which signals the
|
||||
// process, and thus could signal another thread (and let this one
|
||||
// return "successfully" from raising a fatal signal).
|
||||
//
|
||||
// Bug 943170: POSIX specifies pthread_kill(pthread_self(), sig) as
|
||||
// equivalent to raise(sig), but Bionic also has a bug with these
|
||||
// functions, where a forked child will kill its parent instead.
|
||||
|
||||
extern pid_t gettid(void);
|
||||
return syscall(__NR_tgkill, getpid(), gettid(), sig);
|
||||
}
|
||||
|
||||
/* Flash plugin uses symbols that are not present in Android >= 4.4 */
|
||||
namespace android {
|
||||
namespace VectorImpl {
|
||||
NS_EXPORT void reservedVectorImpl1(void) { }
|
||||
NS_EXPORT void reservedVectorImpl2(void) { }
|
||||
NS_EXPORT void reservedVectorImpl3(void) { }
|
||||
NS_EXPORT void reservedVectorImpl4(void) { }
|
||||
NS_EXPORT void reservedVectorImpl5(void) { }
|
||||
NS_EXPORT void reservedVectorImpl6(void) { }
|
||||
NS_EXPORT void reservedVectorImpl7(void) { }
|
||||
NS_EXPORT void reservedVectorImpl8(void) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
// we don't compile one of these detection methods. The detection code here is
|
||||
// based on the CPU detection in libtheora.
|
||||
|
||||
# if defined(__linux__) || defined(ANDROID)
|
||||
# if defined(__linux__)
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
|
@ -125,7 +125,7 @@ check_neon(void)
|
|||
}
|
||||
# endif
|
||||
|
||||
# endif // defined(__linux__) || defined(ANDROID)
|
||||
# endif // defined(__linux__)
|
||||
|
||||
namespace mozilla {
|
||||
namespace arm_private {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
# endif
|
||||
|
||||
// Currently we only have CPU detection for Linux via /proc/cpuinfo
|
||||
# if defined(__linux__) || defined(ANDROID)
|
||||
# if defined(__linux__)
|
||||
# define MOZILLA_ARM_HAVE_CPUID_DETECTION 1
|
||||
# endif
|
||||
|
||||
|
|
|
|||
|
|
@ -4,31 +4,22 @@
|
|||
# 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/.
|
||||
|
||||
# Build mozglue as a shared lib on Windows, OSX and Android.
|
||||
# Build mozglue as a shared lib on Windows, OSX.
|
||||
# If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in
|
||||
if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
|
||||
if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin'):
|
||||
SharedLibrary('mozglue')
|
||||
else:
|
||||
Library('mozglue')
|
||||
|
||||
SDK_LIBRARY = True
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Android':
|
||||
SOURCES += [
|
||||
'BionicGlue.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ASAN']:
|
||||
SOURCES += [
|
||||
'AsanOptions.cpp',
|
||||
]
|
||||
SOURCES += ['AsanOptions.cpp']
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'WINNT':
|
||||
DEFFILE = 'mozglue.def'
|
||||
# We'll break the DLL blocklist if we immediately load user32.dll
|
||||
DELAYLOAD_DLLS += [
|
||||
'user32.dll',
|
||||
]
|
||||
DELAYLOAD_DLLS += ['user32.dll']
|
||||
|
||||
if not CONFIG['JS_STANDALONE']:
|
||||
|
||||
|
|
@ -38,21 +29,13 @@ if not CONFIG['JS_STANDALONE']:
|
|||
else:
|
||||
# Temporary, until bug 662814 lands
|
||||
NO_VISIBILITY_FLAGS = True
|
||||
SOURCES += [
|
||||
'dummy.cpp',
|
||||
]
|
||||
SOURCES += ['dummy.cpp']
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'WINNT':
|
||||
LOCAL_INCLUDES += [
|
||||
'/memory/build',
|
||||
]
|
||||
SOURCES += [
|
||||
'WindowsDllBlocklist.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += ['/memory/build']
|
||||
SOURCES += ['WindowsDllBlocklist.cpp']
|
||||
DISABLE_STL_WRAPPING = True
|
||||
OS_LIBS += [
|
||||
'version',
|
||||
]
|
||||
OS_LIBS += ['version']
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'arm.h',
|
||||
|
|
@ -62,28 +45,18 @@ if not CONFIG['JS_STANDALONE']:
|
|||
]
|
||||
|
||||
if CONFIG['CPU_ARCH'].startswith('x86'):
|
||||
SOURCES += [
|
||||
'SSE.cpp',
|
||||
]
|
||||
SOURCES += ['SSE.cpp']
|
||||
|
||||
if CONFIG['CPU_ARCH'] == 'arm':
|
||||
SOURCES += [
|
||||
'arm.cpp',
|
||||
]
|
||||
SOURCES += ['arm.cpp']
|
||||
|
||||
if CONFIG['CPU_ARCH'].startswith('mips'):
|
||||
SOURCES += [
|
||||
'mips.cpp',
|
||||
]
|
||||
SOURCES += ['mips.cpp']
|
||||
|
||||
if CONFIG['MOZ_LINKER']:
|
||||
USE_LIBS += [
|
||||
'zlib',
|
||||
]
|
||||
USE_LIBS += ['zlib']
|
||||
|
||||
USE_LIBS += [
|
||||
'mfbt',
|
||||
]
|
||||
USE_LIBS += ['mfbt']
|
||||
|
||||
DEFINES['IMPL_MFBT'] = True
|
||||
LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue