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

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

Issue 2453283002: Allow nested state restorers in DrawingBuffer (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5cd97e11e7d72a2d607159773593b00894f8c32b..498c75e75a4c627ace6fd546a004d5bf620b0e47 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -251,8 +251,7 @@ bool DrawingBuffer::prepareTextureMailboxInternal(
cc::TextureMailbox* outMailbox,
std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback,
bool forceGpuResult) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
if (m_destructionInProgress) {
// It can be hit in the following sequence.
// 1. WebGL draws something.
@@ -322,8 +321,7 @@ bool DrawingBuffer::finishPrepareTextureMailboxSoftware(
bool DrawingBuffer::finishPrepareTextureMailboxGpu(
cc::TextureMailbox* outMailbox,
std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
if (m_webGLVersion > WebGL1) {
m_stateRestorer->setPixelUnpackBufferBindingDirty();
m_gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
@@ -571,8 +569,7 @@ DrawingBuffer::textureColorBufferParameters() {
PassRefPtr<DrawingBuffer::ColorBuffer>
DrawingBuffer::createOrRecycleColorBuffer() {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
if (!m_recycledColorBufferQueue.isEmpty()) {
RefPtr<ColorBuffer> recycled = m_recycledColorBufferQueue.takeLast();
if (recycled->receiveSyncToken.HasData())
@@ -808,8 +805,7 @@ void DrawingBuffer::beginDestruction() {
}
bool DrawingBuffer::resizeDefaultFramebuffer(const IntSize& size) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
// Recreate m_backColorBuffer.
m_backColorBuffer = createColorBuffer(size);
@@ -878,8 +874,7 @@ void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) {
}
void DrawingBuffer::clearFramebuffersInternal(GLbitfield clearMask) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
m_stateRestorer->setFramebufferBindingDirty();
// We will clear the multisample FBO, but we also need to clear the
// non-multisampled buffer.
@@ -915,9 +910,8 @@ bool DrawingBuffer::resize(const IntSize& newSize) {
}
bool DrawingBuffer::resizeFramebufferInternal(const IntSize& newSize) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
- CHECK(!newSize.isEmpty());
+ DCHECK(m_stateRestorer);
+ DCHECK(!newSize.isEmpty());
IntSize adjustedSize = adjustSize(newSize, m_size, m_maxTextureSize);
if (adjustedSize.isEmpty())
return false;
@@ -972,8 +966,7 @@ void DrawingBuffer::resolveAndBindForReadAndDraw() {
}
void DrawingBuffer::resolveMultisampleFramebufferInternal() {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
m_stateRestorer->setFramebufferBindingDirty();
if (wantExplicitResolve() && !m_contentsChangeCommitted) {
m_stateRestorer->setClearStateDirty();
@@ -1082,8 +1075,7 @@ void DrawingBuffer::readBackFramebuffer(unsigned char* pixels,
int height,
ReadbackOrder readbackOrder,
WebGLImageConversion::AlphaOp op) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
m_stateRestorer->setPixelPackAlignmentDirty();
m_gl->PixelStorei(GL_PACK_ALIGNMENT, 1);
m_gl->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
@@ -1128,8 +1120,7 @@ void DrawingBuffer::flipVertically(uint8_t* framebuffer,
RefPtr<DrawingBuffer::ColorBuffer> DrawingBuffer::createColorBuffer(
const IntSize& size) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
m_stateRestorer->setFramebufferBindingDirty();
m_stateRestorer->setTextureBindingDirty();
@@ -1203,8 +1194,7 @@ RefPtr<DrawingBuffer::ColorBuffer> DrawingBuffer::createColorBuffer(
}
void DrawingBuffer::attachColorBufferToReadFramebuffer() {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(m_stateRestorer);
+ DCHECK(m_stateRestorer);
m_stateRestorer->setFramebufferBindingDirty();
m_stateRestorer->setTextureBindingDirty();
@@ -1248,15 +1238,14 @@ GLenum DrawingBuffer::getMultisampledRenderbufferFormat() {
DrawingBuffer::ScopedStateRestorer::ScopedStateRestorer(
DrawingBuffer* drawingBuffer)
: m_drawingBuffer(drawingBuffer) {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK(!m_drawingBuffer->m_stateRestorer);
+ // If this is a nested restorer, save the previous restorer.
+ m_previousStateRestorer = drawingBuffer->m_stateRestorer;
m_drawingBuffer->m_stateRestorer = this;
}
DrawingBuffer::ScopedStateRestorer::~ScopedStateRestorer() {
- // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265
- CHECK_EQ(m_drawingBuffer->m_stateRestorer, this);
- m_drawingBuffer->m_stateRestorer = nullptr;
+ DCHECK_EQ(m_drawingBuffer->m_stateRestorer, this);
+ m_drawingBuffer->m_stateRestorer = m_previousStateRestorer;
Client* client = m_drawingBuffer->m_client;
if (!client)
return;
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698