Bug 1390386 - IsCurrent should understand mImplicitMakeCurrent. - r=jrmuizel
☠☠ backed out by fdbcfc9b7987 ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 11 Aug 2017 13:54:40 -0700
changeset 375410 ed6857bdc17b39575b57504a472d02704b6b836f
parent 375409 1314405cf812ecb8757a1e0d9ce632d042c3916d
child 375411 3364e65897318d1324c9772222811173e802501d
push id93901
push userjgilbert@mozilla.com
push dateThu, 17 Aug 2017 23:18:03 +0000
treeherdermozilla-inbound@22b11f9aedd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1390386
milestone57.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
Bug 1390386 - IsCurrent should understand mImplicitMakeCurrent. - r=jrmuizel MozReview-Commit-ID: 7vMRUPMc3nN
gfx/gl/GLContext.h
gfx/gl/GLContextCGL.h
gfx/gl/GLContextEAGL.h
gfx/gl/GLContextEGL.h
gfx/gl/GLContextGLX.h
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEAGL.mm
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLContextProviderGLX.cpp
gfx/gl/GLContextProviderWGL.cpp
gfx/gl/GLContextWGL.h
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -294,17 +294,24 @@ public:
      * If this context is double-buffered, returns TRUE.
      */
     virtual bool IsDoubleBuffered() const {
         return false;
     }
 
     virtual GLContextType GetContextType() const = 0;
 
-    virtual bool IsCurrent() const = 0;
+    bool IsCurrent() const {
+        if (mImplicitMakeCurrent)
+            return MakeCurrent();
+
+        return IsCurrentImpl();
+    }
+
+    virtual bool IsCurrentImpl() const = 0;
 
     /**
      * Get the default framebuffer for this context.
      */
     virtual GLuint GetDefaultFramebuffer() {
         return 0;
     }
 
--- a/gfx/gl/GLContextCGL.h
+++ b/gfx/gl/GLContextCGL.h
@@ -42,17 +42,17 @@ public:
 
     bool Init() override;
 
     NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
     CGLContextObj GetCGLContext() const;
 
     virtual bool MakeCurrentImpl(bool aForce) const override;
 
-    virtual bool IsCurrent() const override;
+    virtual bool IsCurrentImpl() const override;
 
     virtual GLenum GetPreferredARGB32Format() const override;
 
     virtual bool SetupLookupFunction() override;
 
     virtual bool IsDoubleBuffered() const override;
 
     virtual bool SwapBuffers() override;
--- a/gfx/gl/GLContextEAGL.h
+++ b/gfx/gl/GLContextEAGL.h
@@ -40,17 +40,17 @@ public:
     bool Init() override;
 
     bool AttachToWindow(nsIWidget* aWidget);
 
     EAGLContext* GetEAGLContext() const { return mContext; }
 
     virtual bool MakeCurrentImpl(bool aForce) const override;
 
-    virtual bool IsCurrent() const override;
+    virtual bool IsCurrentImpl() const override;
 
     virtual bool SetupLookupFunction() override;
 
     virtual bool IsDoubleBuffered() const override;
 
     virtual bool SwapBuffers() override;
 
     virtual void GetWSIInfo(nsCString* const out) const override;
--- a/gfx/gl/GLContextEGL.h
+++ b/gfx/gl/GLContextEGL.h
@@ -70,17 +70,17 @@ public:
 
     void SetEGLSurfaceOverride(EGLSurface surf);
     EGLSurface GetEGLSurfaceOverride() {
         return mSurfaceOverride;
     }
 
     virtual bool MakeCurrentImpl(bool aForce) const override;
 
-    virtual bool IsCurrent() const override;
+    virtual bool IsCurrentImpl() const override;
 
     virtual bool RenewSurface(widget::CompositorWidget* aWidget) override;
 
     virtual void ReleaseSurface() override;
 
     virtual bool SetupLookupFunction() override;
 
     virtual bool SwapBuffers() override;
