Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1790753002: Expose GLES2Interface to blink, and delete isContextLost() from WGC3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wgc3d: deps-for-tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 9d2600b8c18f6e8fe81c3b08743667ad1b5e65e2..3b361f746c2ebcadb469d079792daf0914daeaff 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -30,6 +30,7 @@
#include "platform/graphics/gpu/DrawingBuffer.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h"
#include "platform/graphics/GraphicsLayer.h"
@@ -97,7 +98,8 @@ PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3D>
return nullptr;
}
- OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get());
+ gpu::gles2::GLES2Interface* gl = context->getGLES2Interface();
+ OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get(), gl);
if (!extensionsUtil->isValid()) {
// This might be the first time we notice that the WebGraphicsContext3D is lost.
return nullptr;
@@ -118,7 +120,7 @@ PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3D>
if (discardFramebufferSupported)
extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer");
- RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(context), extensionsUtil.release(), multisampleSupported, discardFramebufferSupported, preserve, requestedAttributes));
+ RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(context), gl, extensionsUtil.release(), multisampleSupported, discardFramebufferSupported, preserve, requestedAttributes));
if (!drawingBuffer->initialize(size)) {
drawingBuffer->beginDestruction();
return PassRefPtr<DrawingBuffer>();
@@ -131,12 +133,7 @@ void DrawingBuffer::forceNextDrawingBufferCreationToFail()
shouldFailDrawingBufferCreationForTesting = true;
}
-DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context,
- PassOwnPtr<Extensions3DUtil> extensionsUtil,
- bool multisampleExtensionSupported,
- bool discardFramebufferSupported,
- PreserveDrawingBuffer preserve,
- WebGraphicsContext3D::Attributes requestedAttributes)
+DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context, gpu::gles2::GLES2Interface* gl, PassOwnPtr<Extensions3DUtil> extensionsUtil, bool multisampleExtensionSupported, bool discardFramebufferSupported, PreserveDrawingBuffer preserve, WebGraphicsContext3D::Attributes requestedAttributes)
: m_preserveDrawingBuffer(preserve)
, m_scissorEnabled(false)
, m_texture2DBinding(0)
@@ -144,6 +141,7 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context,
, m_readFramebufferBinding(0)
, m_activeTextureUnit(GL_TEXTURE0)
, m_context(std::move(context))
+ , m_gl(gl)
, m_extensionsUtil(std::move(extensionsUtil))
, m_size(-1, -1)
, m_requestedAttributes(requestedAttributes)
@@ -320,7 +318,7 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt
void DrawingBuffer::mailboxReleased(const WebExternalTextureMailbox& mailbox, bool lostResource)
{
- if (m_destructionInProgress || m_context->isContextLost() || lostResource || m_isHidden) {
+ if (m_destructionInProgress || m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR || lostResource || m_isHidden) {
mailboxReleasedWithoutRecycling(mailbox);
return;
}
@@ -444,7 +442,7 @@ void DrawingBuffer::deleteMailbox(const WebExternalTextureMailbox& mailbox)
bool DrawingBuffer::initialize(const IntSize& size)
{
- if (m_context->isContextLost()) {
+ if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
// Need to try to restore the context again later.
return false;
}
@@ -490,7 +488,7 @@ bool DrawingBuffer::initialize(const IntSize& size)
}
m_actualAttributes.antialias = multisample();
- if (m_context->isContextLost()) {
+ if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
// It's possible that the drawing buffer allocation provokes a context loss, so check again just in case. http://crbug.com/512302
return false;
}

Powered by Google App Engine
This is Rietveld 408576698