| 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 LayerTreeSettings DefaultSettings() { | 99 LayerTreeSettings DefaultSettings() { |
| 100 LayerTreeSettings settings; | 100 LayerTreeSettings settings; |
| 101 settings.minimum_occlusion_tracking_size = gfx::Size(); | 101 settings.minimum_occlusion_tracking_size = gfx::Size(); |
| 102 settings.impl_side_painting = true; | 102 settings.impl_side_painting = true; |
| 103 settings.texture_id_allocation_chunk_size = 1; | 103 settings.texture_id_allocation_chunk_size = 1; |
| 104 settings.report_overscroll_only_for_scrollable_axes = true; | 104 settings.report_overscroll_only_for_scrollable_axes = true; |
| 105 return settings; | 105 return settings; |
| 106 } | 106 } |
| 107 | 107 |
| 108 virtual void SetUp() OVERRIDE { | 108 virtual void SetUp() override { |
| 109 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); | 109 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 virtual void TearDown() OVERRIDE {} | 112 virtual void TearDown() override {} |
| 113 | 113 |
| 114 virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE {} | 114 virtual void UpdateRendererCapabilitiesOnImplThread() override {} |
| 115 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} | 115 virtual void DidLoseOutputSurfaceOnImplThread() override {} |
| 116 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 116 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
| 117 base::TimeDelta interval) OVERRIDE {} | 117 base::TimeDelta interval) override {} |
| 118 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) OVERRIDE {} | 118 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override {} |
| 119 virtual void SetMaxSwapsPendingOnImplThread(int max) OVERRIDE {} | 119 virtual void SetMaxSwapsPendingOnImplThread(int max) override {} |
| 120 virtual void DidSwapBuffersOnImplThread() OVERRIDE {} | 120 virtual void DidSwapBuffersOnImplThread() override {} |
| 121 virtual void DidSwapBuffersCompleteOnImplThread() OVERRIDE {} | 121 virtual void DidSwapBuffersCompleteOnImplThread() override {} |
| 122 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { | 122 virtual void OnCanDrawStateChanged(bool can_draw) override { |
| 123 on_can_draw_state_changed_called_ = true; | 123 on_can_draw_state_changed_called_ = true; |
| 124 } | 124 } |
| 125 virtual void NotifyReadyToActivate() OVERRIDE { | 125 virtual void NotifyReadyToActivate() override { |
| 126 did_notify_ready_to_activate_ = true; | 126 did_notify_ready_to_activate_ = true; |
| 127 host_impl_->ActivateSyncTree(); | 127 host_impl_->ActivateSyncTree(); |
| 128 } | 128 } |
| 129 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { | 129 virtual void SetNeedsRedrawOnImplThread() override { |
| 130 did_request_redraw_ = true; | 130 did_request_redraw_ = true; |
| 131 } | 131 } |
| 132 virtual void SetNeedsRedrawRectOnImplThread( | 132 virtual void SetNeedsRedrawRectOnImplThread( |
| 133 const gfx::Rect& damage_rect) OVERRIDE { | 133 const gfx::Rect& damage_rect) override { |
| 134 did_request_redraw_ = true; | 134 did_request_redraw_ = true; |
| 135 } | 135 } |
| 136 virtual void SetNeedsAnimateOnImplThread() OVERRIDE { | 136 virtual void SetNeedsAnimateOnImplThread() override { |
| 137 did_request_animate_ = true; | 137 did_request_animate_ = true; |
| 138 } | 138 } |
| 139 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE { | 139 virtual void SetNeedsManageTilesOnImplThread() override { |
| 140 did_request_manage_tiles_ = true; | 140 did_request_manage_tiles_ = true; |
| 141 } | 141 } |
| 142 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { | 142 virtual void DidInitializeVisibleTileOnImplThread() override { |
| 143 did_upload_visible_tile_ = true; | 143 did_upload_visible_tile_ = true; |
| 144 } | 144 } |
| 145 virtual void SetNeedsCommitOnImplThread() OVERRIDE { | 145 virtual void SetNeedsCommitOnImplThread() override { |
| 146 did_request_commit_ = true; | 146 did_request_commit_ = true; |
| 147 } | 147 } |
| 148 virtual void PostAnimationEventsToMainThreadOnImplThread( | 148 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 149 scoped_ptr<AnimationEventsVector> events) OVERRIDE {} | 149 scoped_ptr<AnimationEventsVector> events) override {} |
| 150 virtual bool ReduceContentsTextureMemoryOnImplThread( | 150 virtual bool ReduceContentsTextureMemoryOnImplThread( |
| 151 size_t limit_bytes, int priority_cutoff) OVERRIDE { | 151 size_t limit_bytes, int priority_cutoff) override { |
| 152 current_limit_bytes_ = limit_bytes; | 152 current_limit_bytes_ = limit_bytes; |
| 153 current_priority_cutoff_value_ = priority_cutoff; | 153 current_priority_cutoff_value_ = priority_cutoff; |
| 154 return reduce_memory_result_; | 154 return reduce_memory_result_; |
| 155 } | 155 } |
| 156 virtual bool IsInsideDraw() OVERRIDE { return false; } | 156 virtual bool IsInsideDraw() override { return false; } |
| 157 virtual void RenewTreePriority() OVERRIDE {} | 157 virtual void RenewTreePriority() override {} |
| 158 virtual void PostDelayedScrollbarFadeOnImplThread( | 158 virtual void PostDelayedScrollbarFadeOnImplThread( |
| 159 const base::Closure& start_fade, | 159 const base::Closure& start_fade, |
| 160 base::TimeDelta delay) OVERRIDE { | 160 base::TimeDelta delay) override { |
| 161 scrollbar_fade_start_ = start_fade; | 161 scrollbar_fade_start_ = start_fade; |
| 162 requested_scrollbar_animation_delay_ = delay; | 162 requested_scrollbar_animation_delay_ = delay; |
| 163 } | 163 } |
| 164 virtual void DidActivateSyncTree() OVERRIDE {} | 164 virtual void DidActivateSyncTree() override {} |
| 165 virtual void DidManageTiles() OVERRIDE {} | 165 virtual void DidManageTiles() override {} |
| 166 | 166 |
| 167 void set_reduce_memory_result(bool reduce_memory_result) { | 167 void set_reduce_memory_result(bool reduce_memory_result) { |
| 168 reduce_memory_result_ = reduce_memory_result; | 168 reduce_memory_result_ = reduce_memory_result; |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool CreateHostImpl(const LayerTreeSettings& settings, | 171 bool CreateHostImpl(const LayerTreeSettings& settings, |
| 172 scoped_ptr<OutputSurface> output_surface) { | 172 scoped_ptr<OutputSurface> output_surface) { |
| 173 host_impl_ = LayerTreeHostImpl::Create(settings, | 173 host_impl_ = LayerTreeHostImpl::Create(settings, |
| 174 this, | 174 this, |
| 175 &proxy_, | 175 &proxy_, |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 Proxy* proxy, | 1361 Proxy* proxy, |
| 1362 SharedBitmapManager* manager, | 1362 SharedBitmapManager* manager, |
| 1363 RenderingStatsInstrumentation* rendering_stats_instrumentation) | 1363 RenderingStatsInstrumentation* rendering_stats_instrumentation) |
| 1364 : LayerTreeHostImpl(settings, | 1364 : LayerTreeHostImpl(settings, |
| 1365 client, | 1365 client, |
| 1366 proxy, | 1366 proxy, |
| 1367 rendering_stats_instrumentation, | 1367 rendering_stats_instrumentation, |
| 1368 manager, | 1368 manager, |
| 1369 0) {} | 1369 0) {} |
| 1370 | 1370 |
| 1371 virtual BeginFrameArgs CurrentBeginFrameArgs() const OVERRIDE { | 1371 virtual BeginFrameArgs CurrentBeginFrameArgs() const override { |
| 1372 return CreateBeginFrameArgsForTesting(fake_current_physical_time_); | 1372 return CreateBeginFrameArgsForTesting(fake_current_physical_time_); |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) { | 1375 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) { |
| 1376 fake_current_physical_time_ = fake_now; | 1376 fake_current_physical_time_ = fake_now; |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 private: | 1379 private: |
| 1380 base::TimeTicks fake_current_physical_time_; | 1380 base::TimeTicks fake_current_physical_time_; |
| 1381 }; | 1381 }; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 } | 1701 } |
| 1702 } | 1702 } |
| 1703 | 1703 |
| 1704 class DidDrawCheckLayer : public LayerImpl { | 1704 class DidDrawCheckLayer : public LayerImpl { |
| 1705 public: | 1705 public: |
| 1706 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 1706 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 1707 return make_scoped_ptr(new DidDrawCheckLayer(tree_impl, id)); | 1707 return make_scoped_ptr(new DidDrawCheckLayer(tree_impl, id)); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* provider) | 1710 virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* provider) |
| 1711 OVERRIDE { | 1711 override { |
| 1712 will_draw_called_ = true; | 1712 will_draw_called_ = true; |
| 1713 if (will_draw_returns_false_) | 1713 if (will_draw_returns_false_) |
| 1714 return false; | 1714 return false; |
| 1715 return LayerImpl::WillDraw(draw_mode, provider); | 1715 return LayerImpl::WillDraw(draw_mode, provider); |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 virtual void AppendQuads(RenderPass* render_pass, | 1718 virtual void AppendQuads(RenderPass* render_pass, |
| 1719 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 1719 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 1720 AppendQuadsData* append_quads_data) OVERRIDE { | 1720 AppendQuadsData* append_quads_data) override { |
| 1721 append_quads_called_ = true; | 1721 append_quads_called_ = true; |
| 1722 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); | 1722 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); |
| 1723 } | 1723 } |
| 1724 | 1724 |
| 1725 virtual void DidDraw(ResourceProvider* provider) OVERRIDE { | 1725 virtual void DidDraw(ResourceProvider* provider) override { |
| 1726 did_draw_called_ = true; | 1726 did_draw_called_ = true; |
| 1727 LayerImpl::DidDraw(provider); | 1727 LayerImpl::DidDraw(provider); |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 bool will_draw_called() const { return will_draw_called_; } | 1730 bool will_draw_called() const { return will_draw_called_; } |
| 1731 bool append_quads_called() const { return append_quads_called_; } | 1731 bool append_quads_called() const { return append_quads_called_; } |
| 1732 bool did_draw_called() const { return did_draw_called_; } | 1732 bool did_draw_called() const { return did_draw_called_; } |
| 1733 | 1733 |
| 1734 void set_will_draw_returns_false() { will_draw_returns_false_ = true; } | 1734 void set_will_draw_returns_false() { will_draw_returns_false_ = true; } |
| 1735 | 1735 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 return make_scoped_ptr(new MissingTextureAnimatingLayer(tree_impl, | 1933 return make_scoped_ptr(new MissingTextureAnimatingLayer(tree_impl, |
| 1934 id, | 1934 id, |
| 1935 tile_missing, | 1935 tile_missing, |
| 1936 had_incomplete_tile, | 1936 had_incomplete_tile, |
| 1937 animating, | 1937 animating, |
| 1938 resource_provider)); | 1938 resource_provider)); |
| 1939 } | 1939 } |
| 1940 | 1940 |
| 1941 virtual void AppendQuads(RenderPass* render_pass, | 1941 virtual void AppendQuads(RenderPass* render_pass, |
| 1942 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 1942 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 1943 AppendQuadsData* append_quads_data) OVERRIDE { | 1943 AppendQuadsData* append_quads_data) override { |
| 1944 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); | 1944 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); |
| 1945 if (had_incomplete_tile_) | 1945 if (had_incomplete_tile_) |
| 1946 append_quads_data->num_incomplete_tiles++; | 1946 append_quads_data->num_incomplete_tiles++; |
| 1947 if (tile_missing_) | 1947 if (tile_missing_) |
| 1948 append_quads_data->num_missing_tiles++; | 1948 append_quads_data->num_missing_tiles++; |
| 1949 } | 1949 } |
| 1950 | 1950 |
| 1951 private: | 1951 private: |
| 1952 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, | 1952 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, |
| 1953 int id, | 1953 int id, |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 | 3276 |
| 3277 class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { | 3277 class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { |
| 3278 public: | 3278 public: |
| 3279 TestScrollOffsetDelegate() | 3279 TestScrollOffsetDelegate() |
| 3280 : page_scale_factor_(0.f), | 3280 : page_scale_factor_(0.f), |
| 3281 min_page_scale_factor_(-1.f), | 3281 min_page_scale_factor_(-1.f), |
| 3282 max_page_scale_factor_(-1.f) {} | 3282 max_page_scale_factor_(-1.f) {} |
| 3283 | 3283 |
| 3284 virtual ~TestScrollOffsetDelegate() {} | 3284 virtual ~TestScrollOffsetDelegate() {} |
| 3285 | 3285 |
| 3286 virtual gfx::ScrollOffset GetTotalScrollOffset() OVERRIDE { | 3286 virtual gfx::ScrollOffset GetTotalScrollOffset() override { |
| 3287 return getter_return_value_; | 3287 return getter_return_value_; |
| 3288 } | 3288 } |
| 3289 | 3289 |
| 3290 virtual bool IsExternalFlingActive() const OVERRIDE { return false; } | 3290 virtual bool IsExternalFlingActive() const override { return false; } |
| 3291 | 3291 |
| 3292 virtual void UpdateRootLayerState( | 3292 virtual void UpdateRootLayerState( |
| 3293 const gfx::ScrollOffset& total_scroll_offset, | 3293 const gfx::ScrollOffset& total_scroll_offset, |
| 3294 const gfx::ScrollOffset& max_scroll_offset, | 3294 const gfx::ScrollOffset& max_scroll_offset, |
| 3295 const gfx::SizeF& scrollable_size, | 3295 const gfx::SizeF& scrollable_size, |
| 3296 float page_scale_factor, | 3296 float page_scale_factor, |
| 3297 float min_page_scale_factor, | 3297 float min_page_scale_factor, |
| 3298 float max_page_scale_factor) OVERRIDE { | 3298 float max_page_scale_factor) override { |
| 3299 DCHECK(total_scroll_offset.x() <= max_scroll_offset.x()); | 3299 DCHECK(total_scroll_offset.x() <= max_scroll_offset.x()); |
| 3300 DCHECK(total_scroll_offset.y() <= max_scroll_offset.y()); | 3300 DCHECK(total_scroll_offset.y() <= max_scroll_offset.y()); |
| 3301 last_set_scroll_offset_ = total_scroll_offset; | 3301 last_set_scroll_offset_ = total_scroll_offset; |
| 3302 max_scroll_offset_ = max_scroll_offset; | 3302 max_scroll_offset_ = max_scroll_offset; |
| 3303 scrollable_size_ = scrollable_size; | 3303 scrollable_size_ = scrollable_size; |
| 3304 page_scale_factor_ = page_scale_factor; | 3304 page_scale_factor_ = page_scale_factor; |
| 3305 min_page_scale_factor_ = min_page_scale_factor; | 3305 min_page_scale_factor_ = min_page_scale_factor; |
| 3306 max_page_scale_factor_ = max_page_scale_factor; | 3306 max_page_scale_factor_ = max_page_scale_factor; |
| 3307 } | 3307 } |
| 3308 | 3308 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3732 public: | 3732 public: |
| 3733 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, | 3733 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, |
| 3734 int id, | 3734 int id, |
| 3735 ResourceProvider* resource_provider) { | 3735 ResourceProvider* resource_provider) { |
| 3736 return make_scoped_ptr( | 3736 return make_scoped_ptr( |
| 3737 new BlendStateCheckLayer(tree_impl, id, resource_provider)); | 3737 new BlendStateCheckLayer(tree_impl, id, resource_provider)); |
| 3738 } | 3738 } |
| 3739 | 3739 |
| 3740 virtual void AppendQuads(RenderPass* render_pass, | 3740 virtual void AppendQuads(RenderPass* render_pass, |
| 3741 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 3741 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 3742 AppendQuadsData* append_quads_data) OVERRIDE { | 3742 AppendQuadsData* append_quads_data) override { |
| 3743 quads_appended_ = true; | 3743 quads_appended_ = true; |
| 3744 | 3744 |
| 3745 gfx::Rect opaque_rect; | 3745 gfx::Rect opaque_rect; |
| 3746 if (contents_opaque()) | 3746 if (contents_opaque()) |
| 3747 opaque_rect = quad_rect_; | 3747 opaque_rect = quad_rect_; |
| 3748 else | 3748 else |
| 3749 opaque_rect = opaque_content_rect_; | 3749 opaque_rect = opaque_content_rect_; |
| 3750 gfx::Rect visible_quad_rect = quad_rect_; | 3750 gfx::Rect visible_quad_rect = quad_rect_; |
| 3751 | 3751 |
| 3752 SharedQuadState* shared_quad_state = | 3752 SharedQuadState* shared_quad_state = |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4142 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 4142 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 4143 ASSERT_EQ(1u, frame.render_passes.size()); | 4143 ASSERT_EQ(1u, frame.render_passes.size()); |
| 4144 | 4144 |
| 4145 EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list)); | 4145 EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list)); |
| 4146 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 4146 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
| 4147 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); | 4147 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); |
| 4148 | 4148 |
| 4149 host_impl_->DidDrawAllLayers(frame); | 4149 host_impl_->DidDrawAllLayers(frame); |
| 4150 } | 4150 } |
| 4151 | 4151 |
| 4152 virtual void DidActivateSyncTree() OVERRIDE { | 4152 virtual void DidActivateSyncTree() override { |
| 4153 did_activate_pending_tree_ = true; | 4153 did_activate_pending_tree_ = true; |
| 4154 } | 4154 } |
| 4155 | 4155 |
| 4156 void set_gutter_quad_material(DrawQuad::Material material) { | 4156 void set_gutter_quad_material(DrawQuad::Material material) { |
| 4157 gutter_quad_material_ = material; | 4157 gutter_quad_material_ = material; |
| 4158 } | 4158 } |
| 4159 void set_gutter_texture_size(const gfx::Size& gutter_texture_size) { | 4159 void set_gutter_texture_size(const gfx::Size& gutter_texture_size) { |
| 4160 gutter_texture_size_ = gutter_texture_size; | 4160 gutter_texture_size_ = gutter_texture_size; |
| 4161 } | 4161 } |
| 4162 | 4162 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4496 } | 4496 } |
| 4497 | 4497 |
| 4498 class FakeLayerWithQuads : public LayerImpl { | 4498 class FakeLayerWithQuads : public LayerImpl { |
| 4499 public: | 4499 public: |
| 4500 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 4500 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 4501 return make_scoped_ptr(new FakeLayerWithQuads(tree_impl, id)); | 4501 return make_scoped_ptr(new FakeLayerWithQuads(tree_impl, id)); |
| 4502 } | 4502 } |
| 4503 | 4503 |
| 4504 virtual void AppendQuads(RenderPass* render_pass, | 4504 virtual void AppendQuads(RenderPass* render_pass, |
| 4505 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 4505 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 4506 AppendQuadsData* append_quads_data) OVERRIDE { | 4506 AppendQuadsData* append_quads_data) override { |
| 4507 SharedQuadState* shared_quad_state = | 4507 SharedQuadState* shared_quad_state = |
| 4508 render_pass->CreateAndAppendSharedQuadState(); | 4508 render_pass->CreateAndAppendSharedQuadState(); |
| 4509 PopulateSharedQuadState(shared_quad_state); | 4509 PopulateSharedQuadState(shared_quad_state); |
| 4510 | 4510 |
| 4511 SkColor gray = SkColorSetRGB(100, 100, 100); | 4511 SkColor gray = SkColorSetRGB(100, 100, 100); |
| 4512 gfx::Rect quad_rect(content_bounds()); | 4512 gfx::Rect quad_rect(content_bounds()); |
| 4513 gfx::Rect visible_quad_rect(quad_rect); | 4513 gfx::Rect visible_quad_rect(quad_rect); |
| 4514 SolidColorDrawQuad* my_quad = | 4514 SolidColorDrawQuad* my_quad = |
| 4515 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 4515 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 4516 my_quad->SetNew( | 4516 my_quad->SetNew( |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4944 // But if we set it to the same value that it was before, we shouldn't | 4944 // But if we set it to the same value that it was before, we shouldn't |
| 4945 // re-commit. | 4945 // re-commit. |
| 4946 host_impl_->SetMemoryPolicy(ManagedMemoryPolicy( | 4946 host_impl_->SetMemoryPolicy(ManagedMemoryPolicy( |
| 4947 host_impl_->memory_allocation_limit_bytes())); | 4947 host_impl_->memory_allocation_limit_bytes())); |
| 4948 EXPECT_FALSE(did_request_commit_); | 4948 EXPECT_FALSE(did_request_commit_); |
| 4949 } | 4949 } |
| 4950 | 4950 |
| 4951 class LayerTreeHostImplTestWithDelegatingRenderer | 4951 class LayerTreeHostImplTestWithDelegatingRenderer |
| 4952 : public LayerTreeHostImplTest { | 4952 : public LayerTreeHostImplTest { |
| 4953 protected: | 4953 protected: |
| 4954 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 4954 virtual scoped_ptr<OutputSurface> CreateOutputSurface() override { |
| 4955 return FakeOutputSurface::CreateDelegating3d(); | 4955 return FakeOutputSurface::CreateDelegating3d(); |
| 4956 } | 4956 } |
| 4957 | 4957 |
| 4958 void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) { | 4958 void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) { |
| 4959 bool expect_to_draw = !expected_damage.IsEmpty(); | 4959 bool expect_to_draw = !expected_damage.IsEmpty(); |
| 4960 | 4960 |
| 4961 LayerTreeHostImpl::FrameData frame; | 4961 LayerTreeHostImpl::FrameData frame; |
| 4962 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 4962 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 4963 | 4963 |
| 4964 if (!expect_to_draw) { | 4964 if (!expect_to_draw) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5034 EXPECT_FALSE(host_impl_->GetRendererCapabilities().allow_rasterize_on_demand); | 5034 EXPECT_FALSE(host_impl_->GetRendererCapabilities().allow_rasterize_on_demand); |
| 5035 } | 5035 } |
| 5036 | 5036 |
| 5037 class FakeMaskLayerImpl : public LayerImpl { | 5037 class FakeMaskLayerImpl : public LayerImpl { |
| 5038 public: | 5038 public: |
| 5039 static scoped_ptr<FakeMaskLayerImpl> Create(LayerTreeImpl* tree_impl, | 5039 static scoped_ptr<FakeMaskLayerImpl> Create(LayerTreeImpl* tree_impl, |
| 5040 int id) { | 5040 int id) { |
| 5041 return make_scoped_ptr(new FakeMaskLayerImpl(tree_impl, id)); | 5041 return make_scoped_ptr(new FakeMaskLayerImpl(tree_impl, id)); |
| 5042 } | 5042 } |
| 5043 | 5043 |
| 5044 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE { | 5044 virtual ResourceProvider::ResourceId ContentsResourceId() const override { |
| 5045 return 0; | 5045 return 0; |
| 5046 } | 5046 } |
| 5047 | 5047 |
| 5048 private: | 5048 private: |
| 5049 FakeMaskLayerImpl(LayerTreeImpl* tree_impl, int id) | 5049 FakeMaskLayerImpl(LayerTreeImpl* tree_impl, int id) |
| 5050 : LayerImpl(tree_impl, id) {} | 5050 : LayerImpl(tree_impl, id) {} |
| 5051 }; | 5051 }; |
| 5052 | 5052 |
| 5053 TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) { | 5053 TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) { |
| 5054 LayerTreeSettings settings; | 5054 LayerTreeSettings settings; |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5764 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 5764 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 5765 host_impl_->DidDrawAllLayers(frame); | 5765 host_impl_->DidDrawAllLayers(frame); |
| 5766 } | 5766 } |
| 5767 | 5767 |
| 5768 | 5768 |
| 5769 class CompositorFrameMetadataTest : public LayerTreeHostImplTest { | 5769 class CompositorFrameMetadataTest : public LayerTreeHostImplTest { |
| 5770 public: | 5770 public: |
| 5771 CompositorFrameMetadataTest() | 5771 CompositorFrameMetadataTest() |
| 5772 : swap_buffers_complete_(0) {} | 5772 : swap_buffers_complete_(0) {} |
| 5773 | 5773 |
| 5774 virtual void DidSwapBuffersCompleteOnImplThread() OVERRIDE { | 5774 virtual void DidSwapBuffersCompleteOnImplThread() override { |
| 5775 swap_buffers_complete_++; | 5775 swap_buffers_complete_++; |
| 5776 } | 5776 } |
| 5777 | 5777 |
| 5778 int swap_buffers_complete_; | 5778 int swap_buffers_complete_; |
| 5779 }; | 5779 }; |
| 5780 | 5780 |
| 5781 TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) { | 5781 TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) { |
| 5782 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); | 5782 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); |
| 5783 { | 5783 { |
| 5784 LayerTreeHostImpl::FrameData frame; | 5784 LayerTreeHostImpl::FrameData frame; |
| 5785 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5785 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5786 host_impl_->DrawLayers(&frame, base::TimeTicks()); | 5786 host_impl_->DrawLayers(&frame, base::TimeTicks()); |
| 5787 host_impl_->DidDrawAllLayers(frame); | 5787 host_impl_->DidDrawAllLayers(frame); |
| 5788 } | 5788 } |
| 5789 CompositorFrameAck ack; | 5789 CompositorFrameAck ack; |
| 5790 host_impl_->ReclaimResources(&ack); | 5790 host_impl_->ReclaimResources(&ack); |
| 5791 host_impl_->DidSwapBuffersComplete(); | 5791 host_impl_->DidSwapBuffersComplete(); |
| 5792 EXPECT_EQ(swap_buffers_complete_, 1); | 5792 EXPECT_EQ(swap_buffers_complete_, 1); |
| 5793 } | 5793 } |
| 5794 | 5794 |
| 5795 class CountingSoftwareDevice : public SoftwareOutputDevice { | 5795 class CountingSoftwareDevice : public SoftwareOutputDevice { |
| 5796 public: | 5796 public: |
| 5797 CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {} | 5797 CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {} |
| 5798 | 5798 |
| 5799 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { | 5799 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override { |
| 5800 ++frames_began_; | 5800 ++frames_began_; |
| 5801 return SoftwareOutputDevice::BeginPaint(damage_rect); | 5801 return SoftwareOutputDevice::BeginPaint(damage_rect); |
| 5802 } | 5802 } |
| 5803 virtual void EndPaint(SoftwareFrameData* frame_data) OVERRIDE { | 5803 virtual void EndPaint(SoftwareFrameData* frame_data) override { |
| 5804 ++frames_ended_; | 5804 ++frames_ended_; |
| 5805 SoftwareOutputDevice::EndPaint(frame_data); | 5805 SoftwareOutputDevice::EndPaint(frame_data); |
| 5806 } | 5806 } |
| 5807 | 5807 |
| 5808 int frames_began_, frames_ended_; | 5808 int frames_began_, frames_ended_; |
| 5809 }; | 5809 }; |
| 5810 | 5810 |
| 5811 TEST_F(LayerTreeHostImplTest, ForcedDrawToSoftwareDeviceBasicRender) { | 5811 TEST_F(LayerTreeHostImplTest, ForcedDrawToSoftwareDeviceBasicRender) { |
| 5812 // No main thread evictions in resourceless software mode. | 5812 // No main thread evictions in resourceless software mode. |
| 5813 set_reduce_memory_result(false); | 5813 set_reduce_memory_result(false); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5887 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5887 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5888 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 5888 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 5889 host_impl_->DidDrawAllLayers(frame); | 5889 host_impl_->DidDrawAllLayers(frame); |
| 5890 | 5890 |
| 5891 EXPECT_EQ(1u, frame.will_draw_layers.size()); | 5891 EXPECT_EQ(1u, frame.will_draw_layers.size()); |
| 5892 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); | 5892 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); |
| 5893 } | 5893 } |
| 5894 | 5894 |
| 5895 class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest { | 5895 class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest { |
| 5896 protected: | 5896 protected: |
| 5897 virtual void SetUp() OVERRIDE { | 5897 virtual void SetUp() override { |
| 5898 LayerTreeHostImplTest::SetUp(); | 5898 LayerTreeHostImplTest::SetUp(); |
| 5899 | 5899 |
| 5900 set_reduce_memory_result(false); | 5900 set_reduce_memory_result(false); |
| 5901 | 5901 |
| 5902 bool delegated_rendering = false; | 5902 bool delegated_rendering = false; |
| 5903 scoped_ptr<FakeOutputSurface> output_surface( | 5903 scoped_ptr<FakeOutputSurface> output_surface( |
| 5904 FakeOutputSurface::CreateDeferredGL( | 5904 FakeOutputSurface::CreateDeferredGL( |
| 5905 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice()), | 5905 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice()), |
| 5906 delegated_rendering)); | 5906 delegated_rendering)); |
| 5907 output_surface_ = output_surface.get(); | 5907 output_surface_ = output_surface.get(); |
| 5908 | 5908 |
| 5909 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), output_surface.Pass())); | 5909 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), output_surface.Pass())); |
| 5910 | 5910 |
| 5911 scoped_ptr<SolidColorLayerImpl> root_layer = | 5911 scoped_ptr<SolidColorLayerImpl> root_layer = |
| 5912 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 5912 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
| 5913 SetupRootLayerImpl(root_layer.Pass()); | 5913 SetupRootLayerImpl(root_layer.Pass()); |
| 5914 | 5914 |
| 5915 onscreen_context_provider_ = TestContextProvider::Create(); | 5915 onscreen_context_provider_ = TestContextProvider::Create(); |
| 5916 } | 5916 } |
| 5917 | 5917 |
| 5918 virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE { | 5918 virtual void UpdateRendererCapabilitiesOnImplThread() override { |
| 5919 did_update_renderer_capabilities_ = true; | 5919 did_update_renderer_capabilities_ = true; |
| 5920 } | 5920 } |
| 5921 | 5921 |
| 5922 FakeOutputSurface* output_surface_; | 5922 FakeOutputSurface* output_surface_; |
| 5923 scoped_refptr<TestContextProvider> onscreen_context_provider_; | 5923 scoped_refptr<TestContextProvider> onscreen_context_provider_; |
| 5924 bool did_update_renderer_capabilities_; | 5924 bool did_update_renderer_capabilities_; |
| 5925 }; | 5925 }; |
| 5926 | 5926 |
| 5927 | 5927 |
| 5928 TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) { | 5928 TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6075 | 6075 |
| 6076 host_impl_->active_tree()->ResetRequiresHighResToDraw(); | 6076 host_impl_->active_tree()->ResetRequiresHighResToDraw(); |
| 6077 | 6077 |
| 6078 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); | 6078 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| 6079 host_impl_->SetUseGpuRasterization(true); | 6079 host_impl_->SetUseGpuRasterization(true); |
| 6080 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 6080 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| 6081 } | 6081 } |
| 6082 | 6082 |
| 6083 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { | 6083 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { |
| 6084 public: | 6084 public: |
| 6085 virtual void SetUp() OVERRIDE { | 6085 virtual void SetUp() override { |
| 6086 LayerTreeSettings settings; | 6086 LayerTreeSettings settings; |
| 6087 settings.impl_side_painting = true; | 6087 settings.impl_side_painting = true; |
| 6088 | 6088 |
| 6089 fake_host_impl_ = new FakeLayerTreeHostImpl( | 6089 fake_host_impl_ = new FakeLayerTreeHostImpl( |
| 6090 settings, &proxy_, shared_bitmap_manager_.get()); | 6090 settings, &proxy_, shared_bitmap_manager_.get()); |
| 6091 host_impl_.reset(fake_host_impl_); | 6091 host_impl_.reset(fake_host_impl_); |
| 6092 host_impl_->InitializeRenderer(CreateOutputSurface()); | 6092 host_impl_->InitializeRenderer(CreateOutputSurface()); |
| 6093 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6093 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
| 6094 } | 6094 } |
| 6095 | 6095 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6627 int* set_needs_commit_count, | 6627 int* set_needs_commit_count, |
| 6628 int* set_needs_redraw_count, | 6628 int* set_needs_redraw_count, |
| 6629 int* forward_to_main_count) | 6629 int* forward_to_main_count) |
| 6630 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), | 6630 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), |
| 6631 set_needs_commit_count_(set_needs_commit_count), | 6631 set_needs_commit_count_(set_needs_commit_count), |
| 6632 set_needs_redraw_count_(set_needs_redraw_count), | 6632 set_needs_redraw_count_(set_needs_redraw_count), |
| 6633 forward_to_main_count_(forward_to_main_count) {} | 6633 forward_to_main_count_(forward_to_main_count) {} |
| 6634 | 6634 |
| 6635 virtual ~SimpleSwapPromiseMonitor() {} | 6635 virtual ~SimpleSwapPromiseMonitor() {} |
| 6636 | 6636 |
| 6637 virtual void OnSetNeedsCommitOnMain() OVERRIDE { | 6637 virtual void OnSetNeedsCommitOnMain() override { |
| 6638 (*set_needs_commit_count_)++; | 6638 (*set_needs_commit_count_)++; |
| 6639 } | 6639 } |
| 6640 | 6640 |
| 6641 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { | 6641 virtual void OnSetNeedsRedrawOnImpl() override { |
| 6642 (*set_needs_redraw_count_)++; | 6642 (*set_needs_redraw_count_)++; |
| 6643 } | 6643 } |
| 6644 | 6644 |
| 6645 virtual void OnForwardScrollUpdateToMainThreadOnImpl() OVERRIDE { | 6645 virtual void OnForwardScrollUpdateToMainThreadOnImpl() override { |
| 6646 (*forward_to_main_count_)++; | 6646 (*forward_to_main_count_)++; |
| 6647 } | 6647 } |
| 6648 | 6648 |
| 6649 private: | 6649 private: |
| 6650 int* set_needs_commit_count_; | 6650 int* set_needs_commit_count_; |
| 6651 int* set_needs_redraw_count_; | 6651 int* set_needs_redraw_count_; |
| 6652 int* forward_to_main_count_; | 6652 int* forward_to_main_count_; |
| 6653 }; | 6653 }; |
| 6654 | 6654 |
| 6655 TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) { | 6655 TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6735 host_impl_->ScrollEnd(); | 6735 host_impl_->ScrollEnd(); |
| 6736 | 6736 |
| 6737 EXPECT_EQ(0, set_needs_commit_count); | 6737 EXPECT_EQ(0, set_needs_commit_count); |
| 6738 EXPECT_EQ(2, set_needs_redraw_count); | 6738 EXPECT_EQ(2, set_needs_redraw_count); |
| 6739 EXPECT_EQ(1, forward_to_main_count); | 6739 EXPECT_EQ(1, forward_to_main_count); |
| 6740 } | 6740 } |
| 6741 } | 6741 } |
| 6742 | 6742 |
| 6743 class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest { | 6743 class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest { |
| 6744 public: | 6744 public: |
| 6745 virtual void SetUp() OVERRIDE { | 6745 virtual void SetUp() override { |
| 6746 LayerTreeSettings settings = DefaultSettings(); | 6746 LayerTreeSettings settings = DefaultSettings(); |
| 6747 settings.calculate_top_controls_position = true; | 6747 settings.calculate_top_controls_position = true; |
| 6748 settings.top_controls_height = top_controls_height_; | 6748 settings.top_controls_height = top_controls_height_; |
| 6749 CreateHostImpl(settings, CreateOutputSurface()); | 6749 CreateHostImpl(settings, CreateOutputSurface()); |
| 6750 } | 6750 } |
| 6751 | 6751 |
| 6752 protected: | 6752 protected: |
| 6753 static const int top_controls_height_; | 6753 static const int top_controls_height_; |
| 6754 }; | 6754 }; |
| 6755 | 6755 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7054 | 7054 |
| 7055 host_impl_->ScrollEnd(); | 7055 host_impl_->ScrollEnd(); |
| 7056 | 7056 |
| 7057 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); | 7057 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); |
| 7058 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); | 7058 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); |
| 7059 } | 7059 } |
| 7060 } | 7060 } |
| 7061 | 7061 |
| 7062 class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest { | 7062 class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest { |
| 7063 public: | 7063 public: |
| 7064 virtual void SetUp() OVERRIDE { | 7064 virtual void SetUp() override { |
| 7065 LayerTreeSettings settings = DefaultSettings(); | 7065 LayerTreeSettings settings = DefaultSettings(); |
| 7066 settings.max_memory_for_prepaint_percentage = 50; | 7066 settings.max_memory_for_prepaint_percentage = 50; |
| 7067 CreateHostImpl(settings, CreateOutputSurface()); | 7067 CreateHostImpl(settings, CreateOutputSurface()); |
| 7068 } | 7068 } |
| 7069 }; | 7069 }; |
| 7070 | 7070 |
| 7071 TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { | 7071 TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { |
| 7072 // Set up a memory policy and percentages which could cause | 7072 // Set up a memory policy and percentages which could cause |
| 7073 // 32-bit integer overflows. | 7073 // 32-bit integer overflows. |
| 7074 ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB | 7074 ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7245 EXPECT_EQ(0u, raw_replica_mask_layer->did_become_active_call_count()); | 7245 EXPECT_EQ(0u, raw_replica_mask_layer->did_become_active_call_count()); |
| 7246 pending_tree->DidBecomeActive(); | 7246 pending_tree->DidBecomeActive(); |
| 7247 EXPECT_EQ(3u, raw_pending_layer->did_become_active_call_count()); | 7247 EXPECT_EQ(3u, raw_pending_layer->did_become_active_call_count()); |
| 7248 EXPECT_EQ(2u, raw_mask_layer->did_become_active_call_count()); | 7248 EXPECT_EQ(2u, raw_mask_layer->did_become_active_call_count()); |
| 7249 EXPECT_EQ(1u, raw_replica_mask_layer->did_become_active_call_count()); | 7249 EXPECT_EQ(1u, raw_replica_mask_layer->did_become_active_call_count()); |
| 7250 } | 7250 } |
| 7251 | 7251 |
| 7252 class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest { | 7252 class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest { |
| 7253 public: | 7253 public: |
| 7254 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} | 7254 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} |
| 7255 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { | 7255 virtual void DidLoseOutputSurfaceOnImplThread() override { |
| 7256 num_lost_surfaces_++; | 7256 num_lost_surfaces_++; |
| 7257 } | 7257 } |
| 7258 | 7258 |
| 7259 protected: | 7259 protected: |
| 7260 int num_lost_surfaces_; | 7260 int num_lost_surfaces_; |
| 7261 }; | 7261 }; |
| 7262 | 7262 |
| 7263 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { | 7263 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { |
| 7264 // Really we just need at least one client notification each time | 7264 // Really we just need at least one client notification each time |
| 7265 // we go from having a valid output surface to not having a valid output | 7265 // we go from having a valid output surface to not having a valid output |
| 7266 // surface. | 7266 // surface. |
| 7267 EXPECT_EQ(0, num_lost_surfaces_); | 7267 EXPECT_EQ(0, num_lost_surfaces_); |
| 7268 host_impl_->DidLoseOutputSurface(); | 7268 host_impl_->DidLoseOutputSurface(); |
| 7269 EXPECT_EQ(1, num_lost_surfaces_); | 7269 EXPECT_EQ(1, num_lost_surfaces_); |
| 7270 host_impl_->DidLoseOutputSurface(); | 7270 host_impl_->DidLoseOutputSurface(); |
| 7271 EXPECT_LE(1, num_lost_surfaces_); | 7271 EXPECT_LE(1, num_lost_surfaces_); |
| 7272 } | 7272 } |
| 7273 | 7273 |
| 7274 } // namespace | 7274 } // namespace |
| 7275 } // namespace cc | 7275 } // namespace cc |
| OLD | NEW |