Bug 1502278 - Merge WebGLContextUnchecked back into WebGLContext. r=kvark
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 26 Oct 2018 14:54:38 +0000
changeset 443218 6b177971812dd9f6ac4c99a599f64ab9ce9f8791
parent 443217 bc93ef323aa20d6ae6e4ef24a60267fb560344af
child 443219 279ffbe018451dbee5bec61403801f4265646be8
push id34944
push userncsoregi@mozilla.com
push dateSat, 27 Oct 2018 09:49:55 +0000
treeherdermozilla-central@49d47a692ca4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskvark
bugs1502278
milestone65.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 1502278 - Merge WebGLContextUnchecked back into WebGLContext. r=kvark Differential Revision: https://phabricator.services.mozilla.com/D9893
dom/canvas/WebGLContext.cpp
dom/canvas/WebGLContext.h
dom/canvas/WebGLContextUnchecked.cpp
dom/canvas/WebGLContextUnchecked.h
dom/canvas/moz.build
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -113,17 +113,17 @@ WebGLContextOptions::operator==(const We
     eq &= (antialias == r.antialias);
     eq &= (preserveDrawingBuffer == r.preserveDrawingBuffer);
     eq &= (failIfMajorPerformanceCaveat == r.failIfMajorPerformanceCaveat);
     eq &= (powerPreference == r.powerPreference);
     return eq;
 }
 
 WebGLContext::WebGLContext()
-    : WebGLContextUnchecked(nullptr)
+    : gl(mGL_OnlyClearInDestroyResourcesAndContext) // const reference
     , mMaxPerfWarnings(gfxPrefs::WebGLMaxPerfWarnings())
     , mNumPerfWarnings(0)
     , mMaxAcceptableFBStatusInvals(gfxPrefs::WebGLMaxAcceptableFBStatusInvals())
     , mDataAllocGLCallCount(0)
     , mBypassShaderValidation(false)
     , mEmptyTFO(0)
     , mContextLossHandler(this)
     , mNeedsFakeNoAlpha(false)
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -28,17 +28,16 @@
 #include "nsWrapperCache.h"
 #include "SurfaceTypes.h"
 #include "ScopedGLHelpers.h"
 #include "TexUnpackBlob.h"
 
 // Local
 #include "CacheInvalidator.h"
 #include "WebGLContextLossHandler.h"
-#include "WebGLContextUnchecked.h"
 #include "WebGLObjectModel.h"
 #include "WebGLStrongTypes.h"
 
 // Generated
 #include "nsIDOMEventListener.h"
 #include "nsICanvasRenderingContextInternal.h"
 #include "nsIObserver.h"
 #include "mozilla/dom/HTMLCanvasElement.h"
@@ -277,17 +276,16 @@ public:
 };
 } // namespace webgl
 
 ////////////////////////////////////////////////////////////////////////////////
 
 class WebGLContext
     : public nsICanvasRenderingContextInternal
     , public nsSupportsWeakReference
-    , public WebGLContextUnchecked
     , public nsWrapperCache
 {
     friend class ScopedDrawCallWrapper;
     friend class ScopedDrawWithTransformFeedback;
     friend class ScopedFakeVertexAttrib0;
     friend class ScopedFBRebinder;
     friend class WebGL2Context;
     friend class WebGLContextUserData;
@@ -322,16 +320,26 @@ class WebGLContext
         UNPACK_REQUIRE_FASTPATH = 0x10001,
         CONTEXT_LOST_WEBGL = 0x9242,
         UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243,
         BROWSER_DEFAULT_WEBGL = 0x9244,
         UNMASKED_VENDOR_WEBGL = 0x9245,
         UNMASKED_RENDERER_WEBGL = 0x9246
     };
 
+private:
+    // We've had issues in the past with nulling `gl` without actually releasing
+    // all of our resources. This construction ensures that we are aware that we
+    // should only null `gl` in DestroyResourcesAndContext.
+    RefPtr<gl::GLContext> mGL_OnlyClearInDestroyResourcesAndContext;
+public:
+    // Grab a const reference so we can see changes, but can't make changes.
+    const decltype(mGL_OnlyClearInDestroyResourcesAndContext)& gl;
+
+protected:
     const uint32_t mMaxPerfWarnings;
     mutable uint64_t mNumPerfWarnings;
     const uint32_t mMaxAcceptableFBStatusInvals;
 
     uint64_t mNextFenceId = 1;
     uint64_t mCompletedFenceId = 0;
 
 public:
deleted file mode 100644
--- a/dom/canvas/WebGLContextUnchecked.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set ts=8 sts=4 et sw=4 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "WebGLContextUnchecked.h"
-
-#include "GLContext.h"
-#include "WebGLSampler.h"
-
-namespace mozilla {
-
-WebGLContextUnchecked::WebGLContextUnchecked(gl::GLContext* _gl)
-    : mGL_OnlyClearInDestroyResourcesAndContext(_gl)
-    , gl(mGL_OnlyClearInDestroyResourcesAndContext) // const reference
-{ }
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/canvas/WebGLContextUnchecked.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set ts=8 sts=4 et sw=4 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef WEBGLCONTEXTUNCHECKED_H
-#define WEBGLCONTEXTUNCHECKED_H
-
-#include "mozilla/RefPtr.h"
-#include "WebGLTypes.h"
-
-namespace mozilla {
-
-class WebGLBuffer;
-class WebGLSampler;
-
-class WebGLContextUnchecked
-{
-public:
-    explicit WebGLContextUnchecked(gl::GLContext* gl);
-
-protected:
-    // We've had issues in the past with nulling `gl` without actually releasing
-    // all of our resources. This construction ensures that we are aware that we
-    // should only null `gl` in DestroyResourcesAndContext.
-    RefPtr<gl::GLContext> mGL_OnlyClearInDestroyResourcesAndContext;
-public:
-    // Grab a const reference so we can see changes, but can't make changes.
-    const decltype(mGL_OnlyClearInDestroyResourcesAndContext)& gl;
-};
-
-} // namespace mozilla
-
-#endif // !WEBGLCONTEXTUNCHECKED_H
--- a/dom/canvas/moz.build
+++ b/dom/canvas/moz.build
@@ -110,17 +110,16 @@ UNIFIED_SOURCES += [
     'WebGLContextBuffers.cpp',
     'WebGLContextDraw.cpp',
     'WebGLContextExtensions.cpp',
     'WebGLContextFramebufferOperations.cpp',
     'WebGLContextGL.cpp',
     'WebGLContextLossHandler.cpp',
     'WebGLContextState.cpp',
     'WebGLContextTextures.cpp',
-    'WebGLContextUnchecked.cpp',
     'WebGLContextUtils.cpp',
     'WebGLContextValidate.cpp',
     'WebGLContextVertexArray.cpp',
     'WebGLContextVertices.cpp',
     'WebGLExtensionBase.cpp',
     'WebGLExtensionBlendMinMax.cpp',
     'WebGLExtensionColorBufferFloat.cpp',
     'WebGLExtensionColorBufferHalfFloat.cpp',