author | Nathan Froyd <froydnj@mozilla.com> |
Wed, 26 Mar 2014 09:10:27 -0400 | |
changeset 177550 | 0eb9fb345a5b3230b15ccff4af74cacd71d2b801 |
parent 177549 | 72b4d4463629780dcf5733aea3bbce8fd8b64907 |
child 177551 | 5723793a54e02131e3da8edf4754c250bb68bf6a |
push id | 26556 |
push user | ryanvm@gmail.com |
push date | Tue, 08 Apr 2014 22:16:57 +0000 |
treeherder | mozilla-central@5811efc11011 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bjacob |
bugs | 989349 |
milestone | 31.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -10,16 +10,17 @@ #elif defined(MOZ_WIDGET_QT) #define GET_NATIVE_WINDOW(aWidget) (Window)(aWidget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW)) #endif #include <X11/Xlib.h> #include <X11/Xutil.h> #include "mozilla/MathAlgorithms.h" +#include "mozilla/StaticPtr.h" #include "mozilla/X11Util.h" #include "prenv.h" #include "GLContextProvider.h" #include "GLLibraryLoader.h" #include "nsDebug.h" #include "nsIWidget.h" #include "GLXLibrary.h" @@ -1183,34 +1184,38 @@ GLContextProviderGLX::CreateOffscreen(co return nullptr; if (!glContext->InitOffscreen(ToIntSize(size), caps)) return nullptr; return glContext.forget(); } -static nsRefPtr<GLContext> gGlobalContext; +static StaticRefPtr<GLContext> gGlobalContext; // TODO move that out of static initializaion static bool gUseContextSharing = getenv("MOZ_DISABLE_CONTEXT_SHARING_GLX") == 0; GLContext* GLContextProviderGLX::GetGlobalContext() { // TODO: get GLX context sharing to work well with multiple threads if (!gUseContextSharing) { return nullptr; } static bool triedToCreateContext = false; if (!triedToCreateContext && !gGlobalContext) { triedToCreateContext = true; gfxIntSize dummySize = gfxIntSize(16, 16); - gGlobalContext = CreateOffscreenPixmapContext(dummySize); + // StaticPtr doesn't support assignments from already_AddRefed, + // so use a temporary nsRefPtr to make the reference counting + // fall out correctly. + nsRefPtr<GLContext> holder = CreateOffscreenPixmapContext(dummySize); + gGlobalContext = holder; } return gGlobalContext; } void GLContextProviderGLX::Shutdown() {