WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
add PlatformCanvas.h include back to CCHeadsUpDisplay.cpp
bug-83415-20120413173744.patch (text/plain), 47.97 KB, created by
James Robinson
on 2012-04-13 17:37:45 PDT
(
hide
)
Description:
add PlatformCanvas.h include back to CCHeadsUpDisplay.cpp
Filename:
MIME Type:
Creator:
James Robinson
Created:
2012-04-13 17:37:45 PDT
Size:
47.97 KB
patch
obsolete
>Subversion Revision: 114175 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2aa90494cc186424042a3ae96fcae2868359fd6d..be7bdcf96f8d5ced87565ae4c5cd7cef3df4ed68 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,80 @@ >+2012-04-13 James Robinson <jamesr@chromium.org> >+ >+ [chromium] LayerRendererChromium shouldn't know anything about CCLayerImpl >+ https://bugs.webkit.org/show_bug.cgi?id=83415 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This removes all knowledge of CCLayerImpl from LayerRendererChromium. The most significant move code-wise is >+ moving the HUD up to live on CCLayerTreeHostImpl, since it's aware of the layer tree. This involves two changes. >+ First, CCHeadsUpDisplay is in charge of populating a ManagedTexture but the actual drawing code now lives in >+ LayerRendererChromium. Second, since we don't recreate CCLayerTreeHostImpl on a lost context, the font atlas >+ ownership is much simpler. Now a CCFontAtlas is created on the main thread if needed and passed asynchronously >+ to the CCHeadsUpDisplay which takes ownership of the atlas. >+ >+ * platform/graphics/chromium/LayerRendererChromium.cpp: >+ (WebCore::LayerRendererChromium::create): >+ (WebCore::LayerRendererChromium::initialize): >+ (WebCore::LayerRendererChromium::~LayerRendererChromium): >+ (WebCore::LayerRendererChromium::beginDrawingFrame): >+ (WebCore::LayerRendererChromium::drawHeadsUpDisplay): >+ (WebCore): >+ (WebCore::LayerRendererChromium::finishDrawingFrame): >+ (WebCore::LayerRendererChromium::swapBuffers): >+ * platform/graphics/chromium/LayerRendererChromium.h: >+ (LayerRendererChromiumClient): >+ (LayerRendererChromium): >+ * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: >+ (WebCore::CCHeadsUpDisplay::CCHeadsUpDisplay): >+ (WebCore::CCHeadsUpDisplay::setFontAtlas): >+ (WebCore): >+ (WebCore::CCHeadsUpDisplay::enabled): >+ (WebCore::CCHeadsUpDisplay::showPlatformLayerTree): >+ (WebCore::CCHeadsUpDisplay::draw): >+ (WebCore::CCHeadsUpDisplay::drawHudContents): >+ * platform/graphics/chromium/cc/CCHeadsUpDisplay.h: >+ (WebCore): >+ (WebCore::CCHeadsUpDisplay::create): >+ (CCHeadsUpDisplay): >+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: >+ (WebCore::CCLayerTreeHost::initialize): >+ * platform/graphics/chromium/cc/CCLayerTreeHost.h: >+ (CCLayerTreeHost): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: >+ (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): >+ (WebCore::CCLayerTreeHostImpl::~CCLayerTreeHostImpl): >+ (WebCore::CCLayerTreeHostImpl::canDraw): >+ (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): >+ (WebCore::CCLayerTreeHostImpl::prepareToDraw): >+ (WebCore::CCLayerTreeHostImpl::drawLayers): >+ (WebCore::CCLayerTreeHostImpl::swapBuffers): >+ (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer): >+ (WebCore::CCLayerTreeHostImpl::setFullRootLayerDamage): >+ (WebCore::CCLayerTreeHostImpl::layerTreeAsText): >+ (WebCore): >+ (WebCore::CCLayerTreeHostImpl::setFontAtlas): >+ (WebCore::CCLayerTreeHostImpl::dumpRenderSurfaces): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: >+ (CCLayerTreeHostImpl): >+ (WebCore::CCLayerTreeHostImpl::rootLayer): >+ * platform/graphics/chromium/cc/CCProxy.h: >+ (WebCore): >+ (CCProxy): >+ * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: >+ (WebCore::CCSingleThreadProxy::initializeLayerRenderer): >+ (WebCore::CCSingleThreadProxy::recreateContext): >+ (WebCore::CCSingleThreadProxy::setFontAtlas): >+ (WebCore): >+ * platform/graphics/chromium/cc/CCSingleThreadProxy.h: >+ * platform/graphics/chromium/cc/CCThreadProxy.cpp: >+ (WebCore::CCThreadProxy::initializeLayerRendererOnImplThread): >+ (WebCore::CCThreadProxy::setFontAtlas): >+ (WebCore): >+ (WebCore::CCThreadProxy::setFontAtlasOnImplThread): >+ (WebCore::CCThreadProxy::recreateContextOnImplThread): >+ * platform/graphics/chromium/cc/CCThreadProxy.h: >+ (CCThreadProxy): >+ > 2012-04-13 Simon Fraser <simon.fraser@apple.com> > > Compositing layers not updated after scroll in WebKit1 >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 8ad93c283e1591894f80b4c636316edf9e691653..00c5cc769fcb63aa3ea39b6020134852ee70a345 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,18 @@ >+2012-04-13 James Robinson <jamesr@chromium.org> >+ >+ [chromium] LayerRendererChromium shouldn't know anything about CCLayerImpl >+ https://bugs.webkit.org/show_bug.cgi?id=83415 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add an explicit rootLayer getter to the test implementation of LayerRendererChromium since there isn't one on >+ the base class any more. >+ >+ * tests/LayerRendererChromiumTest.cpp: >+ (FakeLayerRendererChromiumClient::rootLayer): >+ (FakeLayerRendererChromiumClient): >+ (TEST_F): >+ > 2012-04-11 James Robinson <jamesr@chromium.org> > > [chromium] Remove unused compositeToTexture / compositeOffscreen setting >diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >index 7d640a57e0391ff95c4928aeaed6a9260df5cb95..0d06633290a2b4d7db83e4199c11ac08891ec994 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >@@ -196,10 +196,10 @@ private: > }; > > >-PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context, CCFontAtlas* headsUpDisplayFontAtlas) >+PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context) > { > OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, context))); >- if (!layerRenderer->initialize(headsUpDisplayFontAtlas)) >+ if (!layerRenderer->initialize()) > return nullptr; > > return layerRenderer.release(); >@@ -238,7 +238,7 @@ private: > LayerRendererChromiumClient* m_client; > }; > >-bool LayerRendererChromium::initialize(CCFontAtlas* headsUpDisplayFontAtlas) >+bool LayerRendererChromium::initialize() > { > if (!m_context->makeContextCurrent()) > return false; >@@ -308,8 +308,6 @@ bool LayerRendererChromium::initialize(CCFontAtlas* headsUpDisplayFontAtlas) > if (!initializeSharedObjects()) > return false; > >- m_headsUpDisplay = CCHeadsUpDisplay::create(this, headsUpDisplayFontAtlas); >- > // Make sure the viewport and context gets initialized, even if it is to zero. > viewportChanged(); > return true; >@@ -321,7 +319,6 @@ LayerRendererChromium::~LayerRendererChromium() > Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions()); > extensions3DChromium->setSwapBuffersCompleteCallbackCHROMIUM(nullptr); > extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(nullptr); >- m_headsUpDisplay.clear(); // Explicitly destroy the HUD before the TextureManager dies. > cleanupSharedObjects(); > } > >@@ -391,26 +388,19 @@ void LayerRendererChromium::clearRenderSurface(CCRenderSurface* renderSurface, C > GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST)); > } > >-void LayerRendererChromium::beginDrawingFrame() >+void LayerRendererChromium::beginDrawingFrame(CCRenderSurface* defaultRenderSurface) > { >- ASSERT(rootLayer()); >- > // FIXME: Remove this once framebuffer is automatically recreated on first use > ensureFramebuffer(); > >- m_defaultRenderSurface = rootLayer()->renderSurface(); >+ m_defaultRenderSurface = defaultRenderSurface; > ASSERT(m_defaultRenderSurface); > >- // FIXME: use the frame begin time from the overall compositor scheduler. >- // This value is currently inaccessible because it is up in Chromium's >- // RenderWidget. >- m_headsUpDisplay->onFrameBegin(currentTime()); >- > size_t contentsMemoryUseBytes = m_contentsTextureAllocator->currentMemoryUseBytes(); > size_t maxLimit = TextureManager::highLimitBytes(viewportSize()); > m_renderSurfaceTextureManager->setMaxMemoryLimitBytes(maxLimit - contentsMemoryUseBytes); > >- if (viewportSize().isEmpty() || !rootLayer()) >+ if (viewportSize().isEmpty()) > return; > > TRACE_EVENT("LayerRendererChromium::drawLayers", this, 0); >@@ -1080,16 +1070,30 @@ void LayerRendererChromium::drawTextureQuad(const CCTextureDrawQuad* quad) > GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); > } > >-void LayerRendererChromium::finishDrawingFrame() >+void LayerRendererChromium::drawHeadsUpDisplay(ManagedTexture* hudTexture, const IntSize& hudSize) > { >- if (m_headsUpDisplay->enabled()) { >- GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND)); >- GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); >- GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST)); >- useRenderSurface(m_defaultRenderSurface); >- m_headsUpDisplay->draw(); >- } >+ GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND)); >+ GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); >+ GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST)); >+ useRenderSurface(m_defaultRenderSurface); >+ >+ const CCHeadsUpDisplay::Program* program = headsUpDisplayProgram(); >+ ASSERT(program && program->initialized()); >+ GLC(m_context.get(), m_context->activeTexture(GraphicsContext3D::TEXTURE0)); >+ hudTexture->bindTexture(m_context.get(), renderSurfaceTextureAllocator()); >+ GLC(m_context.get(), m_context->useProgram(program->program())); >+ GLC(m_context.get(), m_context->uniform1i(program->fragmentShader().samplerLocation(), 0)); > >+ TransformationMatrix matrix; >+ matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0); >+ drawTexturedQuad(matrix, hudSize.width(), hudSize.height(), >+ 1, sharedGeometryQuad(), program->vertexShader().matrixLocation(), >+ program->fragmentShader().alphaLocation(), >+ -1); >+} >+ >+void LayerRendererChromium::finishDrawingFrame() >+{ > GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST)); > GLC(m_context.get(), m_context->disable(GraphicsContext3D::BLEND)); > >@@ -1186,7 +1190,6 @@ bool LayerRendererChromium::swapBuffers(const IntRect& subBuffer) > // consider exposing a different entry point on GraphicsContext3D. > m_context->prepareTexture(); > >- m_headsUpDisplay->onSwapBuffers(); > return true; > } > >@@ -1729,26 +1732,6 @@ void LayerRendererChromium::cleanupSharedObjects() > releaseRenderSurfaceTextures(); > } > >-String LayerRendererChromium::layerTreeAsText() const >-{ >- TextStream ts; >- if (rootLayer()) { >- ts << rootLayer()->layerTreeAsText(); >- ts << "RenderSurfaces:\n"; >- dumpRenderSurfaces(ts, 1, rootLayer()); >- } >- return ts.release(); >-} >- >-void LayerRendererChromium::dumpRenderSurfaces(TextStream& ts, int indent, const CCLayerImpl* layer) const >-{ >- if (layer->renderSurface()) >- layer->renderSurface()->dumpSurface(ts, indent); >- >- for (size_t i = 0; i < layer->children().size(); ++i) >- dumpRenderSurfaces(ts, indent, layer->children()[i].get()); >-} >- > bool LayerRendererChromium::isContextLost() > { > return (m_context.get()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); >diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h >index 662d9c5a94d79aaf3b530cbae31cad74bcf246d8..bde1c95f3bc5ca7ebfd56e2bd82913a5270d2cb5 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h >+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h >@@ -53,9 +53,6 @@ > > namespace WebCore { > >-class CCFontAtlas; >-class CCHeadsUpDisplay; >-class CCLayerImpl; > class CCRenderPass; > class CCTextureDrawQuad; > class GeometryBinding; >@@ -68,8 +65,6 @@ class LayerRendererChromiumClient { > public: > virtual const IntSize& viewportSize() const = 0; > virtual const CCSettings& settings() const = 0; >- virtual CCLayerImpl* rootLayer() = 0; >- virtual const CCLayerImpl* rootLayer() const = 0; > virtual void didLoseContext() = 0; > virtual void onSwapBuffersComplete() = 0; > virtual void setFullRootLayerDamage() = 0; >@@ -79,16 +74,13 @@ public: > class LayerRendererChromium { > WTF_MAKE_NONCOPYABLE(LayerRendererChromium); > public: >- static PassOwnPtr<LayerRendererChromium> create(LayerRendererChromiumClient*, PassRefPtr<GraphicsContext3D>, CCFontAtlas*); >+ static PassOwnPtr<LayerRendererChromium> create(LayerRendererChromiumClient*, PassRefPtr<GraphicsContext3D>); > > ~LayerRendererChromium(); > > const CCSettings& settings() const { return m_client->settings(); } > const LayerRendererCapabilities& capabilities() const { return m_capabilities; } > >- CCLayerImpl* rootLayer() { return m_client->rootLayer(); } >- const CCLayerImpl* rootLayer() const { return m_client->rootLayer(); } >- > GraphicsContext3D* context(); > bool contextSupportsMapSub() const { return m_capabilities.usingMapSub; } > >@@ -98,10 +90,12 @@ public: > > void viewportChanged(); > >- void beginDrawingFrame(); >+ void beginDrawingFrame(CCRenderSurface* defaultRenderSurface); > void drawRenderPass(const CCRenderPass*); > void finishDrawingFrame(); > >+ void drawHeadsUpDisplay(ManagedTexture*, const IntSize& hudSize); >+ > // waits for rendering to finish > void finish(); > >@@ -149,12 +143,8 @@ public: > TextureAllocator* renderSurfaceTextureAllocator() const { return m_renderSurfaceTextureAllocator.get(); } > TextureAllocator* contentsTextureAllocator() const { return m_contentsTextureAllocator.get(); } > >- CCHeadsUpDisplay* headsUpDisplay() { return m_headsUpDisplay.get(); } >- > void setScissorToRect(const IntRect&); > >- String layerTreeAsText() const; >- > bool isContextLost(); > > void setVisible(bool); >@@ -173,7 +163,7 @@ protected: > bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } > > LayerRendererChromium(LayerRendererChromiumClient*, PassRefPtr<GraphicsContext3D>); >- bool initialize(CCFontAtlas* headsUpDisplayFontAtlas = 0); >+ bool initialize(); > > private: > void drawQuad(const CCDrawQuad*, const FloatRect& surfaceDamageRect); >@@ -209,10 +199,6 @@ private: > > bool makeContextCurrent(); > >- static bool compareLayerZ(const RefPtr<CCLayerImpl>&, const RefPtr<CCLayerImpl>&); >- >- void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const; >- > bool initializeSharedObjects(); > void cleanupSharedObjects(); > >@@ -263,8 +249,6 @@ private: > OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator; > OwnPtr<TrackingTextureAllocator> m_renderSurfaceTextureAllocator; > >- OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay; >- > RefPtr<GraphicsContext3D> m_context; > > CCRenderSurface* m_defaultRenderSurface; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >index e2e214ddf6dd0b1e39e3b36925b74562a1137237..a6a8bd1cbdfa58d083f849e7fa5a35deb38c462d 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >@@ -27,30 +27,23 @@ > #if USE(ACCELERATED_COMPOSITING) > #include "CCHeadsUpDisplay.h" > >-#include "CCFontAtlas.h" > #include "Extensions3DChromium.h" > #include "GraphicsContext3D.h" >-#include "InspectorController.h" >-#include "LayerChromium.h" > #include "LayerRendererChromium.h" > #include "ManagedTexture.h" > #include "PlatformCanvas.h" >-#include "TextRun.h" >-#include "TextStream.h" > #include "TextureManager.h" >+#include "cc/CCFontAtlas.h" >+#include "cc/CCLayerTreeHostImpl.h" > #include <wtf/CurrentTime.h> >-#include <wtf/text/CString.h> > #include <wtf/text/WTFString.h> > > namespace WebCore { > > using namespace std; > >-CCHeadsUpDisplay::CCHeadsUpDisplay(LayerRendererChromium* owner, CCFontAtlas* headsUpDisplayFontAtlas) >+CCHeadsUpDisplay::CCHeadsUpDisplay() > : m_currentFrameNumber(1) >- , m_layerRenderer(owner) >- , m_useMapSubForUploads(owner->contextSupportsMapSub()) >- , m_fontAtlas(headsUpDisplayFontAtlas) > { > m_beginTimeHistoryInSec[0] = currentTime(); > m_beginTimeHistoryInSec[1] = m_beginTimeHistoryInSec[0]; >@@ -62,6 +55,11 @@ CCHeadsUpDisplay::~CCHeadsUpDisplay() > { > } > >+void CCHeadsUpDisplay::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) >+{ >+ m_fontAtlas = fontAtlas; >+} >+ > const double CCHeadsUpDisplay::kIdleSecondsTriggersReset = 0.5; > const double CCHeadsUpDisplay::kFrameTooFast = 1.0 / 70; > >@@ -86,27 +84,29 @@ void CCHeadsUpDisplay::onSwapBuffers() > m_currentFrameNumber += 1; > } > >-bool CCHeadsUpDisplay::enabled() const >+bool CCHeadsUpDisplay::enabled(const CCSettings& settings) const > { >- return showPlatformLayerTree() || settings().showFPSCounter; >+ return showPlatformLayerTree(settings) || settings.showFPSCounter; > } > >-bool CCHeadsUpDisplay::showPlatformLayerTree() const >+bool CCHeadsUpDisplay::showPlatformLayerTree(const CCSettings& settings) const > { >- return settings().showPlatformLayerTree; >+ return settings.showPlatformLayerTree; > } > >-void CCHeadsUpDisplay::draw() >+void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) > { >- GraphicsContext3D* context = m_layerRenderer->context(); >+ LayerRendererChromium* layerRenderer = layerTreeHostImpl->layerRenderer(); >+ GraphicsContext3D* context = layerRenderer->context(); > if (!m_hudTexture) >- m_hudTexture = ManagedTexture::create(m_layerRenderer->renderSurfaceTextureManager()); >+ m_hudTexture = ManagedTexture::create(layerRenderer->renderSurfaceTextureManager()); > >+ const CCSettings& settings = layerTreeHostImpl->settings(); > // Use a fullscreen texture only if we need to... > IntSize hudSize; >- if (showPlatformLayerTree()) { >- hudSize.setWidth(min(2048, m_layerRenderer->viewportWidth())); >- hudSize.setHeight(min(2048, m_layerRenderer->viewportHeight())); >+ if (showPlatformLayerTree(settings)) { >+ hudSize.setWidth(min(2048, layerTreeHostImpl->viewportSize().width())); >+ hudSize.setHeight(min(2048, layerTreeHostImpl->viewportSize().height())); > } else { > hudSize.setWidth(512); > hudSize.setHeight(128); >@@ -121,16 +121,16 @@ void CCHeadsUpDisplay::draw() > { > PlatformCanvas::Painter painter(&canvas, PlatformCanvas::Painter::GrayscaleText); > painter.context()->clearRect(FloatRect(0, 0, hudSize.width(), hudSize.height())); >- drawHudContents(painter.context(), hudSize); >+ drawHudContents(painter.context(), layerTreeHostImpl, settings, hudSize); > } > > // Upload to GL. > { > PlatformCanvas::AutoLocker locker(&canvas); > >- m_hudTexture->bindTexture(context, m_layerRenderer->renderSurfaceTextureAllocator()); >+ m_hudTexture->bindTexture(context, layerRenderer->renderSurfaceTextureAllocator()); > bool uploadedViaMap = false; >- if (m_useMapSubForUploads) { >+ if (layerRenderer->contextSupportsMapSub()) { > Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); > uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); > >@@ -146,20 +146,8 @@ void CCHeadsUpDisplay::draw() > } > } > >- // Draw the HUD onto the default render surface. >- const Program* program = m_layerRenderer->headsUpDisplayProgram(); >- ASSERT(program && program->initialized()); >- GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); >- m_hudTexture->bindTexture(context, m_layerRenderer->renderSurfaceTextureAllocator()); >- GLC(context, context->useProgram(program->program())); >- GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0)); >- >- TransformationMatrix matrix; >- matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0); >- m_layerRenderer->drawTexturedQuad(matrix, hudSize.width(), hudSize.height(), >- 1.0f, m_layerRenderer->sharedGeometryQuad(), program->vertexShader().matrixLocation(), >- program->fragmentShader().alphaLocation(), >- -1); >+ layerRenderer->drawHeadsUpDisplay(m_hudTexture.get(), hudSize); >+ > m_hudTexture->unreserve(); > } > >@@ -172,9 +160,9 @@ bool CCHeadsUpDisplay::isBadFrame(int frameNumber) const > return (schedulerAllowsDoubleFrames && delta < kFrameTooFast) || tooSlow; > } > >-void CCHeadsUpDisplay::drawHudContents(GraphicsContext* context, const IntSize& hudSize) >+void CCHeadsUpDisplay::drawHudContents(GraphicsContext* context, CCLayerTreeHostImpl* layerTreeHostImpl, const CCSettings& settings, const IntSize& hudSize) > { >- if (showPlatformLayerTree()) { >+ if (showPlatformLayerTree(settings)) { > context->setFillColor(Color(0, 0, 0, 192), ColorSpaceDeviceRGB); > context->fillRect(FloatRect(0, 0, hudSize.width(), hudSize.height())); > } >@@ -182,16 +170,19 @@ void CCHeadsUpDisplay::drawHudContents(GraphicsContext* context, const IntSize& > int fpsCounterHeight = 40; > int fpsCounterTop = 2; > int platformLayerTreeTop; >- if (settings().showFPSCounter) >+ >+ if (settings.showFPSCounter) > platformLayerTreeTop = fpsCounterTop + fpsCounterHeight; > else > platformLayerTreeTop = 0; > >- if (settings().showFPSCounter) >+ if (settings.showFPSCounter) > drawFPSCounter(context, fpsCounterTop, fpsCounterHeight); > >- if (showPlatformLayerTree()) >- drawPlatformLayerTree(context, hudSize, platformLayerTreeTop); >+ if (showPlatformLayerTree(settings) && m_fontAtlas) { >+ String layerTree = layerTreeHostImpl->layerTreeAsText(); >+ m_fontAtlas->drawText(context, layerTree, IntPoint(2, platformLayerTreeTop), hudSize); >+ } > } > > void CCHeadsUpDisplay::getAverageFPSAndStandardDeviation(double *average, double *standardDeviation) const >@@ -295,17 +286,6 @@ void CCHeadsUpDisplay::drawFPSCounterText(GraphicsContext* context, int top, int > m_fontAtlas->drawText(context, String::format("FPS: %4.1f +/- %3.1f", averageFPS, stdDeviation), IntPoint(10, height / 3), IntSize(width, height)); > } > >-void CCHeadsUpDisplay::drawPlatformLayerTree(GraphicsContext* context, const IntSize hudSize, int top) >-{ >- if (m_fontAtlas) >- m_fontAtlas->drawText(context, m_layerRenderer->layerTreeAsText(), IntPoint(2, top), hudSize); >-} >- >-const CCSettings& CCHeadsUpDisplay::settings() const >-{ >- return m_layerRenderer->settings(); >-} >- > } > > #endif // USE(ACCELERATED_COMPOSITING) >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h >index 200ea06fb4071f7b040418c8c1b8edae4884ad5b..7ec05b0167e665fc931a1bdb04515871fada1615 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h >@@ -27,58 +27,56 @@ > > #if USE(ACCELERATED_COMPOSITING) > >-#include "CCFontAtlas.h" > #include "ProgramBinding.h" > #include "ShaderChromium.h" >+#include "cc/CCFontAtlas.h" > > namespace WebCore { > >-struct CCSettings; >-class GeometryBinding; >-class GraphicsContext3D; >-class LayerRendererChromium; >+class CCLayerTreeHostImpl; >+class GraphicsContext; > class ManagedTexture; >+struct CCSettings; > > // Class that handles drawing of composited render layers using GL. > class CCHeadsUpDisplay { > WTF_MAKE_NONCOPYABLE(CCHeadsUpDisplay); > public: >- static PassOwnPtr<CCHeadsUpDisplay> create(LayerRendererChromium* owner, CCFontAtlas* headsUpDisplayFontAtlas) >+ static PassOwnPtr<CCHeadsUpDisplay> create() > { >- return adoptPtr(new CCHeadsUpDisplay(owner, headsUpDisplayFontAtlas)); >+ return adoptPtr(new CCHeadsUpDisplay()); > } > > ~CCHeadsUpDisplay(); > >+ void setFontAtlas(PassOwnPtr<CCFontAtlas>); >+ > int currentFrameNumber() const { return m_currentFrameNumber; } > > void onFrameBegin(double timestamp); > void onSwapBuffers(); > >- bool enabled() const; >- void draw(); >+ bool enabled(const CCSettings&) const; >+ void draw(CCLayerTreeHostImpl*); > > typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexSwizzleAlpha> Program; > > private: >- CCHeadsUpDisplay(LayerRendererChromium* owner, CCFontAtlas* headsUpDisplayFontAtlas); >- void drawHudContents(GraphicsContext*, const IntSize& hudSize); >+ CCHeadsUpDisplay(); >+ >+ void drawHudContents(GraphicsContext*, CCLayerTreeHostImpl*, const CCSettings&, const IntSize& hudSize); > void drawFPSCounter(GraphicsContext*, int top, int height); > void drawFPSCounterText(GraphicsContext*, int top, int width, int height); >- void drawPlatformLayerTree(GraphicsContext*, const IntSize hudSize, int top); >- const CCSettings& settings() const; > bool isBadFrame(int frameNumber) const; > int frameIndex(int frameNumber) const; > void getAverageFPSAndStandardDeviation(double *average, double *standardDeviation) const; > >- bool showPlatformLayerTree() const; >+ bool showPlatformLayerTree(const CCSettings&) const; > > int m_currentFrameNumber; > > OwnPtr<ManagedTexture> m_hudTexture; > >- LayerRendererChromium* m_layerRenderer; >- > static const int kBeginFrameHistorySize = 120; > // The number of seconds of no frames makes us decide that the previous > // animation is over. >@@ -87,9 +85,7 @@ private: > static const double kFrameTooFast; > static const int kNumMissedFramesForReset = 5; > >- bool m_useMapSubForUploads; >- >- CCFontAtlas* m_fontAtlas; >+ OwnPtr<CCFontAtlas> m_fontAtlas; > }; > > } >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >index d6e1fe2df804f674400dcca6f32f378cc51574ba..1c77caf25a94c9c5d48cf8aef39cf1aadf020146 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >@@ -91,6 +91,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings > bool CCLayerTreeHost::initialize() > { > TRACE_EVENT("CCLayerTreeHost::initialize", this, 0); >+ > if (CCProxy::hasImplThread()) > m_proxy = CCThreadProxy::create(this); > else >@@ -102,8 +103,10 @@ bool CCLayerTreeHost::initialize() > > // Only allocate the font atlas if we have reason to use the heads-up display. > if (m_settings.showFPSCounter || m_settings.showPlatformLayerTree) { >- m_headsUpDisplayFontAtlas = CCFontAtlas::create(); >- m_headsUpDisplayFontAtlas->initialize(); >+ TRACE_EVENT0("cc", "CCLayerTreeHost::initialize::initializeFontAtlas"); >+ OwnPtr<CCFontAtlas> fontAtlas(CCFontAtlas::create()); >+ fontAtlas->initialize(); >+ m_proxy->setFontAtlas(fontAtlas.release()); > } > > m_compositorIdentifier = m_proxy->compositorIdentifier(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >index 3f6f4c2f6357e7b170585420f6ddb53e6e8da8c5..8e3d5e4dcad7dd118805eab029262ea9893a6034 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >@@ -43,7 +43,6 @@ > > namespace WebCore { > >-class CCFontAtlas; > class CCLayerTreeHostImpl; > class CCLayerTreeHostImplClient; > class CCTextureUpdater; >@@ -219,8 +218,6 @@ public: > bool requestPartialTextureUpdate(); > void deleteTextureAfterCommit(PassOwnPtr<ManagedTexture>); > >- CCFontAtlas* headsUpDisplayFontAtlas() { return m_headsUpDisplayFontAtlas.get(); } >- > protected: > CCLayerTreeHost(CCLayerTreeHostClient*, const CCSettings&); > bool initialize(); >@@ -264,9 +261,6 @@ private: > > CCSettings m_settings; > >- // This is owned by the main layer tree host because it needs to be initialized on the main thread. >- OwnPtr<CCFontAtlas> m_headsUpDisplayFontAtlas; >- > IntSize m_viewportSize; > bool m_visible; > typedef HashMap<GraphicsContext3D*, RefPtr<RateLimiter> > RateLimiterMap; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >index 60fd5fe2d4802fff54462d3b1a0d86a16b99fbed..0886fd6fd6edc65a8a85ce0c68cb0e5adca59612 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >@@ -107,6 +107,7 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCSettings& settings, CCLayerTree > , m_scrollLayerImpl(0) > , m_settings(settings) > , m_visible(true) >+ , m_headsUpDisplay(CCHeadsUpDisplay::create()) > , m_pageScale(1) > , m_pageScaleDelta(1) > , m_sentPageScaleDelta(1) >@@ -125,8 +126,8 @@ CCLayerTreeHostImpl::~CCLayerTreeHostImpl() > ASSERT(CCProxy::isImplThread()); > TRACE_EVENT("CCLayerTreeHostImpl::~CCLayerTreeHostImpl()", this, 0); > >- if (rootLayer()) >- clearRenderSurfacesOnCCLayerImplRecursive(rootLayer()); >+ if (m_rootLayerImpl) >+ clearRenderSurfacesOnCCLayerImplRecursive(m_rootLayerImpl.get()); > } > > void CCLayerTreeHostImpl::beginCommit() >@@ -142,7 +143,7 @@ void CCLayerTreeHostImpl::commitComplete() > > bool CCLayerTreeHostImpl::canDraw() > { >- if (!rootLayer()) >+ if (!m_rootLayerImpl) > return false; > if (viewportSize().isEmpty()) > return false; >@@ -238,26 +239,26 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(CCRenderPassList& passes, CCLaye > ASSERT(passes.isEmpty()); > ASSERT(renderSurfaceLayerList.isEmpty()); > >- renderSurfaceLayerList.append(rootLayer()); >+ renderSurfaceLayerList.append(m_rootLayerImpl.get()); > >- if (!rootLayer()->renderSurface()) >- rootLayer()->createRenderSurface(); >- rootLayer()->renderSurface()->clearLayerList(); >- rootLayer()->renderSurface()->setContentRect(IntRect(IntPoint(), viewportSize())); >+ if (!m_rootLayerImpl->renderSurface()) >+ m_rootLayerImpl->createRenderSurface(); >+ m_rootLayerImpl->renderSurface()->clearLayerList(); >+ m_rootLayerImpl->renderSurface()->setContentRect(IntRect(IntPoint(), viewportSize())); > >- rootLayer()->setClipRect(IntRect(IntPoint(), viewportSize())); >+ m_rootLayerImpl->setClipRect(IntRect(IntPoint(), viewportSize())); > > { > TransformationMatrix identityMatrix; > TRACE_EVENT("CCLayerTreeHostImpl::calcDrawEtc", this, 0); >- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer(), rootLayer(), identityMatrix, identityMatrix, renderSurfaceLayerList, rootLayer()->renderSurface()->layerList(), &m_layerSorter, layerRendererCapabilities().maxTextureSize); >+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(m_rootLayerImpl.get(), m_rootLayerImpl.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, m_rootLayerImpl->renderSurface()->layerList(), &m_layerSorter, layerRendererCapabilities().maxTextureSize); > } > > TRACE_EVENT1("webkit", "CCLayerTreeHostImpl::calculateRenderPasses", "renderSurfaceLayerList.size()", static_cast<long long unsigned>(renderSurfaceLayerList.size())); > > if (layerRendererCapabilities().usingPartialSwap) >- trackDamageForAllSurfaces(rootLayer(), renderSurfaceLayerList); >- m_rootDamageRect = rootLayer()->renderSurface()->damageTracker()->currentDamageRect(); >+ trackDamageForAllSurfaces(m_rootLayerImpl.get(), renderSurfaceLayerList); >+ m_rootDamageRect = m_rootLayerImpl->renderSurface()->damageTracker()->currentDamageRect(); > > // Create the render passes in dependency order. > HashMap<CCRenderSurface*, CCRenderPass*> surfacePassMap; >@@ -325,7 +326,7 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(CCRenderPassList& passes, CCLaye > occlusionTracker.markOccludedBehindLayer(*it); > } > >- passes.last()->appendQuadsToFillScreen(rootLayer(), m_backgroundColor, occlusionTracker); >+ passes.last()->appendQuadsToFillScreen(m_rootLayerImpl.get(), m_backgroundColor, occlusionTracker); > > if (drawFrame) > occlusionTracker.overdrawMetrics().recordMetrics(this); >@@ -376,7 +377,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) > frame.renderPasses.clear(); > frame.renderSurfaceLayerList.clear(); > >- if (!rootLayer()) >+ if (!m_rootLayerImpl) > return false; > > if (!calculateRenderPasses(frame.renderPasses, frame.renderSurfaceLayerList)) >@@ -391,10 +392,16 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) > TRACE_EVENT("CCLayerTreeHostImpl::drawLayers", this, 0); > ASSERT(m_layerRenderer); > >- if (!rootLayer()) >+ if (!m_rootLayerImpl) > return; > >- m_layerRenderer->beginDrawingFrame(); >+ // FIXME: use the frame begin time from the overall compositor scheduler. >+ // This value is currently inaccessible because it is up in Chromium's >+ // RenderWidget. >+ m_headsUpDisplay->onFrameBegin(currentTime()); >+ >+ m_layerRenderer->beginDrawingFrame(m_rootLayerImpl->renderSurface()); >+ > for (size_t i = 0; i < frame.renderPasses.size(); ++i) > m_layerRenderer->drawRenderPass(frame.renderPasses[i].get()); > >@@ -405,12 +412,15 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) > if (it.representsItself() && !it->visibleLayerRect().isEmpty()) > it->didDraw(); > } >+ if (m_headsUpDisplay->enabled(settings())) >+ m_headsUpDisplay->draw(this); >+ > m_layerRenderer->finishDrawingFrame(); > > ++m_frameNumber; > > // The next frame should start by assuming nothing has changed, and changes are noted as they occur. >- rootLayer()->resetAllChangeTrackingForSubtree(); >+ m_rootLayerImpl->resetAllChangeTrackingForSubtree(); > } > > void CCLayerTreeHostImpl::finishAllRendering() >@@ -437,6 +447,7 @@ TextureAllocator* CCLayerTreeHostImpl::contentsTextureAllocator() const > bool CCLayerTreeHostImpl::swapBuffers() > { > ASSERT(m_layerRenderer); >+ m_headsUpDisplay->onSwapBuffers(); > return m_layerRenderer->swapBuffers(enclosingIntRect(m_rootDamageRect)); > } > >@@ -497,16 +508,16 @@ void CCLayerTreeHostImpl::setVisible(bool visible) > m_timeSourceClientAdapter->setActive(shouldTickInBackground); > } > >-bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D> context, CCFontAtlas* headsUpDisplayFontAtlas) >+bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D> context) > { > OwnPtr<LayerRendererChromium> layerRenderer; >- layerRenderer = LayerRendererChromium::create(this, context, headsUpDisplayFontAtlas); >+ layerRenderer = LayerRendererChromium::create(this, context); > > // Since we now have a new context/layerRenderer, we cannot continue to use the old > // resources (i.e. renderSurfaces and texture IDs). >- if (rootLayer()) { >- clearRenderSurfacesOnCCLayerImplRecursive(rootLayer()); >- sendDidLoseContextRecursive(rootLayer()); >+ if (m_rootLayerImpl) { >+ clearRenderSurfacesOnCCLayerImplRecursive(m_rootLayerImpl.get()); >+ sendDidLoseContextRecursive(m_rootLayerImpl.get()); > } > > m_layerRenderer = layerRenderer.release(); >@@ -775,8 +786,8 @@ PassOwnPtr<CCScrollAndScaleSet> CCLayerTreeHostImpl::processScrollDeltas() > > void CCLayerTreeHostImpl::setFullRootLayerDamage() > { >- if (rootLayer()) { >- CCRenderSurface* renderSurface = rootLayer()->renderSurface(); >+ if (m_rootLayerImpl) { >+ CCRenderSurface* renderSurface = m_rootLayerImpl->renderSurface(); > if (renderSurface) > renderSurface->damageTracker()->forceFullDamageNextUpdate(); > } >@@ -843,6 +854,32 @@ void CCLayerTreeHostImpl::clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl* > current->clearRenderSurface(); > } > >+String CCLayerTreeHostImpl::layerTreeAsText() const >+{ >+ TextStream ts; >+ if (m_rootLayerImpl) { >+ ts << m_rootLayerImpl->layerTreeAsText(); >+ ts << "RenderSurfaces:\n"; >+ dumpRenderSurfaces(ts, 1, m_rootLayerImpl.get()); >+ } >+ return ts.release(); >+} >+ >+void CCLayerTreeHostImpl::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) >+{ >+ m_headsUpDisplay->setFontAtlas(fontAtlas); >+} >+ >+void CCLayerTreeHostImpl::dumpRenderSurfaces(TextStream& ts, int indent, const CCLayerImpl* layer) const >+{ >+ if (layer->renderSurface()) >+ layer->renderSurface()->dumpSurface(ts, indent); >+ >+ for (size_t i = 0; i < layer->children().size(); ++i) >+ dumpRenderSurfaces(ts, indent, layer->children()[i].get()); >+} >+ >+ > void CCLayerTreeHostImpl::animateGestures(double monotonicTime) > { > if (!m_activeGestureAnimation) >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >index 0cb0824750f9c32ef991f080cad0368e300dd744..57b29bc5fc187ee8f34a10484d636351220577d3 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >@@ -97,8 +97,6 @@ public: > // LayerRendererChromiumClient implementation > virtual const IntSize& viewportSize() const OVERRIDE { return m_viewportSize; } > virtual const CCSettings& settings() const OVERRIDE { return m_settings; } >- virtual CCLayerImpl* rootLayer() OVERRIDE { return m_rootLayerImpl.get(); } >- virtual const CCLayerImpl* rootLayer() const OVERRIDE { return m_rootLayerImpl.get(); } > virtual void didLoseContext() OVERRIDE; > virtual void onSwapBuffersComplete() OVERRIDE; > virtual void setFullRootLayerDamage() OVERRIDE; >@@ -107,10 +105,13 @@ public: > bool canDraw(); > GraphicsContext3D* context(); > >+ String layerTreeAsText() const; >+ void setFontAtlas(PassOwnPtr<CCFontAtlas>); >+ > void finishAllRendering(); > int frameNumber() const { return m_frameNumber; } > >- bool initializeLayerRenderer(PassRefPtr<GraphicsContext3D>, CCFontAtlas* headsUpDisplayFontAtlas = 0); >+ bool initializeLayerRenderer(PassRefPtr<GraphicsContext3D>); > bool isContextLost(); > LayerRendererChromium* layerRenderer() { return m_layerRenderer.get(); } > const LayerRendererCapabilities& layerRendererCapabilities() const; >@@ -122,6 +123,7 @@ public: > > void setRootLayer(PassOwnPtr<CCLayerImpl>); > PassOwnPtr<CCLayerImpl> releaseRootLayer() { return m_rootLayerImpl.release(); } >+ CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); } > > CCLayerImpl* scrollLayer() const { return m_scrollLayerImpl; } > >@@ -178,6 +180,8 @@ private: > void sendDidLoseContextRecursive(CCLayerImpl*); > void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl*); > >+ void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const; >+ > OwnPtr<LayerRendererChromium> m_layerRenderer; > OwnPtr<CCLayerImpl> m_rootLayerImpl; > CCLayerImpl* m_scrollLayerImpl; >@@ -185,6 +189,8 @@ private: > IntSize m_viewportSize; > bool m_visible; > >+ OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay; >+ > float m_pageScale; > float m_pageScaleDelta; > float m_sentPageScaleDelta; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h >index 2678054758af30e9be255e0c42acc8d3a58a8922..7f9e1c59167dbc04d76b54559b54fbb49a8b7887 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h >@@ -33,6 +33,7 @@ > > namespace WebCore { > >+class CCFontAtlas; > class CCThread; > class GraphicsContext3D; > struct LayerRendererCapabilities; >@@ -90,6 +91,8 @@ public: > // Maximum number of sub-region texture updates supported for each commit. > virtual size_t maxPartialTextureUpdates() const = 0; > >+ virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) = 0; >+ > // Debug hooks > #ifndef NDEBUG > static bool isMainThread(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp >index b139cd4daf63eefb1d5543ab353f12f6decdd8ff..807d80b7893a822efe82c668aee5fd5cdf79a743 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp >@@ -132,7 +132,7 @@ bool CCSingleThreadProxy::initializeLayerRenderer() > ASSERT(m_contextBeforeInitialization); > { > DebugScopedSetImplThread impl; >- bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitialization.release(), m_layerTreeHost->headsUpDisplayFontAtlas()); >+ bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitialization.release()); > if (ok) { > m_layerRendererInitialized = true; > m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); >@@ -156,7 +156,7 @@ bool CCSingleThreadProxy::recreateContext() > { > DebugScopedSetImplThread impl; > m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); >- initialized = m_layerTreeHostImpl->initializeLayerRenderer(context, m_layerTreeHost->headsUpDisplayFontAtlas()); >+ initialized = m_layerTreeHostImpl->initializeLayerRenderer(context); > if (initialized) { > m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); > } >@@ -259,6 +259,13 @@ void CCSingleThreadProxy::stop() > m_layerTreeHost = 0; > } > >+void CCSingleThreadProxy::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) >+{ >+ ASSERT(isMainThread()); >+ DebugScopedSetImplThread impl; >+ m_layerTreeHostImpl->setFontAtlas(fontAtlas); >+} >+ > void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector> events, double wallClockTime) > { > ASSERT(CCProxy::isImplThread()); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h >index 339beaa36e21495586eedf79256fe477fc6cc55f..9452b996d249eadffab2b89903282b911de768c6 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h >@@ -61,6 +61,7 @@ public: > virtual void start() OVERRIDE; > virtual void stop() OVERRIDE; > virtual size_t maxPartialTextureUpdates() const OVERRIDE { return std::numeric_limits<size_t>::max(); } >+ virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) OVERRIDE; > > // CCLayerTreeHostImplClient implementation > virtual void didLoseContextOnImplThread() OVERRIDE { } >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >index 20325efe0086fb92e9c739a53c87706034f07e2a..7e997241bc77c83be0e27902b63c76e57ec61900 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >@@ -716,7 +716,7 @@ void CCThreadProxy::initializeLayerRendererOnImplThread(CCCompletionEvent* compl > TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnImplThread", this, 0); > ASSERT(isImplThread()); > ASSERT(m_contextBeforeInitializationOnImplThread); >- *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitializationOnImplThread.release(), m_layerTreeHost->headsUpDisplayFontAtlas()); >+ *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitializationOnImplThread.release()); > if (*initializeSucceeded) { > *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); > if (capabilities->usingSwapCompleteCallback) >@@ -748,12 +748,25 @@ size_t CCThreadProxy::maxPartialTextureUpdates() const > return textureUpdatesPerFrame; > } > >+void CCThreadProxy::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) >+{ >+ ASSERT(isMainThread()); >+ CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setFontAtlasOnImplThread, fontAtlas)); >+ >+} >+ >+void CCThreadProxy::setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas> fontAtlas) >+{ >+ ASSERT(isImplThread()); >+ m_layerTreeHostImpl->setFontAtlas(fontAtlas); >+} >+ > void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, GraphicsContext3D* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities) > { > TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); > ASSERT(isImplThread()); > m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); >- *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(contextPtr), m_layerTreeHost->headsUpDisplayFontAtlas()); >+ *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(contextPtr)); > if (*recreateSucceeded) { > *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); > m_schedulerOnImplThread->didRecreateContext(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >index 707f4e151d30531a6da465b53170c832bfec79f8..76c2e37cd6c0155f9a592b8b387133cd80c91e43 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >@@ -70,6 +70,7 @@ public: > virtual void start() OVERRIDE; > virtual void stop() OVERRIDE; > virtual size_t maxPartialTextureUpdates() const OVERRIDE; >+ virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) OVERRIDE; > > // CCLayerTreeHostImplClient implementation > virtual void didLoseContextOnImplThread() OVERRIDE; >@@ -134,6 +135,7 @@ private: > void setFullRootLayerDamageOnImplThread(); > void recreateContextOnImplThread(CCCompletionEvent*, GraphicsContext3D*, bool* recreateSucceeded, LayerRendererCapabilities*); > CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw); >+ void setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas>); > > // Accessed on main thread only. > bool m_animateRequested; >diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp >index 12003a5801d6efb0082f131239539b8689b29222..d2fa091c022d4959e82bbd0c97c62fc89e1dc551 100644 >--- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp >+++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp >@@ -73,8 +73,6 @@ public: > // LayerRendererChromiumClient methods. > virtual const IntSize& viewportSize() const OVERRIDE { static IntSize fakeSize; return fakeSize; } > virtual const CCSettings& settings() const OVERRIDE { static CCSettings fakeSettings; return fakeSettings; } >- virtual CCLayerImpl* rootLayer() OVERRIDE { return m_rootLayer.get(); } >- virtual const CCLayerImpl* rootLayer() const OVERRIDE { return m_rootLayer.get(); } > virtual void didLoseContext() OVERRIDE { } > virtual void onSwapBuffersComplete() OVERRIDE { } > virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCount++; } >@@ -82,6 +80,8 @@ public: > // Methods added for test. > int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; } > >+ CCLayerImpl* rootLayer() { return m_rootLayer.get(); } >+ > private: > int m_setFullRootLayerDamageCount; > DebugScopedSetImplThread m_implThread; >@@ -193,7 +193,7 @@ TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatredForScopeDuratio > EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); > EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); > >- m_layerRendererChromium.beginDrawingFrame(); >+ m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootLayer()->renderSurface()); > EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); > > swapBuffers();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 83415
:
136118
|
136208
|
136493
|
137166
| 137187