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/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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1521 scoped_refptr<FakeContentLayer> parent_; | 1521 scoped_refptr<FakeContentLayer> parent_; |
| 1522 scoped_refptr<FakeContentLayer> child_; | 1522 scoped_refptr<FakeContentLayer> child_; |
| 1523 }; | 1523 }; |
| 1524 | 1524 |
| 1525 // Partial updates are not possible with a delegating renderer. | 1525 // Partial updates are not possible with a delegating renderer. |
| 1526 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1526 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1527 LayerTreeHostTestAtomicCommitWithPartialUpdate); | 1527 LayerTreeHostTestAtomicCommitWithPartialUpdate); |
| 1528 | 1528 |
| 1529 class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { | 1529 class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { |
| 1530 public: | 1530 public: |
| 1531 LayerTreeHostTestFinishAllRendering() : once_(false), draw_count_(0) {} | 1531 LayerTreeHostTestFinishAllRendering() |
| 1532 : once_(false), | |
| 1533 has_called_finish_all_rendering_(false) {} | |
| 1532 | 1534 |
| 1533 virtual void BeginTest() OVERRIDE { | 1535 virtual void BeginTest() OVERRIDE { |
| 1534 layer_tree_host()->SetNeedsRedraw(); | 1536 layer_tree_host()->SetNeedsRedraw(); |
| 1535 PostSetNeedsCommitToMainThread(); | 1537 PostSetNeedsCommitToMainThread(); |
| 1536 } | 1538 } |
| 1537 | 1539 |
| 1538 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1540 virtual void DidCommitAndDrawFrame() OVERRIDE { |
| 1539 if (once_) | 1541 EXPECT_TRUE(once_); |
| 1540 return; | |
| 1541 once_ = true; | |
| 1542 layer_tree_host()->SetNeedsRedraw(); | |
| 1543 { | |
| 1544 base::AutoLock lock(lock_); | |
| 1545 draw_count_ = 0; | |
| 1546 } | |
| 1547 layer_tree_host()->FinishAllRendering(); | 1542 layer_tree_host()->FinishAllRendering(); |
| 1548 { | 1543 has_called_finish_all_rendering_ = true; |
| 1549 base::AutoLock lock(lock_); | 1544 |
| 1550 EXPECT_EQ(0, draw_count_); | |
|
danakj
2014/05/20 18:40:30
Hm, before this test was verifying that FinishAllR
| |
| 1551 } | |
| 1552 EndTest(); | 1545 EndTest(); |
| 1553 } | 1546 } |
| 1554 | 1547 |
| 1555 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1548 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 1556 base::AutoLock lock(lock_); | 1549 once_ = true; |
| 1557 ++draw_count_; | |
| 1558 } | 1550 } |
| 1559 | 1551 |
| 1560 virtual void AfterTest() OVERRIDE {} | 1552 virtual void AfterTest() OVERRIDE { |
| 1553 EXPECT_TRUE(has_called_finish_all_rendering_); | |
| 1554 } | |
| 1561 | 1555 |
| 1562 private: | 1556 private: |
| 1563 bool once_; | 1557 bool once_; |
| 1564 base::Lock lock_; | 1558 bool has_called_finish_all_rendering_; |
| 1565 int draw_count_; | |
| 1566 }; | 1559 }; |
| 1567 | 1560 |
| 1568 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFinishAllRendering); | 1561 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFinishAllRendering); |
| 1569 | 1562 |
| 1570 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit | 1563 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit |
| 1571 : public LayerTreeHostTest { | 1564 : public LayerTreeHostTest { |
| 1572 protected: | 1565 protected: |
| 1573 virtual void SetupTree() OVERRIDE { | 1566 virtual void SetupTree() OVERRIDE { |
| 1574 root_layer_ = FakeContentLayer::Create(&client_); | 1567 root_layer_ = FakeContentLayer::Create(&client_); |
| 1575 root_layer_->SetBounds(gfx::Size(100, 100)); | 1568 root_layer_->SetBounds(gfx::Size(100, 100)); |
| (...skipping 3358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4934 const gfx::Size bounds_; | 4927 const gfx::Size bounds_; |
| 4935 FakeContentLayerClient client_; | 4928 FakeContentLayerClient client_; |
| 4936 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4929 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 4937 scoped_refptr<FakePictureLayer> picture_layer_; | 4930 scoped_refptr<FakePictureLayer> picture_layer_; |
| 4938 Layer* child_layer_; | 4931 Layer* child_layer_; |
| 4939 }; | 4932 }; |
| 4940 | 4933 |
| 4941 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4934 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 4942 | 4935 |
| 4943 } // namespace cc | 4936 } // namespace cc |
| OLD | NEW |