Bug 1482974 - Prefer to initialize members at declaration in gfx/gl. r=jrmuizel
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 17 Aug 2018 22:21:26 +0000
changeset 432261 176dcc5da6fe5f0596a32015e710054b03da88ce
parent 432260 dc054d9df7a50d89f3db27fa8f951232fcbd5c73
child 432262 b42785b1186cb24c42e6e8fb56342fbe40867b07
push id106678
push userncsoregi@mozilla.com
push dateSat, 18 Aug 2018 09:53:05 +0000
treeherdermozilla-inbound@cbbc0e765e5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1482974
milestone63.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 1482974 - Prefer to initialize members at declaration in gfx/gl. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D3240
gfx/gl/GLBlitHelper.cpp
gfx/gl/GLBlitHelper.h
gfx/gl/GLContext.cpp
gfx/gl/GLContext.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
gfx/gl/GLLibraryEGL.h
gfx/gl/GLXLibrary.h
gfx/gl/SharedSurface.cpp
gfx/gl/SharedSurface.h
gfx/gl/WGLLibrary.h
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -372,17 +372,16 @@ public:
 
 DrawBlitProg::DrawBlitProg(const GLBlitHelper* const parent, const GLuint prog)
     : mParent(*parent)
     , mProg(prog)
     , mLoc_uDestMatrix(mParent.mGL->fGetUniformLocation(mProg, "uDestMatrix"))
     , mLoc_uTexMatrix0(mParent.mGL->fGetUniformLocation(mProg, "uTexMatrix0"))
     , mLoc_uTexMatrix1(mParent.mGL->fGetUniformLocation(mProg, "uTexMatrix1"))
     , mLoc_uColorMatrix(mParent.mGL->fGetUniformLocation(mProg, "uColorMatrix"))
-    , mType_uColorMatrix(0)
 {
     MOZ_ASSERT(mLoc_uDestMatrix != -1);
     MOZ_ASSERT(mLoc_uTexMatrix0 != -1);
     if (mLoc_uColorMatrix != -1) {
         MOZ_ASSERT(mLoc_uTexMatrix1 != -1);
 
         const auto& gl = mParent.mGL;
         int32_t numActiveUniforms = 0;
@@ -508,22 +507,19 @@ DrawBlitProg::Draw(const BaseArgs& args,
                                  vaa0Pointer);
     }
 }
 
 // --
 
 GLBlitHelper::GLBlitHelper(GLContext* const gl)
     : mGL(gl)
-    , mQuadVAO(0)
-    , mQuadVBO(0)
     , mDrawBlitProg_VertShader(mGL->fCreateShader(LOCAL_GL_VERTEX_SHADER))
