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" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "cc/append_quads_data.h" | 14 #include "cc/append_quads_data.h" |
15 #include "cc/compositor_frame_metadata.h" | 15 #include "cc/compositor_frame_metadata.h" |
16 #include "cc/damage_tracker.h" | 16 #include "cc/damage_tracker.h" |
17 #include "cc/debug_rect_history.h" | 17 #include "cc/debug_rect_history.h" |
18 #include "cc/delay_based_time_source.h" | 18 #include "cc/delay_based_time_source.h" |
19 #include "cc/delegating_renderer.h" | 19 #include "cc/delegating_renderer.h" |
20 #include "cc/frame_rate_counter.h" | 20 #include "cc/frame_rate_counter.h" |
21 #include "cc/gl_renderer.h" | 21 #include "cc/gl_renderer.h" |
22 #include "cc/heads_up_display_layer_impl.h" | 22 #include "cc/heads_up_display_layer_impl.h" |
23 #include "cc/layer_iterator.h" | 23 #include "cc/layer_iterator.h" |
24 #include "cc/layer_tree_host.h" | 24 #include "cc/layer_tree_host.h" |
25 #include "cc/layer_tree_host_common.h" | 25 #include "cc/layer_tree_host_common.h" |
26 #include "cc/layer_tree_impl.h" | 26 #include "cc/layer_tree_impl.h" |
27 #include "cc/math_util.h" | 27 #include "cc/math_util.h" |
| 28 #include "cc/memory_history.h" |
28 #include "cc/overdraw_metrics.h" | 29 #include "cc/overdraw_metrics.h" |
29 #include "cc/page_scale_animation.h" | 30 #include "cc/page_scale_animation.h" |
30 #include "cc/paint_time_counter.h" | 31 #include "cc/paint_time_counter.h" |
31 #include "cc/prioritized_resource_manager.h" | 32 #include "cc/prioritized_resource_manager.h" |
32 #include "cc/quad_culler.h" | 33 #include "cc/quad_culler.h" |
33 #include "cc/render_pass_draw_quad.h" | 34 #include "cc/render_pass_draw_quad.h" |
34 #include "cc/rendering_stats.h" | 35 #include "cc/rendering_stats.h" |
35 #include "cc/scrollbar_animation_controller.h" | 36 #include "cc/scrollbar_animation_controller.h" |
36 #include "cc/scrollbar_layer_impl.h" | 37 #include "cc/scrollbar_layer_impl.h" |
37 #include "cc/shared_quad_state.h" | 38 #include "cc/shared_quad_state.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 , m_debugState(settings.initialDebugState) | 142 , m_debugState(settings.initialDebugState) |
142 , m_deviceScaleFactor(1) | 143 , m_deviceScaleFactor(1) |
143 , m_visible(true) | 144 , m_visible(true) |
144 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL
imit(), | 145 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL
imit(), |
145 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, | 146 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, |
146 0, | 147 0, |
147 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) | 148 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) |
148 , m_pinchGestureActive(false) | 149 , m_pinchGestureActive(false) |
149 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) | 150 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) |
150 , m_paintTimeCounter(PaintTimeCounter::create()) | 151 , m_paintTimeCounter(PaintTimeCounter::create()) |
| 152 , m_memoryHistory(MemoryHistory::create()) |
151 , m_debugRectHistory(DebugRectHistory::create()) | 153 , m_debugRectHistory(DebugRectHistory::create()) |
152 , m_numImplThreadScrolls(0) | 154 , m_numImplThreadScrolls(0) |
153 , m_numMainThreadScrolls(0) | 155 , m_numMainThreadScrolls(0) |
154 , m_cumulativeNumLayersDrawn(0) | 156 , m_cumulativeNumLayersDrawn(0) |
155 , m_cumulativeNumMissingTiles(0) | 157 , m_cumulativeNumMissingTiles(0) |
156 , m_lastSentMemoryVisibleBytes(0) | 158 , m_lastSentMemoryVisibleBytes(0) |
157 , m_lastSentMemoryVisibleAndNearbyBytes(0) | 159 , m_lastSentMemoryVisibleAndNearbyBytes(0) |
158 , m_lastSentMemoryUseBytes(0) | 160 , m_lastSentMemoryUseBytes(0) |
159 , m_animationRegistrar(AnimationRegistrar::create()) | 161 , m_animationRegistrar(AnimationRegistrar::create()) |
160 { | 162 { |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 { | 783 { |
782 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); | 784 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); |
783 DCHECK(canDraw()); | 785 DCHECK(canDraw()); |
784 DCHECK(!frame.renderPasses.empty()); | 786 DCHECK(!frame.renderPasses.empty()); |
785 | 787 |
786 // FIXME: use the frame begin time from the overall compositor scheduler. | 788 // FIXME: use the frame begin time from the overall compositor scheduler. |
787 // This value is currently inaccessible because it is up in Chromium's | 789 // This value is currently inaccessible because it is up in Chromium's |
788 // RenderWidget. | 790 // RenderWidget. |
789 m_fpsCounter->saveTimeStamp(base::TimeTicks::Now()); | 791 m_fpsCounter->saveTimeStamp(base::TimeTicks::Now()); |
790 | 792 |
| 793 if (m_tileManager) { |
| 794 m_memoryHistory->SaveEntry( |
| 795 m_tileManager->memory_stats_from_last_assign()); |
| 796 } |
| 797 |
791 if (m_debugState.showHudRects()) | 798 if (m_debugState.showHudRects()) |
792 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re
nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS
paceRects, m_debugState); | 799 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re
nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS
paceRects, m_debugState); |
793 | 800 |
794 // Because the contents of the HUD depend on everything else in the frame, t
he contents | 801 // Because the contents of the HUD depend on everything else in the frame, t
he contents |
795 // of its texture are updated as the last thing before the frame is drawn. | 802 // of its texture are updated as the last thing before the frame is drawn. |
796 if (m_activeTree->hud_layer()) | 803 if (m_activeTree->hud_layer()) |
797 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); | 804 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); |
798 | 805 |
799 m_renderer->drawFrame(frame.renderPasses); | 806 m_renderer->drawFrame(frame.renderPasses); |
800 // The render passes should be consumed by the renderer. | 807 // The render passes should be consumed by the renderer. |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1706 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
1700 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1707 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
1701 } | 1708 } |
1702 | 1709 |
1703 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) | 1710 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) |
1704 { | 1711 { |
1705 m_paintTimeCounter->SavePaintTime(totalPaintTime); | 1712 m_paintTimeCounter->SavePaintTime(totalPaintTime); |
1706 } | 1713 } |
1707 | 1714 |
1708 } // namespace cc | 1715 } // namespace cc |
OLD | NEW |