| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 | 8 |
| 9 #include "Region.h" | 9 #include "Region.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 , showPlatformLayerTree(false) | 42 , showPlatformLayerTree(false) |
| 43 , showPaintRects(false) | 43 , showPaintRects(false) |
| 44 , showPropertyChangedRects(false) | 44 , showPropertyChangedRects(false) |
| 45 , showSurfaceDamageRects(false) | 45 , showSurfaceDamageRects(false) |
| 46 , showScreenSpaceRects(false) | 46 , showScreenSpaceRects(false) |
| 47 , showReplicaScreenSpaceRects(false) | 47 , showReplicaScreenSpaceRects(false) |
| 48 , showOccludingRects(false) | 48 , showOccludingRects(false) |
| 49 , renderVSyncEnabled(true) | 49 , renderVSyncEnabled(true) |
| 50 , refreshRate(0) | 50 , refreshRate(0) |
| 51 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 51 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
| 52 , defaultTileSize(IntSize(256, 256)) | 52 , defaultTileSize(gfx::Size(256, 256)) |
| 53 , maxUntiledLayerSize(IntSize(512, 512)) | 53 , maxUntiledLayerSize(gfx::Size(512, 512)) |
| 54 , minimumOcclusionTrackingSize(IntSize(160, 160)) | 54 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 LayerTreeSettings::~LayerTreeSettings() | 58 LayerTreeSettings::~LayerTreeSettings() |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 RendererCapabilities::RendererCapabilities() | 62 RendererCapabilities::RendererCapabilities() |
| 63 : bestTextureFormat(0) | 63 : bestTextureFormat(0) |
| 64 , contextHasCachedFrontBuffer(false) | 64 , contextHasCachedFrontBuffer(false) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Update m_settings based on capabilities that we got back from the rendere
r. | 160 // Update m_settings based on capabilities that we got back from the rendere
r. |
| 161 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler
atedPainting; | 161 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler
atedPainting; |
| 162 | 162 |
| 163 // Update m_settings based on partial update capability. | 163 // Update m_settings based on partial update capability. |
| 164 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate
s, m_proxy->maxPartialTextureUpdates()); | 164 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate
s, m_proxy->maxPartialTextureUpdates()); |
| 165 | 165 |
| 166 m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->ren
dererCapabilities().maxTextureSize, Renderer::ContentPool); | 166 m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->ren
dererCapabilities().maxTextureSize, Renderer::ContentPool); |
| 167 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize
(), GL_RGBA); | 167 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Si
ze(), GL_RGBA); |
| 168 | 168 |
| 169 m_rendererInitialized = true; | 169 m_rendererInitialized = true; |
| 170 | 170 |
| 171 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), | 171 m_settings.defaultTileSize = gfx::Size(min(m_settings.defaultTileSize.width(
), m_proxy->rendererCapabilities().maxTextureSize), |
| 172 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); | 172 min(m_settings.defaultTileSize.height
(), m_proxy->rendererCapabilities().maxTextureSize)); |
| 173 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), | 173 m_settings.maxUntiledLayerSize = gfx::Size(min(m_settings.maxUntiledLayerSiz
e.width(), m_proxy->rendererCapabilities().maxTextureSize), |
| 174 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); | 174 min(m_settings.maxUntiledLayerSiz
e.height(), m_proxy->rendererCapabilities().maxTextureSize)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 LayerTreeHost::RecreateResult LayerTreeHost::recreateContext() | 177 LayerTreeHost::RecreateResult LayerTreeHost::recreateContext() |
| 178 { | 178 { |
| 179 TRACE_EVENT0("cc", "LayerTreeHost::recreateContext"); | 179 TRACE_EVENT0("cc", "LayerTreeHost::recreateContext"); |
| 180 DCHECK(m_contextLost); | 180 DCHECK(m_contextLost); |
| 181 | 181 |
| 182 bool recreated = false; | 182 bool recreated = false; |
| 183 if (!m_numTimesRecreateShouldFail) | 183 if (!m_numTimesRecreateShouldFail) |
| 184 recreated = m_proxy->recreateContext(); | 184 recreated = m_proxy->recreateContext(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 m_rootLayer = rootLayer; | 401 m_rootLayer = rootLayer; |
| 402 if (m_rootLayer) | 402 if (m_rootLayer) |
| 403 m_rootLayer->setLayerTreeHost(this); | 403 m_rootLayer->setLayerTreeHost(this); |
| 404 | 404 |
| 405 if (m_hudLayer) | 405 if (m_hudLayer) |
| 406 m_hudLayer->removeFromParent(); | 406 m_hudLayer->removeFromParent(); |
| 407 | 407 |
| 408 setNeedsCommit(); | 408 setNeedsCommit(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void LayerTreeHost::setViewportSize(const IntSize& layoutViewportSize, const Int
Size& deviceViewportSize) | 411 void LayerTreeHost::setViewportSize(const gfx::Size& layoutViewportSize, const g
fx::Size& deviceViewportSize) |
| 412 { | 412 { |
| 413 if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_de
viceViewportSize) | 413 if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_de
viceViewportSize) |
| 414 return; | 414 return; |
| 415 | 415 |
| 416 m_layoutViewportSize = layoutViewportSize; | 416 m_layoutViewportSize = layoutViewportSize; |
| 417 m_deviceViewportSize = deviceViewportSize; | 417 m_deviceViewportSize = deviceViewportSize; |
| 418 | 418 |
| 419 setNeedsCommit(); | 419 setNeedsCommit(); |
| 420 } | 420 } |
| 421 | 421 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 } | 482 } |
| 483 | 483 |
| 484 void LayerTreeHost::updateLayers(TextureUpdateQueue& queue, size_t memoryAllocat
ionLimitBytes) | 484 void LayerTreeHost::updateLayers(TextureUpdateQueue& queue, size_t memoryAllocat
ionLimitBytes) |
| 485 { | 485 { |
| 486 DCHECK(m_rendererInitialized); | 486 DCHECK(m_rendererInitialized); |
| 487 DCHECK(memoryAllocationLimitBytes); | 487 DCHECK(memoryAllocationLimitBytes); |
| 488 | 488 |
| 489 if (!rootLayer()) | 489 if (!rootLayer()) |
| 490 return; | 490 return; |
| 491 | 491 |
| 492 if (layoutViewportSize().isEmpty()) | 492 if (layoutViewportSize().IsEmpty()) |
| 493 return; | 493 return; |
| 494 | 494 |
| 495 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; | 495 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; |
| 496 | 496 |
| 497 updateLayers(rootLayer(), queue); | 497 updateLayers(rootLayer(), queue); |
| 498 } | 498 } |
| 499 | 499 |
| 500 static Layer* findFirstScrollableLayer(Layer* layer) | 500 static Layer* findFirstScrollableLayer(Layer* layer) |
| 501 { | 501 { |
| 502 if (!layer) | 502 if (!layer) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics(
)); | 644 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics(
)); |
| 645 | 645 |
| 646 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); | 646 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); |
| 647 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { | 647 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { |
| 648 occlusionTracker.enterLayer(it); | 648 occlusionTracker.enterLayer(it); |
| 649 | 649 |
| 650 if (it.representsTargetRenderSurface()) { | 650 if (it.representsTargetRenderSurface()) { |
| 651 DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->dr
awOpacityIsAnimating()); | 651 DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->dr
awOpacityIsAnimating()); |
| 652 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); | 652 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); |
| 653 } else if (it.representsItself()) { | 653 } else if (it.representsItself()) { |
| 654 DCHECK(!it->bounds().isEmpty()); | 654 DCHECK(!it->bounds().IsEmpty()); |
| 655 it->update(queue, &occlusionTracker, m_renderingStats); | 655 it->update(queue, &occlusionTracker, m_renderingStats); |
| 656 needMoreUpdates |= it->needMoreUpdates(); | 656 needMoreUpdates |= it->needMoreUpdates(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 occlusionTracker.leaveLayer(it); | 659 occlusionTracker.leaveLayer(it); |
| 660 } | 660 } |
| 661 | 661 |
| 662 occlusionTracker.overdrawMetrics().recordMetrics(this); | 662 occlusionTracker.overdrawMetrics().recordMetrics(this); |
| 663 | 663 |
| 664 return needMoreUpdates; | 664 return needMoreUpdates; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 else | 792 else |
| 793 layer->notifyAnimationFinished(wallClockTime); | 793 layer->notifyAnimationFinished(wallClockTime); |
| 794 } | 794 } |
| 795 } | 795 } |
| 796 | 796 |
| 797 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 797 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 798 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 798 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 799 } | 799 } |
| 800 | 800 |
| 801 } // namespace cc | 801 } // namespace cc |
| OLD | NEW |