| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 if (!m_rendererInitialized) | 478 if (!m_rendererInitialized) |
| 479 return false; | 479 return false; |
| 480 } | 480 } |
| 481 if (m_contextLost) { | 481 if (m_contextLost) { |
| 482 if (recreateContext() != RecreateSucceeded) | 482 if (recreateContext() != RecreateSucceeded) |
| 483 return false; | 483 return false; |
| 484 } | 484 } |
| 485 return true; | 485 return true; |
| 486 } | 486 } |
| 487 | 487 |
| 488 void LayerTreeHost::updateLayers(TextureUpdateQueue& queue, size_t memoryAllocat
ionLimitBytes) | 488 void LayerTreeHost::updateLayers(ResourceUpdateQueue& queue, size_t memoryAlloca
tionLimitBytes) |
| 489 { | 489 { |
| 490 DCHECK(m_rendererInitialized); | 490 DCHECK(m_rendererInitialized); |
| 491 DCHECK(memoryAllocationLimitBytes); | 491 DCHECK(memoryAllocationLimitBytes); |
| 492 | 492 |
| 493 if (!rootLayer()) | 493 if (!rootLayer()) |
| 494 return; | 494 return; |
| 495 | 495 |
| 496 if (layoutViewportSize().isEmpty()) | 496 if (layoutViewportSize().isEmpty()) |
| 497 return; | 497 return; |
| 498 | 498 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 511 | 511 |
| 512 for (size_t i = 0; i < layer->children().size(); ++i) { | 512 for (size_t i = 0; i < layer->children().size(); ++i) { |
| 513 Layer* found = findFirstScrollableLayer(layer->children()[i].get()); | 513 Layer* found = findFirstScrollableLayer(layer->children()[i].get()); |
| 514 if (found) | 514 if (found) |
| 515 return found; | 515 return found; |
| 516 } | 516 } |
| 517 | 517 |
| 518 return 0; | 518 return 0; |
| 519 } | 519 } |
| 520 | 520 |
| 521 void LayerTreeHost::updateLayers(Layer* rootLayer, TextureUpdateQueue& queue) | 521 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue) |
| 522 { | 522 { |
| 523 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); | 523 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); |
| 524 | 524 |
| 525 LayerList updateList; | 525 LayerList updateList; |
| 526 | 526 |
| 527 { | 527 { |
| 528 if (Settings::pageScalePinchZoomEnabled()) { | 528 if (Settings::pageScalePinchZoomEnabled()) { |
| 529 Layer* rootScroll = findFirstScrollableLayer(rootLayer); | 529 Layer* rootScroll = findFirstScrollableLayer(rootLayer); |
| 530 if (rootScroll) | 530 if (rootScroll) |
| 531 rootScroll->setImplTransform(m_implTransform); | 531 rootScroll->setImplTransform(m_implTransform); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 continue; | 618 continue; |
| 619 | 619 |
| 620 if (bytes > maxBackgroundTextureBytes) | 620 if (bytes > maxBackgroundTextureBytes) |
| 621 maxBackgroundTextureBytes = bytes; | 621 maxBackgroundTextureBytes = bytes; |
| 622 if (!readbackBytes) | 622 if (!readbackBytes) |
| 623 readbackBytes = Texture::memorySizeBytes(m_deviceViewportSize, GL_RG
BA); | 623 readbackBytes = Texture::memorySizeBytes(m_deviceViewportSize, GL_RG
BA); |
| 624 } | 624 } |
| 625 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; | 625 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; |
| 626 } | 626 } |
| 627 | 627 |
| 628 bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, Textur
eUpdateQueue& queue) | 628 bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, Resour
ceUpdateQueue& queue) |
| 629 { | 629 { |
| 630 // Note: Masks and replicas only exist for layers that own render surfaces.
If we reach this point | 630 // Note: Masks and replicas only exist for layers that own render surfaces.
If we reach this point |
| 631 // in code, we already know that at least something will be drawn into this
render surface, so the | 631 // in code, we already know that at least something will be drawn into this
render surface, so the |
| 632 // mask and replica should be painted. | 632 // mask and replica should be painted. |
| 633 | 633 |
| 634 bool needMoreUpdates = false; | 634 bool needMoreUpdates = false; |
| 635 Layer* maskLayer = renderSurfaceLayer->maskLayer(); | 635 Layer* maskLayer = renderSurfaceLayer->maskLayer(); |
| 636 if (maskLayer) { | 636 if (maskLayer) { |
| 637 maskLayer->update(queue, 0, m_renderingStats); | 637 maskLayer->update(queue, 0, m_renderingStats); |
| 638 needMoreUpdates |= maskLayer->needMoreUpdates(); | 638 needMoreUpdates |= maskLayer->needMoreUpdates(); |
| 639 } | 639 } |
| 640 | 640 |
| 641 Layer* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurface
Layer->replicaLayer()->maskLayer() : 0; | 641 Layer* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurface
Layer->replicaLayer()->maskLayer() : 0; |
| 642 if (replicaMaskLayer) { | 642 if (replicaMaskLayer) { |
| 643 replicaMaskLayer->update(queue, 0, m_renderingStats); | 643 replicaMaskLayer->update(queue, 0, m_renderingStats); |
| 644 needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); | 644 needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); |
| 645 } | 645 } |
| 646 return needMoreUpdates; | 646 return needMoreUpdates; |
| 647 } | 647 } |
| 648 | 648 |
| 649 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList,
TextureUpdateQueue& queue) | 649 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList,
ResourceUpdateQueue& queue) |
| 650 { | 650 { |
| 651 // Use FrontToBack to allow for testing occlusion and performing culling dur
ing the tree walk. | 651 // Use FrontToBack to allow for testing occlusion and performing culling dur
ing the tree walk. |
| 652 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions:
:FrontToBack> LayerIteratorType; | 652 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions:
:FrontToBack> LayerIteratorType; |
| 653 | 653 |
| 654 bool needMoreUpdates = false; | 654 bool needMoreUpdates = false; |
| 655 bool recordMetricsForFrame = true; // FIXME: In the future, disable this whe
n about:tracing is off. | 655 bool recordMetricsForFrame = true; // FIXME: In the future, disable this whe
n about:tracing is off. |
| 656 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect(
), recordMetricsForFrame); | 656 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect(
), recordMetricsForFrame); |
| 657 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS
ize); | 657 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS
ize); |
| 658 | 658 |
| 659 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics(
)); | 659 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics(
)); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 else | 802 else |
| 803 layer->notifyAnimationFinished(wallClockTime); | 803 layer->notifyAnimationFinished(wallClockTime); |
| 804 } | 804 } |
| 805 } | 805 } |
| 806 | 806 |
| 807 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 807 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 808 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 808 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 809 } | 809 } |
| 810 | 810 |
| 811 } // namespace cc | 811 } // namespace cc |
| OLD | NEW |