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 "cc/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 PriorityCalculator::allowNothingCutoff()) | 215 PriorityCalculator::allowNothingCutoff()) |
216 , m_backgroundColor(0) | 216 , m_backgroundColor(0) |
217 , m_hasTransparentBackground(false) | 217 , m_hasTransparentBackground(false) |
218 , m_needsAnimateLayers(false) | 218 , m_needsAnimateLayers(false) |
219 , m_pinchGestureActive(false) | 219 , m_pinchGestureActive(false) |
220 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) | 220 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) |
221 , m_debugRectHistory(DebugRectHistory::create()) | 221 , m_debugRectHistory(DebugRectHistory::create()) |
222 , m_numImplThreadScrolls(0) | 222 , m_numImplThreadScrolls(0) |
223 , m_numMainThreadScrolls(0) | 223 , m_numMainThreadScrolls(0) |
224 , m_cumulativeNumLayersDrawn(0) | 224 , m_cumulativeNumLayersDrawn(0) |
| 225 , m_cumulativeNumMissingTiles(0) |
225 { | 226 { |
226 DCHECK(m_proxy->isImplThread()); | 227 DCHECK(m_proxy->isImplThread()); |
227 didVisibilityChange(this, m_visible); | 228 didVisibilityChange(this, m_visible); |
228 | 229 |
229 // TODO(nduca): For now, assume we have an active tree. This will be removed | 230 // TODO(nduca): For now, assume we have an active tree. This will be removed |
230 // in future patches. | 231 // in future patches. |
231 m_activeTree = LayerTreeImpl::create(this); | 232 m_activeTree = LayerTreeImpl::create(this); |
232 } | 233 } |
233 | 234 |
234 LayerTreeHostImpl::~LayerTreeHostImpl() | 235 LayerTreeHostImpl::~LayerTreeHostImpl() |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 | 546 |
546 appendQuadsForLayer(targetRenderPass, *it, occlusionTracker, app
endQuadsData); | 547 appendQuadsForLayer(targetRenderPass, *it, occlusionTracker, app
endQuadsData); |
547 } | 548 } |
548 | 549 |
549 ++m_cumulativeNumLayersDrawn; | 550 ++m_cumulativeNumLayersDrawn; |
550 } | 551 } |
551 | 552 |
552 if (appendQuadsData.hadOcclusionFromOutsideTargetSurface) | 553 if (appendQuadsData.hadOcclusionFromOutsideTargetSurface) |
553 targetRenderPass->has_occlusion_from_outside_target_surface = true; | 554 targetRenderPass->has_occlusion_from_outside_target_surface = true; |
554 | 555 |
555 if (appendQuadsData.hadMissingTiles) { | 556 if (appendQuadsData.numMissingTiles) { |
| 557 m_cumulativeNumMissingTiles += appendQuadsData.numMissingTiles; |
556 bool layerHasAnimatingTransform = it->screenSpaceTransformIsAnimatin
g() || it->drawTransformIsAnimating(); | 558 bool layerHasAnimatingTransform = it->screenSpaceTransformIsAnimatin
g() || it->drawTransformIsAnimating(); |
557 if (layerHasAnimatingTransform) | 559 if (layerHasAnimatingTransform) |
558 drawFrame = false; | 560 drawFrame = false; |
559 } | 561 } |
560 | 562 |
561 occlusionTracker.leaveLayer(it); | 563 occlusionTracker.leaveLayer(it); |
562 } | 564 } |
563 | 565 |
564 #ifndef NDEBUG | 566 #ifndef NDEBUG |
565 for (size_t i = 0; i < frame.renderPasses.size(); ++i) { | 567 for (size_t i = 0; i < frame.renderPasses.size(); ++i) { |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 return fpsCounter()->currentFrameNumber(); | 1585 return fpsCounter()->currentFrameNumber(); |
1584 } | 1586 } |
1585 | 1587 |
1586 void LayerTreeHostImpl::renderingStats(RenderingStats* stats) const | 1588 void LayerTreeHostImpl::renderingStats(RenderingStats* stats) const |
1587 { | 1589 { |
1588 stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber(); | 1590 stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber(); |
1589 stats->droppedFrameCount = fpsCounter()->droppedFrameCount(); | 1591 stats->droppedFrameCount = fpsCounter()->droppedFrameCount(); |
1590 stats->numImplThreadScrolls = m_numImplThreadScrolls; | 1592 stats->numImplThreadScrolls = m_numImplThreadScrolls; |
1591 stats->numMainThreadScrolls = m_numMainThreadScrolls; | 1593 stats->numMainThreadScrolls = m_numMainThreadScrolls; |
1592 stats->numLayersDrawn = m_cumulativeNumLayersDrawn; | 1594 stats->numLayersDrawn = m_cumulativeNumLayersDrawn; |
| 1595 stats->numMissingTiles = m_cumulativeNumMissingTiles; |
1593 | 1596 |
1594 if (m_tileManager) | 1597 if (m_tileManager) |
1595 m_tileManager->renderingStats(stats); | 1598 m_tileManager->renderingStats(stats); |
1596 } | 1599 } |
1597 | 1600 |
1598 void LayerTreeHostImpl::animateScrollbars(base::TimeTicks time) | 1601 void LayerTreeHostImpl::animateScrollbars(base::TimeTicks time) |
1599 { | 1602 { |
1600 animateScrollbarsRecursive(rootLayer(), time); | 1603 animateScrollbarsRecursive(rootLayer(), time); |
1601 } | 1604 } |
1602 | 1605 |
1603 void LayerTreeHostImpl::animateScrollbarsRecursive(LayerImpl* layer, base::TimeT
icks time) | 1606 void LayerTreeHostImpl::animateScrollbarsRecursive(LayerImpl* layer, base::TimeT
icks time) |
1604 { | 1607 { |
1605 if (!layer) | 1608 if (!layer) |
1606 return; | 1609 return; |
1607 | 1610 |
1608 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1611 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
1609 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1612 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
1610 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1613 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1611 m_client->setNeedsRedrawOnImplThread(); | 1614 m_client->setNeedsRedrawOnImplThread(); |
1612 | 1615 |
1613 for (size_t i = 0; i < layer->children().size(); ++i) | 1616 for (size_t i = 0; i < layer->children().size(); ++i) |
1614 animateScrollbarsRecursive(layer->children()[i], time); | 1617 animateScrollbarsRecursive(layer->children()[i], time); |
1615 } | 1618 } |
1616 | 1619 |
1617 } // namespace cc | 1620 } // namespace cc |
OLD | NEW |