Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
index 295c944f6877e6f796daec0f0bf144e0f185d85c..0d5e2ba07c88b4dc68f8a5b672c199098c6258eb 100644 |
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
@@ -96,7 +96,7 @@ |
#include "public/platform/Platform.h" |
#include "public/platform/WebGraphicsContext3D.h" |
#include "public/platform/WebGraphicsContext3DProvider.h" |
-#include "public/platform/callback/WebClosure.h" |
+#include "public/platform/functional/WebFunction.h" |
#include "wtf/Functional.h" |
#include "wtf/PassOwnPtr.h" |
#include "wtf/text/StringBuilder.h" |
@@ -482,34 +482,6 @@ private: |
Member<WebGLRenderingContextBase> m_context; |
}; |
-class WebGLRenderingContextErrorMessageCallback final : public GarbageCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public WebGraphicsContext3D::WebGraphicsErrorMessageCallback { |
-public: |
- static WebGLRenderingContextErrorMessageCallback* create(WebGLRenderingContextBase* context) |
- { |
- return new WebGLRenderingContextErrorMessageCallback(context); |
- } |
- |
- ~WebGLRenderingContextErrorMessageCallback() override { } |
- |
- virtual void onErrorMessage(const WebString& message, GLint) |
- { |
- if (m_context->m_synthesizedErrorsToConsole) |
- m_context->printGLErrorToConsole(message); |
- InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas(), message); |
- } |
- |
- DEFINE_INLINE_TRACE() |
- { |
- visitor->trace(m_context); |
- } |
- |
-private: |
- explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase* context) |
- : m_context(context) { } |
- |
- Member<WebGLRenderingContextBase> m_context; |
-}; |
- |
static void formatWebGLStatusString(const String& glInfo, const String& infostring, String& statusMessage) |
{ |
if (!infostring.isEmpty()) |
@@ -963,10 +935,16 @@ void WebGLRenderingContextBase::initializeNewContext() |
contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
- m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::create(this); |
- |
- drawingBuffer()->contextProvider()->setLostContextCallback(WebClosure(WTF::bind(&WebGLRenderingContextBase::forceLostContext, createWeakThisPointer(), WebGLRenderingContextBase::RealLostContext, WebGLRenderingContextBase::Auto))); |
- webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |
+ drawingBuffer()->contextProvider()->setLostContextCallback( |
+ WebClosure(bind( |
+ &WebGLRenderingContextBase::forceLostContext, |
+ createWeakThisPointer(), |
+ WebGLRenderingContextBase::RealLostContext, |
+ WebGLRenderingContextBase::Auto))); |
+ drawingBuffer()->contextProvider()->setErrorMessageCallback( |
+ WebFunction<void(const char*, int32_t)>(bind<const char*, int32_t>( |
+ &WebGLRenderingContextBase::onErrorMessage, |
+ createWeakThisPointer()))); |
// If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. |
// See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: |
@@ -1075,7 +1053,7 @@ void WebGLRenderingContextBase::destroyContext() |
m_extensionsUtil.clear(); |
drawingBuffer()->contextProvider()->setLostContextCallback(WebClosure()); |
- webContext()->setErrorMessageCallback(nullptr); |
+ drawingBuffer()->contextProvider()->setErrorMessageCallback(WebFunction<void(const char*, int32_t)>()); |
ASSERT(drawingBuffer()); |
m_drawingBuffer->beginDestruction(); |
@@ -1102,6 +1080,13 @@ void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) |
} |
} |
+void WebGLRenderingContextBase::onErrorMessage(const char* message, int32_t id) |
+{ |
+ if (m_synthesizedErrorsToConsole) |
+ printGLErrorToConsole(message); |
+ InspectorInstrumentation::didFireWebGLErrorOrWarning(canvas(), message); |
+} |
+ |
void WebGLRenderingContextBase::notifyCanvasContextChanged() |
{ |
if (!canvas()) |
@@ -6256,7 +6241,6 @@ DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState) |
DEFINE_TRACE(WebGLRenderingContextBase) |
{ |
visitor->trace(m_contextObjects); |
- visitor->trace(m_errorMessageCallbackAdapter); |
visitor->trace(m_boundArrayBuffer); |
visitor->trace(m_defaultVertexArrayObject); |
visitor->trace(m_boundVertexArrayObject); |