-    , mYuvUploads{0}
-    , mYuvUploads_YSize(0, 0)
-    , mYuvUploads_UVSize(0, 0)
+    //, mYuvUploads_YSize(0, 0)
+    //, mYuvUploads_UVSize(0, 0)
 {
     mGL->fGenBuffers(1, &mQuadVBO);
     {
         const ScopedBindArrayBuffer bindVBO(mGL, mQuadVBO);
 
         const float quadData[] = {
             0, 0,
             1, 0,
--- a/gfx/gl/GLBlitHelper.h
+++ b/gfx/gl/GLBlitHelper.h
@@ -66,17 +66,17 @@ Mat3 SubRectMat3(const gfx::IntRect& big
 class DrawBlitProg final
 {
     const GLBlitHelper& mParent;
     const GLuint mProg;
     const GLint mLoc_uDestMatrix;
     const GLint mLoc_uTexMatrix0;
     const GLint mLoc_uTexMatrix1;
     const GLint mLoc_uColorMatrix;
-    GLenum mType_uColorMatrix;
+    GLenum mType_uColorMatrix = 0;
 
 public:
     struct Key final {
         const char* const fragHeader;
         const char* const fragBody;
 
         bool operator <(const Key& x) const {
             if (fragHeader != x.fragHeader)
@@ -121,24 +121,24 @@ class GLBlitHelper final
 {
     friend class BindAnglePlanes;
     friend class DrawBlitProg;
     friend class GLContext;
 
     GLContext* const mGL;
     mutable std::map<DrawBlitProg::Key, const DrawBlitProg*> mDrawBlitProgs;
 
-    GLuint mQuadVAO;
-    GLuint mQuadVBO;
+    GLuint mQuadVAO = 0;
+    GLuint mQuadVBO = 0;
     nsCString mDrawBlitProg_VersionLine;
     const GLuint mDrawBlitProg_VertShader;
 
-    GLuint mYuvUploads[3];
-    gfx::IntSize mYuvUploads_YSize;
-    gfx::IntSize mYuvUploads_UVSize;
+    GLuint mYuvUploads[3] = {};
+    gfx::IntSize mYuvUploads_YSize = {0,0};
+    gfx::IntSize mYuvUploads_UVSize = {0,0};
 
 #ifdef XP_WIN
     mutable RefPtr<ID3D11Device> mD3D11;
 
     ID3D11Device* GetD3D11() const;
 #endif
 
     const DrawBlitProg* GetDrawBlitProg(const DrawBlitProg::Key& key) const;
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -259,47 +259,22 @@ GLContext::ChooseDebugFlags(const Create
     }
 #endif
 
     return debugFlags;
 }
 
 GLContext::GLContext(CreateContextFlags flags, const SurfaceCaps& caps,
                      GLContext* sharedContext, bool isOffscreen, bool useTLSIsCurrent)
-  : mImplicitMakeCurrent(false),
-    mUseTLSIsCurrent(ShouldUseTLSIsCurrent(useTLSIsCurrent)),
+  : mUseTLSIsCurrent(ShouldUseTLSIsCurrent(useTLSIsCurrent)),
     mIsOffscreen(isOffscreen),
-    mContextLost(false),
-    mVersion(0),
-    mProfile(ContextProfile::Unknown),
-    mShadingLanguageVersion(0),
-    mVendor(GLVendor::Other),
-    mRenderer(GLRenderer::Other),
-    mTopError(LOCAL_GL_NO_ERROR),
     mDebugFlags(ChooseDebugFlags(flags)),
     mSharedContext(sharedContext),
-    mSymbols{},
-    mCaps(caps),
-    mScreen(nullptr),
-    mLockedSurface(nullptr),
-    mMaxTextureSize(0),
-    mMaxCubeMapTextureSize(0),
-    mMaxTextureImageSize(0),
-    mMaxRenderbufferSize(0),
-    mMaxSamples(0),
-    mNeedsTextureSizeChecks(false),
-    mNeedsFlushBeforeDeleteFB(false),
-    mTextureAllocCrashesOnMapFailure(false),
-    mNeedsCheckAfterAttachTextureToFb(false),
-    mWorkAroundDriverBugs(true),
-    mSyncGLCallCount(0),
-    mHeavyGLCallsSinceLastFlush(false)
+    mCaps(caps)
 {
-    mMaxViewportDims[0] = 0;
-    mMaxViewportDims[1] = 0;
     mOwningThreadId = PlatformThread::CurrentId();
     MOZ_ALWAYS_TRUE( sCurrentContext.init() );
     sCurrentContext.set(0);
 }
 
 GLContext::~GLContext() {
     NS_ASSERTION(IsDestroyed(), "GLContext implementation must call MarkDestroyed in destructor!");
 #ifdef MOZ_GL_DEBUG
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -193,17 +193,17 @@ class GLContext
     : public GLLibraryLoader
     , public GenericAtomicRefCounted
     , public SupportsWeakPtr<GLContext>
 {
 public:
     MOZ_DECLARE_WEAKREFERENCE_TYPENAME(GLContext)
     static MOZ_THREAD_LOCAL(uintptr_t) sCurrentContext;
 
-    bool mImplicitMakeCurrent;
+    bool mImplicitMakeCurrent = false;
     bool mUseTLSIsCurrent;
 
     class TlsScope final {
         const WeakPtr<GLContext> mGL;
         const bool mWasTlsOk;
     public:
         explicit TlsScope(GLContext* const gl)
             : mGL(gl)
@@ -333,29 +333,29 @@ public:
      * Get the default framebuffer for this context.
      */
     virtual GLuint GetDefaultFramebuffer() {
         return 0;
     }
 
 protected:
     bool mIsOffscreen;
-    mutable bool mContextLost;
+    mutable bool mContextLost = false;
 
     /**
      * mVersion store the OpenGL's version, multiplied by 100. For example, if
      * the context is an OpenGL 2.1 context, mVersion value will be 210.
      */
-    uint32_t mVersion;
-    ContextProfile mProfile;
-
-    uint32_t mShadingLanguageVersion;
-
-    GLVendor mVendor;
-    GLRenderer mRenderer;
+    uint32_t mVersion = 0;
+    ContextProfile mProfile = ContextProfile::Unknown;
+
+    uint32_t mShadingLanguageVersion = 0;
+
+    GLVendor mVendor = GLVendor::Other;
+    GLRenderer mRenderer = GLRenderer::Other;
 
 // -----------------------------------------------------------------------------
 // Extensions management
 /**
  * This mechanism is designed to know if an extension is supported. In the long
  * term, we would like to only use the extension group queries XXX_* to have
  * full compatibility with context version and profiles (especialy the core that
  * officialy don't bring any extensions).
@@ -566,17 +566,17 @@ public:
             case LOCAL_GL_INVALID_FRAMEBUFFER_OPERATION:
                 return "GL_INVALID_FRAMEBUFFER_OPERATION";
             default:
                 return "";
         }
     }
 
 private:
-    mutable GLenum mTopError;
+    mutable GLenum mTopError = 0;
 
     GLenum RawGetError() const {
         return mSymbols.fGetError();
     }
 
     GLenum RawGetErrorAndClear() const {
         GLenum err = RawGetError();
 
@@ -3496,17 +3496,17 @@ public:
     static uint8_t ChooseDebugFlags(CreateContextFlags createFlags);
 
 protected:
     RefPtr<GLContext> mSharedContext;
 
     // The thread id which this context was created.
     PlatformThreadId mOwningThreadId;
 
-    GLContextSymbols mSymbols;
+    GLContextSymbols mSymbols = {};
 
     UniquePtr<GLBlitHelper> mBlitHelper;
     UniquePtr<GLReadTexImageHelper> mReadTexImageHelper;
 
 public:
     GLBlitHelper* BlitHelper();
     GLBlitTextureImageHelper* BlitTextureImageHelper();
     GLReadTexImageHelper* ReadTexImageHelper();
@@ -3569,17 +3569,17 @@ public:
                               const GLuint texture,
                               GLuint* drawFB,
                               GLuint* readFB);
 
 protected:
     friend class GLScreenBuffer;
     UniquePtr<GLScreenBuffer> mScreen;
 
-    SharedSurface* mLockedSurface;
+    SharedSurface* mLockedSurface = nullptr;
 
 public:
     void LockSurface(SharedSurface* surf) {
         MOZ_ASSERT(!mLockedSurface);
         mLockedSurface = surf;
     }
 
     void UnlockSurface(SharedSurface* surf) {
@@ -3614,32 +3614,32 @@ private:
     bool LoadExtSymbols(const char* prefix, bool trygl, const SymLoadStruct* list,
                         GLExtensions ext);
     bool LoadFeatureSymbols(const char* prefix, bool trygl, const SymLoadStruct* list,
                             GLFeature feature);
 
 protected:
     void InitExtensions();
 
-    GLint mViewportRect[4];
-    GLint mScissorRect[4];
+    GLint mViewportRect[4] = {};
+    GLint mScissorRect[4] = {};
 
     uint32_t mMaxTexOrRbSize = 0;
-    GLint mMaxTextureSize;
-    GLint mMaxCubeMapTextureSize;
-    GLint mMaxTextureImageSize;
-    GLint mMaxRenderbufferSize;
-    GLint mMaxViewportDims[2];
-    GLsizei mMaxSamples;
-    bool mNeedsTextureSizeChecks;
-    bool mNeedsFlushBeforeDeleteFB;
-    bool mTextureAllocCrashesOnMapFailure;
-    bool mNeedsCheckAfterAttachTextureToFb;
-    bool mWorkAroundDriverBugs;
-    mutable uint64_t mSyncGLCallCount;
+    GLint mMaxTextureSize = 0;
+    GLint mMaxCubeMapTextureSize = 0;
+    GLint mMaxTextureImageSize = 0;
+    GLint mMaxRenderbufferSize = 0;
+    GLint mMaxViewportDims[2] = {};
+    GLsizei mMaxSamples = 0;
+    bool mNeedsTextureSizeChecks = false;
+    bool mNeedsFlushBeforeDeleteFB = false;
+    bool mTextureAllocCrashesOnMapFailure = false;
+    bool mNeedsCheckAfterAttachTextureToFb = false;
+    bool mWorkAroundDriverBugs = true;
+    mutable uint64_t mSyncGLCallCount = 0;
 
     bool IsTextureSizeSafeToPassToDriver(GLenum target, GLsizei width, GLsizei height) const {
         if (mNeedsTextureSizeChecks) {
             // some drivers incorrectly handle some large texture sizes that are below the
             // max texture size that they report. So we check ourselves against our own values
             // (mMax[CubeMap]TextureSize).
             // see bug 737182 for Mac Intel 2D textures
             // see bug 684882 for Mac Intel cube map textures
@@ -3713,17 +3713,17 @@ public:
     nsTArray<NamedResource> mTrackedFramebuffers;
     nsTArray<NamedResource> mTrackedRenderbuffers;
     nsTArray<NamedResource> mTrackedBuffers;
     nsTArray<NamedResource> mTrackedQueries;
 #endif
 
 
 protected:
-    bool mHeavyGLCallsSinceLastFlush;
+    bool mHeavyGLCallsSinceLastFlush = false;
 
 public:
     void FlushIfHeavyGLCallsSinceLastFlush();
     static bool ShouldSpew();
     static bool ShouldDumpExts();
     bool Readback(SharedSurface* src, gfx::DataSourceSurface* dest);
 
     // --
--- a/gfx/gl/GLContextEAGL.h
+++ b/gfx/gl/GLContextEAGL.h
@@ -60,20 +60,20 @@ public:
     }
 
     virtual bool RenewSurface(nsIWidget* aWidget) override {
         // FIXME: should use the passed widget instead of the existing one.
         return RecreateRB();
     }
 
 private:
-    GLuint mBackbufferRB;
-    GLuint mBackbufferFB;
+    GLuint mBackbufferRB = 0;
+    GLuint mBackbufferFB = 0;
 
-    void* mLayer;
+    void* mLayer = nullptr;
 
     bool RecreateRB();
 };
 
 } // namespace gl
 } // namespace mozilla
 
 #endif // GLCONTEXTEAGL_H_
--- a/gfx/gl/GLContextEGL.h
+++ b/gfx/gl/GLContextEGL.h
@@ -119,25 +119,25 @@ public:
     const EGLConfig mConfig;
 protected:
     const RefPtr<GLLibraryEGL> mEgl;
     EGLSurface mSurface;
     const EGLSurface mFallbackSurface;
 public:
     const EGLContext mContext;
 protected:
-    EGLSurface mSurfaceOverride;
+    EGLSurface mSurfaceOverride = EGL_NO_SURFACE;
     RefPtr<gfxASurface> mThebesSurface;
-    bool mBound;
+    bool mBound = false;
 
-    bool mIsPBuffer;
-    bool mIsDoubleBuffered;
-    bool mCanBindToTexture;
-    bool mShareWithEGLImage;
-    bool mOwnsContext;
+    bool mIsPBuffer = false;
+    bool mIsDoubleBuffered = false;
+    bool mCanBindToTexture = false;
+    bool mShareWithEGLImage = false;
+    bool mOwnsContext = true;
 
     static EGLSurface CreatePBufferSurfaceTryingPowerOfTwo(EGLConfig config,
                                                            EGLenum bindToTextureFormat,
                                                            gfx::IntSize& pbsize);
 #if defined(MOZ_WAYLAND)
     static EGLSurface CreateWaylandBufferSurface(EGLConfig config,
                                                  gfx::IntSize& pbsize);
 #endif
--- a/gfx/gl/GLContextGLX.h
+++ b/gfx/gl/GLContextGLX.h
@@ -88,15 +88,15 @@ private:
     Display* mDisplay;
     GLXDrawable mDrawable;
     bool mDeleteDrawable;
     bool mDoubleBuffered;
 
     GLXLibrary* mGLX;
 
     RefPtr<gfxXlibSurface> mPixmap;
-    bool mOwnsContext;
+    bool mOwnsContext = true;
 };
 
 }
 }
 
 #endif // GLCONTEXTGLX_H_
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -26,22 +26,16 @@ namespace mozilla {
 namespace gl {
 
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
 
 class CGLLibrary
 {
 public:
-    CGLLibrary()
-        : mInitialized(false)
-        , mUseDoubleBufferedWindows(true)
-        , mOGLLibrary(nullptr)
-    {}
-
     bool EnsureInitialized()
     {
         if (mInitialized) {
             return true;
         }
         if (!mOGLLibrary) {
             mOGLLibrary = PR_LoadLibrary("/System/Library/Frameworks/OpenGL.framework/OpenGL");
             if (!mOGLLibrary) {
@@ -60,19 +54,19 @@ public:
     }
 
     bool UseDoubleBufferedWindows() const {
         MOZ_ASSERT(mInitialized);
         return mUseDoubleBufferedWindows;
     }
 
 private:
-    bool mInitialized;
-    bool mUseDoubleBufferedWindows;
-    PRLibrary* mOGLLibrary;
+    bool mInitialized = false;
+    bool mUseDoubleBufferedWindows = true;
+    PRLibrary* mOGLLibrary = nullptr;
 };
 
 CGLLibrary sCGLLibrary;
 
 GLContextCGL::GLContextCGL(CreateContextFlags flags, const SurfaceCaps& caps,
                            NSOpenGLContext* context, bool isOffscreen)
     : GLContext(flags, caps, nullptr, isOffscreen)
     , mContext(context)
--- a/gfx/gl/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -22,19 +22,16 @@ namespace gl {
 
 using namespace mozilla::widget;
 
 GLContextEAGL::GLContextEAGL(CreateContextFlags flags, const SurfaceCaps& caps,
                              EAGLContext* context, GLContext* sharedContext,
                              bool isOffscreen)
     : GLContext(flags, caps, sharedContext, isOffscreen)
     , mContext(context)
-    , mBackbufferRB(0)
-    , mBackbufferFB(0)
-    , mLayer(nil)
 {
 }
 
 GLContextEAGL::~GLContextEAGL()
 {
     MakeCurrent();
 
     if (mBackbufferFB) {
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -301,24 +301,16 @@ GLContextEGL::GLContextEGL(CreateContext
                            bool isOffscreen, EGLConfig config, EGLSurface surface,
                            EGLContext context)
     : GLContext(flags, caps, nullptr, isOffscreen, false)
     , mConfig(config)
     , mEgl(gl::GLLibraryEGL::Get())
     , mSurface(surface)
     , mFallbackSurface(CreateFallbackSurface(config))
     , mContext(context)
-    , mSurfaceOverride(EGL_NO_SURFACE)
-    , mThebesSurface(nullptr)
-    , mBound(false)
-    , mIsPBuffer(false)
-    , mIsDoubleBuffered(false)
-    , mCanBindToTexture(false)
-    , mShareWithEGLImage(false)
-    , mOwnsContext(true)
 {
 #ifdef DEBUG
     printf_stderr("Initializing context %p surface %p on display %p\n", mContext, mSurface, EGL_DISPLAY());
 #endif
 }
 
 GLContextEGL::~GLContextEGL()
 {
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -707,18 +707,17 @@ GLContextGLX::GLContextGLX(
                   gfxXlibSurface* aPixmap)
     : GLContext(flags, caps, nullptr, isOffscreen),
       mContext(aContext),
       mDisplay(aDisplay),
       mDrawable(aDrawable),
       mDeleteDrawable(aDeleteDrawable),
       mDoubleBuffered(aDoubleBuffered),
       mGLX(&sGLXLibrary),
-      mPixmap(aPixmap),
-      mOwnsContext(true)
+      mPixmap(aPixmap)
 {
 }
 
 static bool
 AreCompatibleVisuals(Visual* one, Visual* two)
 {
     if (one->c_class != two->c_class) {
         return false;
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -275,31 +275,29 @@ WGLLibrary::Reset()
 
 GLContextWGL::GLContextWGL(CreateContextFlags flags, const SurfaceCaps& caps,
                            bool isOffscreen, HDC aDC, HGLRC aContext, HWND aWindow)
     : GLContext(flags, caps, nullptr, isOffscreen),
       mDC(aDC),
       mContext(aContext),
       mWnd(aWindow),
       mPBuffer(nullptr),
-      mPixelFormat(0),
-      mIsDoubleBuffered(false)
+      mPixelFormat(0)
 {
 }
 
 GLContextWGL::GLContextWGL(CreateContextFlags flags, const SurfaceCaps& caps,
                            bool isOffscreen, HANDLE aPbuffer, HDC aDC, HGLRC aContext,
                            int aPixelFormat)
     : GLContext(flags, caps, nullptr, isOffscreen),
       mDC(aDC),
       mContext(aContext),
       mWnd(nullptr),
       mPBuffer(aPbuffer),
-      mPixelFormat(aPixelFormat),
-      mIsDoubleBuffered(false)
+      mPixelFormat(aPixelFormat)
 {
 }
 
 GLContextWGL::~GLContextWGL()
 {
     MarkDestroyed();
 
     (void)sWGLLib.mSymbols.fDeleteContext(mContext);
--- a/gfx/gl/GLContextWGL.h
+++ b/gfx/gl/GLContextWGL.h
@@ -51,15 +51,15 @@ protected:
     friend class GLContextProviderWGL;
 
     HDC mDC;
     HGLRC mContext;
     HWND mWnd;
     HANDLE mPBuffer;
     int mPixelFormat;
 public:
-    bool mIsDoubleBuffered;
+    bool mIsDoubleBuffered = false;
 };
 
 }
 }
 
 #endif // GLCONTEXTWGL_H_
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -53,30 +53,21 @@ namespace gl {
 class GLContext;
 
 void BeforeEGLCall(const char* funcName);
 void AfterEGLCall(const char* funcName);
 
 class GLLibraryEGL
 {
 protected:
-  ~GLLibraryEGL() {}
+    ~GLLibraryEGL() {}
 
 public:
     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GLLibraryEGL)
 
-    GLLibraryEGL()
-        : mSymbols{nullptr}
-        , mInitialized(false)
-        , mEGLLibrary(nullptr)
-        , mEGLDisplay(EGL_NO_DISPLAY)
-        , mIsANGLE(false)
-        , mIsWARP(false)
-    { }
-
     void InitClientExtensions();
     void InitDisplayExtensions();
 
     /**
      * Known GL extensions that can be queried by
      * IsExtensionSupported.  The results of this are cached, and as
      * such it's safe to use this even in performance critical code.
      * If you add to this array, remember to add to the string names
@@ -493,31 +484,31 @@ private:
                                                              void* texture,
                                                              const EGLAttrib* attrib_list);
         // ANGLE_device_creation
         EGLDeviceEXT (GLAPIENTRY * fCreateDeviceANGLE) (EGLint device_type,
                                                         void* native_device,
                                                         const EGLAttrib* attrib_list);
         EGLBoolean (GLAPIENTRY * fReleaseDeviceANGLE) (EGLDeviceEXT device);
 
-    } mSymbols;
+    } mSymbols = {};
 
 private:
     bool DoEnsureInitialized(bool forceAccel, nsACString* const out_failureId);
     EGLDisplay CreateDisplay(bool forceAccel,
                              const nsCOMPtr<nsIGfxInfo>& gfxInfo,
                              nsACString* const out_failureId);
 
-    bool mInitialized;
-    PRLibrary* mEGLLibrary;
-    EGLDisplay mEGLDisplay;
+    bool mInitialized = false;
+    PRLibrary* mEGLLibrary = nullptr;
+    EGLDisplay mEGLDisplay = EGL_NO_DISPLAY;
     RefPtr<GLContext> mReadbackGL;
 
-    bool mIsANGLE;
-    bool mIsWARP;
+    bool mIsANGLE = false;
+    bool mIsWARP = false;
     static StaticMutex sMutex;
     static StaticRefPtr<GLLibraryEGL> sEGLLibrary;
 };
 
 #define EGL_DISPLAY()        GLLibraryEGL::Get()->Display()
 
 } /* namespace gl */
 } /* namespace mozilla */
--- a/gfx/gl/GLXLibrary.h
+++ b/gfx/gl/GLXLibrary.h
@@ -26,30 +26,16 @@ struct PRLibrary;
 class gfxASurface;
 
 namespace mozilla {
 namespace gl {
 
 class GLXLibrary
 {
 public:
-    GLXLibrary()
-        : mSymbols{nullptr}
-        , mInitialized(false)
-        , mTriedInitializing(false)
-        , mUseTextureFromPixmap(false)
-        , mDebug(false)
-        , mHasRobustness(false)
-        , mHasCreateContextAttribs(false)
-        , mHasVideoSync(false)
-        , mIsATI(false), mIsNVIDIA(false)
-        , mClientIsMesa(false)
-        , mOGLLibrary(nullptr)
-    {}
-
     bool EnsureInitialized();
 
 private:
     void BeforeGLXCall() const;
     void AfterGLXCall() const;
 
 public:
 
@@ -207,34 +193,34 @@ private:
                                                      const int*);
         void         (GLAPIENTRY *fReleaseTexImageEXT) (Display*, GLXDrawable, int);
         GLXContext   (GLAPIENTRY *fCreateContextAttribsARB) (Display*, GLXFBConfig,
                                                              GLXContext, Bool,
                                                              const int*);
         int          (GLAPIENTRY *fGetVideoSyncSGI) (unsigned int*);
         int          (GLAPIENTRY *fWaitVideoSyncSGI) (int, int, unsigned int*);
         void         (GLAPIENTRY *fSwapIntervalEXT) (Display*, GLXDrawable, int);
-    } mSymbols;
+    } mSymbols = {};
 
 #ifdef DEBUG
     void BeforeGLXCall();
     void AfterGLXCall();
 #endif
 
-    bool mInitialized;
-    bool mTriedInitializing;
-    bool mUseTextureFromPixmap;
-    bool mDebug;
-    bool mHasRobustness;
-    bool mHasCreateContextAttribs;
-    bool mHasVideoSync;
-    bool mIsATI;
-    bool mIsNVIDIA;
-    bool mClientIsMesa;
-    PRLibrary* mOGLLibrary;
+    bool mInitialized = false;
+    bool mTriedInitializing = false;
+    bool mUseTextureFromPixmap = false;
+    bool mDebug = false;
+    bool mHasRobustness = false;
+    bool mHasCreateContextAttribs = false;
+    bool mHasVideoSync = false;
+    bool mIsATI = false;
+    bool mIsNVIDIA = false;
+    bool mClientIsMesa = false;
+    PRLibrary* mOGLLibrary = nullptr;
 };
 
 // a global GLXLibrary instance
 extern GLXLibrary sGLXLibrary;
 
 } /* namespace gl */
 } /* namespace mozilla */
 #endif /* GFX_GLXLIBRARY_H */
--- a/gfx/gl/SharedSurface.cpp
+++ b/gfx/gl/SharedSurface.cpp
@@ -398,20 +398,16 @@ SurfaceFactory::Recycle(layers::SharedSu
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // ScopedReadbackFB
 
 ScopedReadbackFB::ScopedReadbackFB(SharedSurface* src)
     : mGL(src->mGL)
     , mAutoFB(mGL)
-    , mTempFB(0)
-    , mTempTex(0)
-    , mSurfToUnlock(nullptr)
-    , mSurfToLock(nullptr)
 {
     switch (src->mAttachType) {
     case AttachmentType::GLRenderbuffer:
         {
             mGL->fGenFramebuffers(1, &mTempFB);
             mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mTempFB);
 
             GLuint rb = src->ProdRenderbuffer();
--- a/gfx/gl/SharedSurface.h
+++ b/gfx/gl/SharedSurface.h
@@ -313,20 +313,20 @@ public:
     // Auto-deletes surfs of the wrong type.
     bool Recycle(layers::SharedSurfaceTextureClient* texClient);
 };
 
 class ScopedReadbackFB
 {
     GLContext* const mGL;
     ScopedBindFramebuffer mAutoFB;
-    GLuint mTempFB;
-    GLuint mTempTex;
-    SharedSurface* mSurfToUnlock;
-    SharedSurface* mSurfToLock;
+    GLuint mTempFB = 0;
+    GLuint mTempTex = 0;
+    SharedSurface* mSurfToUnlock = nullptr;
+    SharedSurface* mSurfToLock = nullptr;
 
 public:
     explicit ScopedReadbackFB(SharedSurface* src);
     ~ScopedReadbackFB();
 };
 
 bool ReadbackSharedSurface(SharedSurface* src, gfx::DrawTarget* dst);
 uint32_t ReadPixel(SharedSurface* src);
--- a/gfx/gl/WGLLibrary.h
+++ b/gfx/gl/WGLLibrary.h
@@ -34,20 +34,16 @@ struct PBufferDC final : public ScopedDC
 
     PBufferDC() = delete;
     ~PBufferDC();
 };
 */
 class WGLLibrary
 {
 public:
-    WGLLibrary()
-      : mSymbols{}
-    { }
-
     ~WGLLibrary() {
         Reset();
     }
 
 private:
     void Reset();
 
 public:
@@ -85,17 +81,17 @@ public:
                                                    GLuint name, GLenum type,
                                                    GLenum access);
         BOOL   (GLAPIENTRY * fDXUnregisterObjectNV) (HANDLE hDevice, HANDLE hObject);
         BOOL   (GLAPIENTRY * fDXObjectAccessNV) (HANDLE hObject, GLenum access);
         BOOL   (GLAPIENTRY * fDXLockObjectsNV) (HANDLE hDevice, GLint count,
                                                 HANDLE* hObjects);
         BOOL   (GLAPIENTRY * fDXUnlockObjectsNV) (HANDLE hDevice, GLint count,
                                                   HANDLE* hObjects);
-    } mSymbols;
+    } mSymbols = {};
 
     bool EnsureInitialized();
     //UniquePtr<WindowDC> CreateDummyWindow();
     HGLRC CreateContextWithFallback(HDC dc, bool tryRobustBuffers) const;
 
     bool HasDXInterop2() const { return bool(mSymbols.fDXOpenDeviceNV); }
     bool IsInitialized() const { return mInitialized; }
     auto GetOGLLibrary() const { return mOGLLibrary; }