--- a/gfx/gl/GLContextGLX.h
+++ b/gfx/gl/GLContextGLX.h
@@ -43,17 +43,17 @@ public:
         MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX);
         return static_cast<GLContextGLX*>(gl);
     }
 
     bool Init() override;
 
     virtual bool MakeCurrentImpl(bool aForce) const override;
 
-    virtual bool IsCurrent() const override;
+    virtual bool IsCurrentImpl() const override;
 
     virtual bool SetupLookupFunction() override;
 
     virtual bool IsDoubleBuffered() const override;
 
     virtual bool SwapBuffers() override;
 
     virtual void GetWSIInfo(nsCString* const out) const override;
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -127,17 +127,17 @@ GLContextCGL::MakeCurrentImpl(bool aForc
         // glSwapBuffers, which will happen when swapInt==0.
         GLint swapInt = gfxPrefs::LayoutFrameRate() == 0 ? 0 : 1;
         [mContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
     }
     return true;
 }
 
 bool
-GLContextCGL::IsCurrent() const
+GLContextCGL::IsCurrentImpl() const
 {
     return [NSOpenGLContext currentContext] == mContext;
 }
 
 GLenum
 GLContextCGL::GetPreferredARGB32Format() const
 {
     return LOCAL_GL_BGRA;
--- a/gfx/gl/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -123,17 +123,17 @@ GLContextEAGL::MakeCurrentImpl(bool aFor
         if(![EAGLContext setCurrentContext:mContext]) {
             return false;
         }
     }
     return true;
 }
 
 bool
-GLContextEAGL::IsCurrent() const
+GLContextEAGL::IsCurrentImpl() const
 {
     return [EAGLContext currentContext] == mContext;
 }
 
 bool
 GLContextEAGL::SetupLookupFunction()
 {
     return false;
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -370,17 +370,17 @@ GLContextEGL::MakeCurrentImpl(bool aForc
             }
         }
     }
 
     return succeeded;
 }
 
 bool
-GLContextEGL::IsCurrent() const
+GLContextEGL::IsCurrentImpl() const
 {
     return sEGLLibrary.fGetCurrentContext() == mContext;
 }
 
 bool
 GLContextEGL::RenewSurface(CompositorWidget* aWidget) {
     if (!mOwnsContext) {
         return false;
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -634,17 +634,17 @@ GLContextGLX::MakeCurrentImpl(bool aForc
             mGLX->fSwapInterval(mDisplay, mDrawable, isASAP ? 0 : 1);
         }
     }
 
     return succeeded;
 }
 
 bool
-GLContextGLX::IsCurrent() const
+GLContextGLX::IsCurrentImpl() const
 {
     return mGLX->fGetCurrentContext() == mContext;
 }
 
 bool
 GLContextGLX::SetupLookupFunction()
 {
     mLookupFunc = (PlatformLookupFunction)sGLXLibrary.GetGetProcAddress();
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -335,17 +335,17 @@ GLContextWGL::MakeCurrentImpl(bool aForc
         succeeded = sWGLLib.mSymbols.fMakeCurrent(mDC, mContext);
         NS_ASSERTION(succeeded, "Failed to make GL context current!");
     }
 
     return succeeded;
 }
 
 bool
-GLContextWGL::IsCurrent() const
+GLContextWGL::IsCurrentImpl() const
 {
     return sWGLLib.mSymbols.fGetCurrentContext() == mContext;
 }
 
 void
 GLContextWGL::SetIsDoubleBuffered(bool aIsDB)
 {
     mIsDoubleBuffered = aIsDB;
--- a/gfx/gl/GLContextWGL.h
+++ b/gfx/gl/GLContextWGL.h
@@ -42,17 +42,17 @@ public:
         MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
         return static_cast<GLContextWGL*>(gl);
     }
 
     bool Init() override;
 
     virtual bool MakeCurrentImpl(bool aForce) const override;
 
-    virtual bool IsCurrent() const override;
+    virtual bool IsCurrentImpl() const override;
 
     void SetIsDoubleBuffered(bool aIsDB);
 
     virtual bool IsDoubleBuffered() const override;
 
     virtual bool SwapBuffers() override;
 
     virtual bool SetupLookupFunction() override;