зеркало из https://github.com/mozilla/gecko-dev.git
Bug 722012 - Added a call to XInitThreads before the first call to XOpenDisplay to fix OMTC crashes. r=karlt
--HG-- rename : toolkit/mozapps/update/test/chrome/test_0093_stagedBackground.xul => toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul rename : toolkit/mozapps/update/test/unit/test_0113_general.js => toolkit/mozapps/update/test/unit/test_0110_general.js rename : toolkit/mozapps/update/test/unit/test_0114_general.js => toolkit/mozapps/update/test/unit/test_0111_general.js rename : toolkit/mozapps/update/test/unit/test_0115_general.js => toolkit/mozapps/update/test/unit/test_0112_general.js rename : toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js => toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js rename : toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js extra : rebase_source : f527614c4a5f0b8979bd8bc39dcd3ca739ba9e08
This commit is contained in:
Родитель
3083802b10
Коммит
a9d6f40fba
|
@ -3434,7 +3434,13 @@ pref("layers.acceleration.force-enabled", false);
|
|||
|
||||
pref("layers.acceleration.draw-fps", false);
|
||||
|
||||
// An environment variable (MOZ_USE_OMTC)is used instead of a pref on X11
|
||||
// platforms because we start having access to prefs long after the first
|
||||
// call to XOpenDisplay which is hard to change due to interdependencies
|
||||
// in the initialization (see bug 722012 for more details).
|
||||
#ifndef MOZ_X11
|
||||
pref("layers.offmainthreadcomposition.enabled", false);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
|
|
|
@ -3267,7 +3267,18 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
|||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// Init X11 in thread-safe mode. Must be called prior to the first call to XOpenDisplay
|
||||
// (called inside gdk_display_open). This is a requirement for off main tread compositing.
|
||||
// This is done only on X11 platforms if the environment variable MOZ_USE_OMTC is set so
|
||||
// as to avoid overhead when omtc is not used.
|
||||
// An environment variable is used instead of a pref on X11 platforms because we start having
|
||||
// access to prefs long after the first call to XOpenDisplay which is hard to change due to
|
||||
// interdependencies in the initialization.
|
||||
if (PR_GetEnv("MOZ_USE_OMTC")) {
|
||||
XInitThreads();
|
||||
}
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
mGdkDisplay = gdk_display_open(display_name);
|
||||
if (!mGdkDisplay) {
|
||||
|
|
|
@ -692,8 +692,7 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
|
|||
return mLayerManager;
|
||||
}
|
||||
#ifdef MOZ_JAVA_COMPOSITOR
|
||||
bool useCompositor =
|
||||
Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
||||
bool useCompositor = UseOffMainThreadCompositing();
|
||||
|
||||
if (useCompositor) {
|
||||
CreateCompositor();
|
||||
|
|
|
@ -128,7 +128,7 @@ nsWindow::nsWindow()
|
|||
NS_RUNTIMEABORT("Failed to create framebufferWatcherThread, aborting...");
|
||||
}
|
||||
|
||||
sUsingOMTC = Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
||||
sUsingOMTC = UseOffMainThreadCompositing();
|
||||
|
||||
// We (apparently) don't have a way to tell if allocating the
|
||||
// fbs succeeded or failed.
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIGfxInfo.h"
|
||||
#include "npapi.h"
|
||||
#include "base/thread.h"
|
||||
#include "prenv.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsIObserver.h"
|
||||
|
@ -38,6 +39,9 @@ static bool debug_InSecureKeyboardInputMode = false;
|
|||
static PRInt32 gNumWidgets;
|
||||
#endif
|
||||
|
||||
static void InitOnlyOnce();
|
||||
static bool sUseOffMainThreadCompositing = false;
|
||||
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla;
|
||||
using base::Thread;
|
||||
|
@ -100,8 +104,9 @@ nsBaseWidget::nsBaseWidget()
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
debug_RegisterPrefCallbacks();
|
||||
debug_RegisterPrefCallbacks();
|
||||
#endif
|
||||
InitOnlyOnce();
|
||||
}
|
||||
|
||||
|
||||
|
@ -889,6 +894,11 @@ void nsBaseWidget::CreateCompositor()
|
|||
}
|
||||
}
|
||||
|
||||
bool nsBaseWidget::UseOffMainThreadCompositing()
|
||||
{
|
||||
return sUseOffMainThreadCompositing;
|
||||
}
|
||||
|
||||
LayerManager* nsBaseWidget::GetLayerManager(PLayersChild* aShadowManager,
|
||||
LayersBackend aBackendHint,
|
||||
LayerManagerPersistence aPersistence,
|
||||
|
@ -901,9 +911,7 @@ LayerManager* nsBaseWidget::GetLayerManager(PLayersChild* aShadowManager,
|
|||
if (mUseAcceleratedRendering) {
|
||||
|
||||
// Try to use an async compositor first, if possible
|
||||
bool useCompositor =
|
||||
Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
||||
if (useCompositor) {
|
||||
if (UseOffMainThreadCompositing()) {
|
||||
// e10s uses the parameter to pass in the shadow manager from the TabChild
|
||||
// so we don't expect to see it there since this doesn't support e10s.
|
||||
NS_ASSERTION(aShadowManager == nsnull, "Async Compositor not supported with e10s");
|
||||
|
@ -1303,6 +1311,25 @@ nsBaseWidget::GetGLFrameBufferFormat()
|
|||
return LOCAL_GL_NONE;
|
||||
}
|
||||
|
||||
static void InitOnlyOnce()
|
||||
{
|
||||
static bool once = true;
|
||||
if (!once) {
|
||||
return;
|
||||
}
|
||||
once = false;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// On X11 platforms only use OMTC if firefox was initalized with thread-safe
|
||||
// X11 (else it would crash).
|
||||
sUseOffMainThreadCompositing = (PR_GetEnv("MOZ_USE_OMTC") != NULL);
|
||||
#else
|
||||
sUseOffMainThreadCompositing = mozilla::Preferences::GetBool(
|
||||
"layers.offmainthreadcomposition.enabled",
|
||||
false);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
|
||||
nsWindowType GetWindowType() { return mWindowType; }
|
||||
|
||||
static bool UseOffMainThreadCompositing();
|
||||
protected:
|
||||
|
||||
virtual void ResolveIconName(const nsAString &aIconName,
|
||||
|
|
Загрузка…
Ссылка в новой задаче