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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 }; | 1099 }; |
1100 | 1100 |
1101 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); | 1101 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); |
1102 | 1102 |
1103 class TestOpacityChangeLayerDelegate : public ContentLayerClient { | 1103 class TestOpacityChangeLayerDelegate : public ContentLayerClient { |
1104 public: | 1104 public: |
1105 TestOpacityChangeLayerDelegate() : test_layer_(0) {} | 1105 TestOpacityChangeLayerDelegate() : test_layer_(0) {} |
1106 | 1106 |
1107 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } | 1107 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } |
1108 | 1108 |
1109 void PaintContents( | 1109 void PaintContents(SkCanvas* canvas, |
1110 SkCanvas* canvas, | 1110 const gfx::Rect& clip, |
1111 const gfx::Rect& clip, | 1111 PaintingControlSetting picture_control) override { |
1112 ContentLayerClient::GraphicsContextStatus gc_status) override { | |
1113 // Set layer opacity to 0. | 1112 // Set layer opacity to 0. |
1114 if (test_layer_) | 1113 if (test_layer_) |
1115 test_layer_->SetOpacity(0.f); | 1114 test_layer_->SetOpacity(0.f); |
1116 } | 1115 } |
1117 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 1116 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
1118 const gfx::Rect& clip, | 1117 const gfx::Rect& clip, |
1119 GraphicsContextStatus gc_status) override { | 1118 PaintingControlSetting picture_control) override { |
1120 NOTIMPLEMENTED(); | 1119 NOTIMPLEMENTED(); |
1121 return DisplayItemList::Create(); | 1120 return DisplayItemList::Create(); |
1122 } | 1121 } |
1123 bool FillsBoundsCompletely() const override { return false; } | 1122 bool FillsBoundsCompletely() const override { return false; } |
1124 | 1123 |
1125 private: | 1124 private: |
1126 Layer* test_layer_; | 1125 Layer* test_layer_; |
1127 }; | 1126 }; |
1128 | 1127 |
1129 class ContentLayerWithUpdateTracking : public ContentLayer { | 1128 class ContentLayerWithUpdateTracking : public ContentLayer { |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2322 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted); | 2321 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted); |
2323 | 2322 |
2324 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { | 2323 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { |
2325 public: | 2324 public: |
2326 class PaintClient : public FakeContentLayerClient { | 2325 class PaintClient : public FakeContentLayerClient { |
2327 public: | 2326 public: |
2328 PaintClient() : paint_count_(0) {} | 2327 PaintClient() : paint_count_(0) {} |
2329 | 2328 |
2330 int paint_count() const { return paint_count_; } | 2329 int paint_count() const { return paint_count_; } |
2331 | 2330 |
2332 void PaintContents( | 2331 void PaintContents(SkCanvas* canvas, |
2333 SkCanvas* canvas, | 2332 const gfx::Rect& clip, |
2334 const gfx::Rect& clip, | 2333 PaintingControlSetting picture_control) override { |
2335 ContentLayerClient::GraphicsContextStatus gc_status) override { | 2334 FakeContentLayerClient::PaintContents(canvas, clip, picture_control); |
2336 FakeContentLayerClient::PaintContents(canvas, clip, gc_status); | |
2337 ++paint_count_; | 2335 ++paint_count_; |
2338 } | 2336 } |
2339 | 2337 |
2340 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 2338 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
2341 const gfx::Rect& clip, | 2339 const gfx::Rect& clip, |
2342 GraphicsContextStatus gc_status) override { | 2340 PaintingControlSetting picture_control) override { |
2343 NOTIMPLEMENTED(); | 2341 NOTIMPLEMENTED(); |
2344 return DisplayItemList::Create(); | 2342 return DisplayItemList::Create(); |
2345 } | 2343 } |
2346 | 2344 |
2347 bool FillsBoundsCompletely() const override { return false; } | 2345 bool FillsBoundsCompletely() const override { return false; } |
2348 | 2346 |
2349 private: | 2347 private: |
2350 int paint_count_; | 2348 int paint_count_; |
2351 }; | 2349 }; |
2352 | 2350 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2600 | 2598 |
2601 class LayerTreeHostTestChangeLayerPropertiesInPaintContents | 2599 class LayerTreeHostTestChangeLayerPropertiesInPaintContents |
2602 : public LayerTreeHostTest { | 2600 : public LayerTreeHostTest { |
2603 public: | 2601 public: |
2604 class SetBoundsClient : public ContentLayerClient { | 2602 class SetBoundsClient : public ContentLayerClient { |
2605 public: | 2603 public: |
2606 SetBoundsClient() : layer_(0) {} | 2604 SetBoundsClient() : layer_(0) {} |
2607 | 2605 |
2608 void set_layer(Layer* layer) { layer_ = layer; } | 2606 void set_layer(Layer* layer) { layer_ = layer; } |
2609 | 2607 |
2610 void PaintContents( | 2608 void PaintContents(SkCanvas* canvas, |
2611 SkCanvas* canvas, | 2609 const gfx::Rect& clip, |
2612 const gfx::Rect& clip, | 2610 PaintingControlSetting picture_control) override { |
2613 ContentLayerClient::GraphicsContextStatus gc_status) override { | |
2614 layer_->SetBounds(gfx::Size(2, 2)); | 2611 layer_->SetBounds(gfx::Size(2, 2)); |
2615 } | 2612 } |
2616 | 2613 |
2617 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 2614 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
2618 const gfx::Rect& clip, | 2615 const gfx::Rect& clip, |
2619 GraphicsContextStatus gc_status) override { | 2616 PaintingControlSetting picture_control) override { |
2620 NOTIMPLEMENTED(); | 2617 NOTIMPLEMENTED(); |
2621 return DisplayItemList::Create(); | 2618 return DisplayItemList::Create(); |
2622 } | 2619 } |
2623 | 2620 |
2624 bool FillsBoundsCompletely() const override { return false; } | 2621 bool FillsBoundsCompletely() const override { return false; } |
2625 | 2622 |
2626 private: | 2623 private: |
2627 Layer* layer_; | 2624 Layer* layer_; |
2628 }; | 2625 }; |
2629 | 2626 |
(...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6262 | 6259 |
6263 void AfterTest() override { EXPECT_TRUE(did_commit_); } | 6260 void AfterTest() override { EXPECT_TRUE(did_commit_); } |
6264 | 6261 |
6265 private: | 6262 private: |
6266 bool did_commit_; | 6263 bool did_commit_; |
6267 }; | 6264 }; |
6268 | 6265 |
6269 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6266 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
6270 | 6267 |
6271 } // namespace cc | 6268 } // namespace cc |
OLD | NEW |