Bug 1092855 - Work around bad interaction between jemalloc and Apple uninitialized memory bug. r=spohl

This commit is contained in:
Steven Michaud 2014-11-11 15:28:18 -06:00
Родитель 19a77b306e
Коммит 9556bac074
2 изменённых файлов: 37 добавлений и 3 удалений

Просмотреть файл

@ -13,6 +13,13 @@
#include "base/string_util.h"
#include "chrome/common/chrome_switches.h"
#if defined(XP_MACOSX)
#include "nsCocoaFeatures.h"
// An undocumented CoreGraphics framework method, present in the same form
// since at least OS X 10.5.
extern "C" CGError CGSSetDebugOptions(int options);
#endif
#ifdef XP_WIN
#include <objbase.h>
bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
@ -119,9 +126,21 @@ PluginProcessChild::Init()
return false;
}
return mPlugin.InitForChrome(pluginFilename, ParentHandle(),
IOThreadChild::message_loop(),
IOThreadChild::channel());
bool retval = mPlugin.InitForChrome(pluginFilename, ParentHandle(),
IOThreadChild::message_loop(),
IOThreadChild::channel());
#if defined(XP_MACOSX)
if (nsCocoaFeatures::OnYosemiteOrLater()) {
// Explicitly turn off CGEvent logging. This works around bug 1092855.
// If there are already CGEvents in the log, turning off logging also
// causes those events to be written to disk. But at this point no
// CGEvents have yet been processed. CGEvents are events (usually
// input events) pulled from the WindowServer. An option of 0x80000008
// turns on CGEvent logging.
CGSSetDebugOptions(0x80000007);
}
#endif
return retval;
}
void

Просмотреть файл

@ -221,6 +221,11 @@ RemoveScreenWakeLockListener()
sWakeLockListener = nullptr;
}
}
// An undocumented CoreGraphics framework method, present in the same form
// since at least OS X 10.5.
extern "C" CGError CGSSetDebugOptions(int options);
// Init
//
// Loads the nib (see bug 316076c21) and sets up the CFRunLoopSource used to
@ -304,6 +309,16 @@ nsAppShell::Init()
gAppShellMethodsSwizzled = true;
}
if (nsCocoaFeatures::OnYosemiteOrLater()) {
// Explicitly turn off CGEvent logging. This works around bug 1092855.
// If there are already CGEvents in the log, turning off logging also
// causes those events to be written to disk. But at this point no
// CGEvents have yet been processed. CGEvents are events (usually
// input events) pulled from the WindowServer. An option of 0x80000008
// turns on CGEvent logging.
CGSSetDebugOptions(0x80000007);
}
[localPool release];
return rv;