Bug 738561 - Cleanup mozglue for gonk, r=glandium

This commit is contained in:
Michael Wu 2012-03-29 18:32:44 -07:00
parent 48724a2497
commit 2c7e03bdf1
5 changed files with 7 additions and 93 deletions

View File

@ -52,10 +52,6 @@ ifeq (android,$(MOZ_WIDGET_TOOLKIT))
DIRS += android
endif
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
DIRS += gonk
endif
DIRS += build
TEST_DIRS = tests

View File

@ -49,7 +49,6 @@
#include <sys/mman.h>
#include <sys/limits.h>
#include <errno.h>
#include <pthread.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@ -1040,53 +1039,3 @@ ChildProcessInit(int argc, char* argv[])
return fXRE_InitChildProcess(argc, argv, proctype);
}
/* Android doesn't have pthread_atfork(), so we need to use our own. */
struct AtForkFuncs {
void (*prepare)(void);
void (*parent)(void);
void (*child)(void);
};
static std::vector<AtForkFuncs> atfork;
extern "C" NS_EXPORT int
__wrap_pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
{
AtForkFuncs funcs;
funcs.prepare = prepare;
funcs.parent = parent;
funcs.child = child;
atfork.push_back(funcs);
return 0;
}
extern "C" NS_EXPORT pid_t
__wrap_fork(void)
{
pid_t pid;
for (std::vector<AtForkFuncs>::reverse_iterator it = atfork.rbegin();
it < atfork.rend(); ++it)
if (it->prepare)
it->prepare();
switch ((pid = fork())) {
case 0:
for (std::vector<AtForkFuncs>::iterator it = atfork.begin();
it < atfork.end(); ++it)
if (it->child)
it->child();
break;
default:
for (std::vector<AtForkFuncs>::iterator it = atfork.begin();
it < atfork.end(); ++it)
if (it->parent)
it->parent();
}
return pid;
}
extern "C" NS_EXPORT int
__wrap_raise(int sig)
{
return pthread_kill(pthread_self(), sig);
}

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- 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/. */

View File

@ -82,22 +82,19 @@ NO_INSTALL_IMPORT_LIBRARY = 1
endif
endif
ifeq (android, $(MOZ_WIDGET_TOOLKIT))
# Add Android specific code
EXTRA_DSO_LDOPTS += $(ZLIB_LIBS)
ifeq (Android,$(OS_TARGET))
ifdef MOZ_MEMORY
# To properly wrap jemalloc's pthread_atfork call.
EXTRA_DSO_LDOPTS += -Wl,--wrap=pthread_atfork
CPPSRCS += BionicGlue.cpp
endif
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,android,$(DEPTH)/other-licenses/android)
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,android,../android)
endif
ifeq (gonk, $(MOZ_WIDGET_TOOLKIT))
# To properly wrap jemalloc's pthread_atfork call.
EXTRA_DSO_LDOPTS += -Wl,--wrap=pthread_atfork
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,android,$(DEPTH)/other-licenses/android)
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,gonk,../gonk)
ifeq (android, $(MOZ_WIDGET_TOOLKIT))
# Add Android specific code
EXTRA_DSO_LDOPTS += $(ZLIB_LIBS)
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,android,../android)
endif
ifdef MOZ_LINKER

View File

@ -1,28 +0,0 @@
# 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/.
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = gonk
LIBRARY_NAME = gonk
FORCE_STATIC_LIB = 1
STL_FLAGS=
DEFINES += \
-DANDROID_PACKAGE_NAME='"$(ANDROID_PACKAGE_NAME)"' \
$(NULL)
CPPSRCS = \
GonkGlue.cpp \
$(NULL)
LOCAL_INCLUDES += -I$(DEPTH)/build
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
include $(topsrcdir)/config/rules.mk