Chromium Code Reviews| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 | 130 |
| 131 LayerTreeHostImpl::FrameData::FrameData() | 131 LayerTreeHostImpl::FrameData::FrameData() |
| 132 : containsIncompleteTile(false) | 132 : containsIncompleteTile(false) |
| 133 { | 133 { |
| 134 } | 134 } |
| 135 | 135 |
| 136 LayerTreeHostImpl::FrameData::~FrameData() | 136 LayerTreeHostImpl::FrameData::~FrameData() |
| 137 { | 137 { |
| 138 } | 138 } |
| 139 | 139 |
| 140 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy) | 140 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy, RenderingStatsRecorder * renderingStatsRecorder) |
| 141 { | 141 { |
| 142 return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy)); | 142 return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy, render ingStatsRecorder)); |
| 143 } | 143 } |
| 144 | 144 |
| 145 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy) | 145 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy, RenderingStatsRecorder* renderingStatsRec order) |
| 146 : m_client(client) | 146 : m_client(client) |
| 147 , m_proxy(proxy) | 147 , m_proxy(proxy) |
| 148 , m_didLockScrollingLayer(false) | 148 , m_didLockScrollingLayer(false) |
| 149 , m_shouldBubbleScrolls(false) | 149 , m_shouldBubbleScrolls(false) |
| 150 , m_wheelScrolling(false) | 150 , m_wheelScrolling(false) |
| 151 , m_settings(settings) | 151 , m_settings(settings) |
| 152 , m_deviceScaleFactor(1) | 152 , m_deviceScaleFactor(1) |
| 153 , m_visible(true) | 153 , m_visible(true) |
| 154 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), | 154 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), |
| 155 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, | 155 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, |
| 156 0, | 156 0, |
| 157 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) | 157 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) |
| 158 , m_pinchGestureActive(false) | 158 , m_pinchGestureActive(false) |
| 159 , m_fpsCounter(FrameRateCounter::create(m_proxy->HasImplThread())) | 159 , m_fpsCounter(FrameRateCounter::create(m_proxy->HasImplThread())) |
| 160 , m_paintTimeCounter(PaintTimeCounter::create()) | 160 , m_paintTimeCounter(PaintTimeCounter::create()) |
| 161 , m_memoryHistory(MemoryHistory::create()) | 161 , m_memoryHistory(MemoryHistory::create()) |
| 162 , m_debugRectHistory(DebugRectHistory::create()) | 162 , m_debugRectHistory(DebugRectHistory::create()) |
| 163 , m_numImplThreadScrolls(0) | |
| 164 , m_numMainThreadScrolls(0) | |
| 165 , m_cumulativeNumLayersDrawn(0) | |
| 166 , m_cumulativeNumMissingTiles(0) | |
| 167 , m_lastSentMemoryVisibleBytes(0) | 163 , m_lastSentMemoryVisibleBytes(0) |
| 168 , m_lastSentMemoryVisibleAndNearbyBytes(0) | 164 , m_lastSentMemoryVisibleAndNearbyBytes(0) |
| 169 , m_lastSentMemoryUseBytes(0) | 165 , m_lastSentMemoryUseBytes(0) |
| 170 , m_animationRegistrar(AnimationRegistrar::create()) | 166 , m_animationRegistrar(AnimationRegistrar::create()) |
| 167 , m_renderingStatsRecorder(renderingStatsRecorder) | |
| 171 { | 168 { |
| 172 DCHECK(m_proxy->IsImplThread()); | 169 DCHECK(m_proxy->IsImplThread()); |
| 173 didVisibilityChange(this, m_visible); | 170 didVisibilityChange(this, m_visible); |
| 174 | 171 |
| 175 setDebugState(settings.initialDebugState); | 172 setDebugState(settings.initialDebugState); |
| 176 | 173 |
| 177 if (settings.calculateTopControlsPosition) { | 174 if (settings.calculateTopControlsPosition) { |
| 178 m_topControlsManager = TopControlsManager::Create(this, | 175 m_topControlsManager = TopControlsManager::Create(this, |
| 179 settings.topControlsHe ight, | 176 settings.topControlsHe ight, |
| 180 settings.topControlsSh owThreshold, | 177 settings.topControlsSh owThreshold, |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 occlusionTracker.set_non_occluding_screen_space_rects_container(&frame.n onOccludingScreenSpaceRects); | 463 occlusionTracker.set_non_occluding_screen_space_rects_container(&frame.n onOccludingScreenSpaceRects); |
| 467 | 464 |
| 468 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk. | 465 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk. |
| 469 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; | 466 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; |
| 470 | 467 |
| 471 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being | 468 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being |
| 472 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing | 469 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing |
| 473 // in the future. | 470 // in the future. |
| 474 bool drawFrame = true; | 471 bool drawFrame = true; |
| 475 | 472 |
| 473 int64 layersDrawn = 0; | |
| 474 | |
| 476 LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList) ; | 475 LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList) ; |
| 477 for (LayerIteratorType it = LayerIteratorType::begin(frame.renderSurfaceLaye rList); it != end; ++it) { | 476 for (LayerIteratorType it = LayerIteratorType::begin(frame.renderSurfaceLaye rList); it != end; ++it) { |
| 478 RenderPass::Id targetRenderPassId = it.targetRenderSurfaceLayer()->rende r_surface()->RenderPassId(); | 477 RenderPass::Id targetRenderPassId = it.targetRenderSurfaceLayer()->rende r_surface()->RenderPassId(); |
| 479 RenderPass* targetRenderPass = frame.renderPassesById[targetRenderPassId ]; | 478 RenderPass* targetRenderPass = frame.renderPassesById[targetRenderPassId ]; |
| 480 | 479 |
| 481 occlusionTracker.EnterLayer(it); | 480 occlusionTracker.EnterLayer(it); |
| 482 | 481 |
| 483 AppendQuadsData appendQuadsData(targetRenderPass->id); | 482 AppendQuadsData appendQuadsData(targetRenderPass->id); |
| 484 | 483 |
| 485 if (it.representsContributingRenderSurface()) { | 484 if (it.representsContributingRenderSurface()) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 504 AppendQuadsData appendQuadsData(renderPass->id); | 503 AppendQuadsData appendQuadsData(renderPass->id); |
| 505 appendQuadsForLayer(renderPass, *it, occlusionTracker, a ppendQuadsData); | 504 appendQuadsForLayer(renderPass, *it, occlusionTracker, a ppendQuadsData); |
| 506 | 505 |
| 507 contributingRenderPassId = it->NextContributingRenderPas sId(contributingRenderPassId); | 506 contributingRenderPassId = it->NextContributingRenderPas sId(contributingRenderPassId); |
| 508 } | 507 } |
| 509 } | 508 } |
| 510 | 509 |
| 511 appendQuadsForLayer(targetRenderPass, *it, occlusionTracker, app endQuadsData); | 510 appendQuadsForLayer(targetRenderPass, *it, occlusionTracker, app endQuadsData); |
| 512 } | 511 } |
| 513 | 512 |
| 514 ++m_cumulativeNumLayersDrawn; | 513 layersDrawn++; |
|
danakj
2013/03/13 17:25:41
++layersDrawn is best practice
egraether
2013/03/14 18:58:07
Done.
| |
| 515 } | 514 } |
| 516 | 515 |
| 517 if (appendQuadsData.hadOcclusionFromOutsideTargetSurface) | 516 if (appendQuadsData.hadOcclusionFromOutsideTargetSurface) |
| 518 targetRenderPass->has_occlusion_from_outside_target_surface = true; | 517 targetRenderPass->has_occlusion_from_outside_target_surface = true; |
| 519 | 518 |
| 520 if (appendQuadsData.numMissingTiles) { | 519 if (appendQuadsData.numMissingTiles) { |
| 521 m_cumulativeNumMissingTiles += appendQuadsData.numMissingTiles; | 520 m_renderingStatsRecorder->AddMissingTiles(appendQuadsData.numMissing Tiles); |
| 522 bool layerHasAnimatingTransform = it->screen_space_transform_is_anim ating() || it->draw_transform_is_animating(); | 521 bool layerHasAnimatingTransform = it->screen_space_transform_is_anim ating() || it->draw_transform_is_animating(); |
| 523 if (layerHasAnimatingTransform) | 522 if (layerHasAnimatingTransform) |
| 524 drawFrame = false; | 523 drawFrame = false; |
| 525 } | 524 } |
| 526 | 525 |
| 527 if (appendQuadsData.hadIncompleteTile) | 526 if (appendQuadsData.hadIncompleteTile) |
| 528 frame.containsIncompleteTile = true; | 527 frame.containsIncompleteTile = true; |
| 529 | 528 |
| 530 occlusionTracker.LeaveLayer(it); | 529 occlusionTracker.LeaveLayer(it); |
| 531 } | 530 } |
| 532 | 531 |
| 532 m_renderingStatsRecorder->AddLayersDrawn(layersDrawn); | |
| 533 | |
| 533 #ifndef NDEBUG | 534 #ifndef NDEBUG |
| 534 for (size_t i = 0; i < frame.renderPasses.size(); ++i) { | 535 for (size_t i = 0; i < frame.renderPasses.size(); ++i) { |
| 535 for (size_t j = 0; j < frame.renderPasses[i]->quad_list.size(); ++j) | 536 for (size_t j = 0; j < frame.renderPasses[i]->quad_list.size(); ++j) |
| 536 DCHECK(frame.renderPasses[i]->quad_list[j]->shared_quad_state); | 537 DCHECK(frame.renderPasses[i]->quad_list[j]->shared_quad_state); |
| 537 DCHECK(frame.renderPassesById.find(frame.renderPasses[i]->id) | 538 DCHECK(frame.renderPassesById.find(frame.renderPasses[i]->id) |
| 538 != frame.renderPassesById.end()); | 539 != frame.renderPassesById.end()); |
| 539 } | 540 } |
| 540 #endif | 541 #endif |
| 541 DCHECK(frame.renderPasses.back()->output_rect.origin().IsOrigin()); | 542 DCHECK(frame.renderPasses.back()->output_rect.origin().IsOrigin()); |
| 542 | 543 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 797 void LayerTreeHostImpl::drawLayers(FrameData& frame) | 798 void LayerTreeHostImpl::drawLayers(FrameData& frame) |
| 798 { | 799 { |
| 799 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); | 800 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); |
| 800 DCHECK(canDraw()); | 801 DCHECK(canDraw()); |
| 801 DCHECK(!frame.renderPasses.empty()); | 802 DCHECK(!frame.renderPasses.empty()); |
| 802 | 803 |
| 803 // FIXME: use the frame begin time from the overall compositor scheduler. | 804 // FIXME: use the frame begin time from the overall compositor scheduler. |
| 804 // This value is currently inaccessible because it is up in Chromium's | 805 // This value is currently inaccessible because it is up in Chromium's |
| 805 // RenderWidget. | 806 // RenderWidget. |
| 806 m_fpsCounter->saveTimeStamp(base::TimeTicks::Now()); | 807 m_fpsCounter->saveTimeStamp(base::TimeTicks::Now()); |
| 808 m_renderingStatsRecorder->SetScreenAndDroppedFrameCount(m_fpsCounter->curren tFrameNumber(), m_fpsCounter->droppedFrameCount()); | |
|
danakj
2013/03/13 17:25:41
"SetScreen" -> "SetFrameNumber" ? What's "Screen"
egraether
2013/03/14 18:58:07
I split this weird double call into separate calls
| |
| 807 | 809 |
| 808 if (m_tileManager) { | 810 if (m_tileManager) { |
| 809 m_memoryHistory->SaveEntry( | 811 m_memoryHistory->SaveEntry( |
| 810 m_tileManager->memory_stats_from_last_assign()); | 812 m_tileManager->memory_stats_from_last_assign()); |
| 811 } | 813 } |
| 812 | 814 |
| 813 if (m_debugState.showHudRects()) | 815 if (m_debugState.showHudRects()) |
| 814 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS paceRects, m_debugState); | 816 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS paceRects, m_debugState); |
| 815 | 817 |
| 816 if (m_debugState.traceAllRenderedFrames) { | 818 if (m_debugState.traceAllRenderedFrames) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 | 1019 |
| 1018 // Reduce wasted memory now that unlinked resources are guaranteed not | 1020 // Reduce wasted memory now that unlinked resources are guaranteed not |
| 1019 // to be used. | 1021 // to be used. |
| 1020 m_client->reduceWastedContentsTextureMemoryOnImplThread(); | 1022 m_client->reduceWastedContentsTextureMemoryOnImplThread(); |
| 1021 | 1023 |
| 1022 m_client->onCanDrawStateChanged(canDraw()); | 1024 m_client->onCanDrawStateChanged(canDraw()); |
| 1023 m_client->onHasPendingTreeStateChanged(pendingTree()); | 1025 m_client->onHasPendingTreeStateChanged(pendingTree()); |
| 1024 m_client->setNeedsRedrawOnImplThread(); | 1026 m_client->setNeedsRedrawOnImplThread(); |
| 1025 m_client->renewTreePriority(); | 1027 m_client->renewTreePriority(); |
| 1026 | 1028 |
| 1027 if (m_tileManager && m_debugState.continuousPainting) { | 1029 if (m_tileManager && m_debugState.continuousPainting) |
| 1028 RenderingStats stats; | 1030 m_paintTimeCounter->SaveRasterizeTime(m_renderingStatsRecorder->GetRende ringStats().totalRasterizeTimeForNowBinsOnPendingTree, m_activeTree->source_fram e_number()); |
| 1029 m_tileManager->GetRenderingStats(&stats); | |
| 1030 m_paintTimeCounter->SaveRasterizeTime(stats.totalRasterizeTimeForNowBins OnPendingTree, m_activeTree->source_frame_number()); | |
| 1031 } | |
| 1032 } | 1031 } |
| 1033 | 1032 |
| 1034 void LayerTreeHostImpl::setVisible(bool visible) | 1033 void LayerTreeHostImpl::setVisible(bool visible) |
| 1035 { | 1034 { |
| 1036 DCHECK(m_proxy->IsImplThread()); | 1035 DCHECK(m_proxy->IsImplThread()); |
| 1037 | 1036 |
| 1038 if (m_visible == visible) | 1037 if (m_visible == visible) |
| 1039 return; | 1038 return; |
| 1040 m_visible = visible; | 1039 m_visible = visible; |
| 1041 didVisibilityChange(this, m_visible); | 1040 didVisibilityChange(this, m_visible); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1069 m_resourceProvider.reset(); | 1068 m_resourceProvider.reset(); |
| 1070 m_outputSurface.reset(); | 1069 m_outputSurface.reset(); |
| 1071 | 1070 |
| 1072 if (!outputSurface->BindToClient(this)) | 1071 if (!outputSurface->BindToClient(this)) |
| 1073 return false; | 1072 return false; |
| 1074 | 1073 |
| 1075 scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::Create(out putSurface.get()); | 1074 scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::Create(out putSurface.get()); |
| 1076 if (!resourceProvider) | 1075 if (!resourceProvider) |
| 1077 return false; | 1076 return false; |
| 1078 | 1077 |
| 1079 if (m_settings.implSidePainting) { | 1078 if (m_settings.implSidePainting) |
|
danakj
2013/03/13 17:25:41
keep the {}
egraether
2013/03/14 18:58:07
Done.
| |
| 1080 m_tileManager.reset(new TileManager(this, | 1079 m_tileManager.reset(new TileManager(this, |
| 1081 resourceProvider.get(), | 1080 resourceProvider.get(), |
| 1082 m_settings.numRasterThreads, | 1081 m_settings.numRasterThreads, |
| 1082 m_renderingStatsRecorder, | |
| 1083 m_settings.useCheapnessEstimator, | 1083 m_settings.useCheapnessEstimator, |
| 1084 m_settings.useColorEstimator, | 1084 m_settings.useColorEstimator, |
| 1085 m_settings.predictionBenchmarking)); | 1085 m_settings.predictionBenchmarking)); |
| 1086 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ()); | |
| 1087 } | |
| 1088 | 1086 |
| 1089 if (outputSurface->capabilities().has_parent_compositor) | 1087 if (outputSurface->capabilities().has_parent_compositor) |
| 1090 m_renderer = DelegatingRenderer::Create(this, outputSurface.get(), resou rceProvider.get()); | 1088 m_renderer = DelegatingRenderer::Create(this, outputSurface.get(), resou rceProvider.get()); |
| 1091 else if (outputSurface->context3d()) | 1089 else if (outputSurface->context3d()) |
| 1092 m_renderer = GLRenderer::create(this, outputSurface.get(), resourceProvi der.get()); | 1090 m_renderer = GLRenderer::create(this, outputSurface.get(), resourceProvi der.get()); |
| 1093 else if (outputSurface->software_device()) | 1091 else if (outputSurface->software_device()) |
| 1094 m_renderer = SoftwareRenderer::Create(this, outputSurface.get(), resourc eProvider.get()); | 1092 m_renderer = SoftwareRenderer::Create(this, outputSurface.get(), resourc eProvider.get()); |
| 1095 if (!m_renderer) | 1093 if (!m_renderer) |
| 1096 return false; | 1094 return false; |
| 1097 | 1095 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1194 | 1192 |
| 1195 // First find out which layer was hit from the saved list of visible layers | 1193 // First find out which layer was hit from the saved list of visible layers |
| 1196 // in the most recent frame. | 1194 // in the most recent frame. |
| 1197 LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(device ViewportPoint, activeTree()->RenderSurfaceLayerList()); | 1195 LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(device ViewportPoint, activeTree()->RenderSurfaceLayerList()); |
| 1198 | 1196 |
| 1199 // Walk up the hierarchy and look for a scrollable layer. | 1197 // Walk up the hierarchy and look for a scrollable layer. |
| 1200 LayerImpl* potentiallyScrollingLayerImpl = 0; | 1198 LayerImpl* potentiallyScrollingLayerImpl = 0; |
| 1201 for (; layerImpl; layerImpl = layerImpl->parent()) { | 1199 for (; layerImpl; layerImpl = layerImpl->parent()) { |
| 1202 // The content layer can also block attempts to scroll outside the main thread. | 1200 // The content layer can also block attempts to scroll outside the main thread. |
| 1203 if (layerImpl->TryScroll(deviceViewportPoint, type) == ScrollOnMainThrea d) { | 1201 if (layerImpl->TryScroll(deviceViewportPoint, type) == ScrollOnMainThrea d) { |
| 1204 m_numMainThreadScrolls++; | 1202 m_renderingStatsRecorder->IncrementMainThreadScrolls(); |
| 1205 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 1203 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
| 1206 return ScrollOnMainThread; | 1204 return ScrollOnMainThread; |
| 1207 } | 1205 } |
| 1208 | 1206 |
| 1209 LayerImpl* scrollLayerImpl = findScrollLayerForContentLayer(layerImpl); | 1207 LayerImpl* scrollLayerImpl = findScrollLayerForContentLayer(layerImpl); |
| 1210 if (!scrollLayerImpl) | 1208 if (!scrollLayerImpl) |
| 1211 continue; | 1209 continue; |
| 1212 | 1210 |
| 1213 ScrollStatus status = scrollLayerImpl->TryScroll(deviceViewportPoint, ty pe); | 1211 ScrollStatus status = scrollLayerImpl->TryScroll(deviceViewportPoint, ty pe); |
| 1214 | 1212 |
| 1215 // If any layer wants to divert the scroll event to the main thread, abo rt. | 1213 // If any layer wants to divert the scroll event to the main thread, abo rt. |
| 1216 if (status == ScrollOnMainThread) { | 1214 if (status == ScrollOnMainThread) { |
| 1217 m_numMainThreadScrolls++; | 1215 m_renderingStatsRecorder->IncrementMainThreadScrolls(); |
| 1218 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 1216 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
| 1219 return ScrollOnMainThread; | 1217 return ScrollOnMainThread; |
| 1220 } | 1218 } |
| 1221 | 1219 |
| 1222 if (status == ScrollStarted && !potentiallyScrollingLayerImpl) | 1220 if (status == ScrollStarted && !potentiallyScrollingLayerImpl) |
| 1223 potentiallyScrollingLayerImpl = scrollLayerImpl; | 1221 potentiallyScrollingLayerImpl = scrollLayerImpl; |
| 1224 } | 1222 } |
| 1225 | 1223 |
| 1226 // When hiding top controls is enabled and the controls are hidden or | 1224 // When hiding top controls is enabled and the controls are hidden or |
| 1227 // overlaying the content, force scrolls to be enabled on the root layer to | 1225 // overlaying the content, force scrolls to be enabled on the root layer to |
| 1228 // allow bringing the top controls back into view. | 1226 // allow bringing the top controls back into view. |
| 1229 if (!potentiallyScrollingLayerImpl && m_topControlsManager && | 1227 if (!potentiallyScrollingLayerImpl && m_topControlsManager && |
| 1230 m_topControlsManager->content_top_offset() != m_settings.topControls Height) { | 1228 m_topControlsManager->content_top_offset() != m_settings.topControls Height) { |
| 1231 potentiallyScrollingLayerImpl = rootScrollLayer(); | 1229 potentiallyScrollingLayerImpl = rootScrollLayer(); |
| 1232 } | 1230 } |
| 1233 | 1231 |
| 1234 if (potentiallyScrollingLayerImpl) { | 1232 if (potentiallyScrollingLayerImpl) { |
| 1235 m_activeTree->set_currently_scrolling_layer(potentiallyScrollingLayerImp l); | 1233 m_activeTree->set_currently_scrolling_layer(potentiallyScrollingLayerImp l); |
| 1236 m_shouldBubbleScrolls = (type != NonBubblingGesture); | 1234 m_shouldBubbleScrolls = (type != NonBubblingGesture); |
| 1237 m_wheelScrolling = (type == Wheel); | 1235 m_wheelScrolling = (type == Wheel); |
| 1238 m_numImplThreadScrolls++; | 1236 m_renderingStatsRecorder->IncrementImplThreadScrolls(); |
| 1239 m_client->renewTreePriority(); | 1237 m_client->renewTreePriority(); |
| 1240 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); | 1238 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); |
| 1241 return ScrollStarted; | 1239 return ScrollStarted; |
| 1242 } | 1240 } |
| 1243 return ScrollIgnored; | 1241 return ScrollIgnored; |
| 1244 } | 1242 } |
| 1245 | 1243 |
| 1246 gfx::Vector2dF LayerTreeHostImpl::scrollLayerWithViewportSpaceDelta(LayerImpl* l ayerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx:: Vector2dF viewportDelta) | 1244 gfx::Vector2dF LayerTreeHostImpl::scrollLayerWithViewportSpaceDelta(LayerImpl* l ayerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx:: Vector2dF viewportDelta) |
| 1247 { | 1245 { |
| 1248 // Layers with non-invertible screen space transforms should not have passed the scroll hit | 1246 // Layers with non-invertible screen space transforms should not have passed the scroll hit |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1574 | 1572 |
| 1575 for (size_t i = 0; i < layer->children().size(); ++i) | 1573 for (size_t i = 0; i < layer->children().size(); ++i) |
| 1576 dumpRenderSurfaces(str, indent, layer->children()[i]); | 1574 dumpRenderSurfaces(str, indent, layer->children()[i]); |
| 1577 } | 1575 } |
| 1578 | 1576 |
| 1579 int LayerTreeHostImpl::sourceAnimationFrameNumber() const | 1577 int LayerTreeHostImpl::sourceAnimationFrameNumber() const |
| 1580 { | 1578 { |
| 1581 return fpsCounter()->currentFrameNumber(); | 1579 return fpsCounter()->currentFrameNumber(); |
| 1582 } | 1580 } |
| 1583 | 1581 |
| 1584 void LayerTreeHostImpl::renderingStats(RenderingStats* stats) const | |
| 1585 { | |
| 1586 stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber(); | |
| 1587 stats->droppedFrameCount = fpsCounter()->droppedFrameCount(); | |
| 1588 stats->numImplThreadScrolls = m_numImplThreadScrolls; | |
| 1589 stats->numMainThreadScrolls = m_numMainThreadScrolls; | |
| 1590 stats->numLayersDrawn = m_cumulativeNumLayersDrawn; | |
| 1591 stats->numMissingTiles = m_cumulativeNumMissingTiles; | |
| 1592 | |
| 1593 if (m_tileManager) | |
| 1594 m_tileManager->GetRenderingStats(stats); | |
| 1595 } | |
| 1596 | |
| 1597 void LayerTreeHostImpl::sendManagedMemoryStats( | 1582 void LayerTreeHostImpl::sendManagedMemoryStats( |
| 1598 size_t memoryVisibleBytes, | 1583 size_t memoryVisibleBytes, |
| 1599 size_t memoryVisibleAndNearbyBytes, | 1584 size_t memoryVisibleAndNearbyBytes, |
| 1600 size_t memoryUseBytes) | 1585 size_t memoryUseBytes) |
| 1601 { | 1586 { |
| 1602 if (!renderer()) | 1587 if (!renderer()) |
| 1603 return; | 1588 return; |
| 1604 | 1589 |
| 1605 // Round the numbers being sent up to the next 8MB, to throttle the rate | 1590 // Round the numbers being sent up to the next 8MB, to throttle the rate |
| 1606 // at which we spam the GPU process. | 1591 // at which we spam the GPU process. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1718 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1703 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
| 1719 return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>(); | 1704 return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>(); |
| 1720 } | 1705 } |
| 1721 | 1706 |
| 1722 void LayerTreeHostImpl::setDebugState(const LayerTreeDebugState& debugState) | 1707 void LayerTreeHostImpl::setDebugState(const LayerTreeDebugState& debugState) |
| 1723 { | 1708 { |
| 1724 if (m_debugState.continuousPainting != debugState.continuousPainting) | 1709 if (m_debugState.continuousPainting != debugState.continuousPainting) |
| 1725 m_paintTimeCounter->ClearHistory(); | 1710 m_paintTimeCounter->ClearHistory(); |
| 1726 | 1711 |
| 1727 m_debugState = debugState; | 1712 m_debugState = debugState; |
| 1728 | |
| 1729 if (m_tileManager) | |
| 1730 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ()); | |
| 1731 } | 1713 } |
| 1732 | 1714 |
| 1733 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber) | 1715 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber) |
| 1734 { | 1716 { |
| 1735 DCHECK(m_debugState.continuousPainting); | 1717 DCHECK(m_debugState.continuousPainting); |
| 1736 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); | 1718 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); |
| 1737 } | 1719 } |
| 1738 | 1720 |
| 1739 } // namespace cc | 1721 } // namespace cc |
| OLD | NEW |