Bug 1274769 - handle the WebGLTimerQuery deletion status for GLContext cleanup. r=jgilbert
authorJerryShih <hshih@mozilla.com>
Tue, 24 May 2016 18:52:00 +0200
changeset 298973 c945909fea77c953650c45ace26602133303ce15
parent 298972 10a3bd5421b1d223a2e3110396d0ff986197be86
child 298974 534f9ffd36da1646e7eb0e32a3fd73df299f28d9
push id30286
push userkwierso@gmail.com
push dateWed, 25 May 2016 22:33:39 +0000
treeherdermozilla-central@1012461fa7bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1274769
milestone49.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 1274769 - handle the WebGLTimerQuery deletion status for GLContext cleanup. r=jgilbert
dom/canvas/WebGLExtensionBase.cpp
dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
dom/canvas/WebGLExtensions.h
--- a/dom/canvas/WebGLExtensionBase.cpp
+++ b/dom/canvas/WebGLExtensionBase.cpp
@@ -16,16 +16,18 @@ WebGLExtensionBase::WebGLExtensionBase(W
 WebGLExtensionBase::~WebGLExtensionBase()
 {
 }
 
 void
 WebGLExtensionBase::MarkLost()
 {
     mIsLost = true;
+
+    OnMarkLost();
 }
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLExtensionBase)
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLExtensionBase, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLExtensionBase, Release)
 
 } // namespace mozilla
--- a/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
+++ b/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
@@ -244,11 +244,17 @@ WebGLExtensionDisjointTimerQuery::IsSupp
          gl->IsSupported(gl::GLFeature::get_query_object_i64v) &&
          gl->IsSupported(gl::GLFeature::query_counter) && // provides GL_TIMESTAMP
          gl->IsSupported(gl::GLFeature::sync); // provides glGetInteger64v
   // 'sync' provides glGetInteger64v either by supporting ARB_sync, GL3+, or GLES3+.
   // Since there are no differences between support for glGetInteger64v and support for
   // 'sync', we just piggy-back off of 'sync'.
 }
 
+void
+WebGLExtensionDisjointTimerQuery::OnMarkLost()
+{
+  mActiveQuery = nullptr;
+}
+
 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDisjointTimerQuery, EXT_disjoint_timer_query)
 
 } // namespace mozilla
--- a/dom/canvas/WebGLExtensions.h
+++ b/dom/canvas/WebGLExtensions.h
@@ -44,16 +44,18 @@ public:
     void MarkLost();
 
     NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLExtensionBase)
     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLExtensionBase)
 
 protected:
     virtual ~WebGLExtensionBase();
 
+    virtual void OnMarkLost() { }
+
     bool mIsLost;
 };
 
 #define DECL_WEBGL_EXTENSION_GOOP \
     virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
 
 #define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType, WebGLBindingType)\
     JSObject*                                                    \
@@ -382,16 +384,18 @@ public:
                            GLenum pname,
                            JS::MutableHandle<JS::Value> retval);
 
     static bool IsSupported(const WebGLContext*);
 
     DECL_WEBGL_EXTENSION_GOOP
 
 private:
+    virtual void OnMarkLost() override;
+
     /**
      * An active TIME_ELAPSED query participating in a begin/end block.
      */
     WebGLRefPtr<WebGLTimerQuery> mActiveQuery;
 };
 
 } // namespace mozilla