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

Unified Diff: Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

Issue 10690121: Merge 121076 - [chromium] LayerRendererChromium is not getting visibility messages in single thread… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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: Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (revision 122257)
+++ Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (working copy)
@@ -35,7 +35,6 @@
#include "LayerRendererChromium.h"
#include "Extensions3D.h"
-#include "Extensions3DChromium.h"
#include "FloatQuad.h"
#include "GeometryBinding.h"
#include "GrTexture.h"
@@ -222,11 +221,7 @@
void onGpuMemoryAllocationChangedOnImpl(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
{
ASSERT(CCProxy::isImplThread());
- if (!allocation.suggestHaveBackbuffer)
- m_layerRenderer->discardFramebuffer();
- else
- m_layerRenderer->ensureFramebuffer();
- m_layerRenderer->m_client->setContentsMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes);
+ m_layerRenderer->setGpuMemoryAllocation(allocation);
}
LayerRendererChromium* m_layerRenderer;
@@ -254,6 +249,7 @@
, m_defaultRenderPass(0)
, m_isViewportChanged(false)
, m_isFramebufferDiscarded(false)
+ , m_visible(true)
, m_textureUploaderSetting(textureUploaderSetting)
{
ASSERT(m_context.get());
@@ -337,7 +333,7 @@
Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(LayerRendererGpuMemoryAllocationChangedCallbackAdapter::create(this));
} else {
- m_client->setContentsMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()));
+ m_client->setMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()));
}
m_capabilities.usingDiscardFramebuffer = extensions->supports("GL_CHROMIUM_discard_framebuffer");
@@ -378,8 +374,9 @@
void LayerRendererChromium::setVisible(bool visible)
{
- if (!visible)
- releaseRenderPassTextures();
+ if (m_visible == visible)
+ return;
+ m_visible = visible;
// TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers
// crbug.com/116049
@@ -1267,6 +1264,22 @@
-1);
}
+void LayerRendererChromium::setGpuMemoryAllocation(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
+{
+ if (m_visible && !allocation.gpuResourceSizeInBytes)
+ return;
+
+ if (!allocation.suggestHaveBackbuffer && !m_visible)
+ discardFramebuffer();
+
+ if (!allocation.gpuResourceSizeInBytes) {
+ releaseRenderPassTextures();
+ m_client->releaseContentsTextures();
+ GLC(m_context, m_context->flush());
+ } else
+ m_client->setMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes);
+}
+
void LayerRendererChromium::finish()
{
TRACE_EVENT("LayerRendererChromium::finish", this, 0);
@@ -1275,12 +1288,8 @@
bool LayerRendererChromium::swapBuffers(const IntRect& subBuffer)
{
- // FIXME: Remove this once gpu process supports ignoring swap buffers command while framebuffer is discarded.
- // Alternatively (preferably?), protect all cc code so as not to attempt a swap after a framebuffer discard.
- if (m_isFramebufferDiscarded) {
- m_client->setFullRootLayerDamage();
- return false;
- }
+ ASSERT(m_visible);
+ ASSERT(!m_isFramebufferDiscarded);
TRACE_EVENT("LayerRendererChromium::swapBuffers", this, 0);
// We're done! Time to swapbuffers!
@@ -1384,6 +1393,14 @@
GLC(context, context->deleteFramebuffer(temporaryFBO));
GLC(context, context->deleteTexture(temporaryTexture));
}
+
+ if (!m_visible) {
+ TRACE_EVENT0("cc", "LayerRendererChromium::getFramebufferPixels dropping resources after readback");
+ discardFramebuffer();
+ releaseRenderPassTextures();
+ m_client->releaseContentsTextures();
+ GLC(m_context, m_context->flush());
+ }
}
bool LayerRendererChromium::getFramebufferTexture(ManagedTexture* texture, const IntRect& deviceRect)

Powered by Google App Engine
This is Rietveld 408576698