Backout changeset f70b74488807 (bug 833117) for gtest bustage on Linux

This commit is contained in:
Mike Hommey 2015-07-01 16:41:20 +09:00
parent 10e8f744a3
commit bb576d901a
3 changed files with 6 additions and 42 deletions

View File

@ -4325,6 +4325,12 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
mozilla::IOInterposerInit ioInterposerGuard;
#if defined(MOZ_WIDGET_GTK)
#if defined(MOZ_MEMORY) || defined(__FreeBSD__) || defined(__NetBSD__)
// Disable the slice allocator, since jemalloc already uses similar layout
// algorithms, and using a sub-allocator tends to increase fragmentation.
// This must be done before g_thread_init() is called.
g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
#endif
g_thread_init(nullptr);
#endif

View File

@ -54,6 +54,3 @@ USE_LIBS += [
NO_EXPAND_LIBS = True
DIST_INSTALL = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
CXXFLAGS += CONFIG['GLIB_CFLAGS']

View File

@ -426,48 +426,9 @@ XPCOMGlueEnablePreload()
do_preload = true;
}
#ifdef MOZ_WIDGET_GTK
#include <glib.h>
class GSliceInit {
#if defined(MOZ_MEMORY) || defined(__FreeBSD__) || defined(__NetBSD__)
public:
GSliceInit() {
mHadGSlice = bool(getenv("G_SLICE"));
if (!mHadGSlice) {
// Disable the slice allocator, since jemalloc already uses similar layout
// algorithms, and using a sub-allocator tends to increase fragmentation.
// This must be done before g_thread_init() is called.
setenv("G_SLICE", "always-malloc", 1);
}
}
~GSliceInit() {
if (mHadGSlice) {
return;
}
if (sTop) {
auto g_thread_init = (void (*)(void*)) GetSymbol(sTop->libHandle,
"g_thread_init");
auto g_type_init = (void (*)()) GetSymbol(sTop->libHandle, "g_type_init");
g_thread_init(nullptr); // For GLib version < 2.32
g_type_init(); // For 2.32 <= GLib version < 2.36
}
unsetenv("G_SLICE");
}
private:
bool mHadGSlice;
#endif
};
#endif
nsresult
XPCOMGlueStartup(const char* aXPCOMFile)
{
#ifdef MOZ_WIDGET_GTK
GSliceInit gSliceInit;
#endif
xpcomFunctions.version = XPCOM_GLUE_VERSION;
xpcomFunctions.size = sizeof(XPCOMFunctions);