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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 7484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7495 DCHECK_EQ(hud->clip_tree_index(), root_layer->clip_tree_index()); | 7495 DCHECK_EQ(hud->clip_tree_index(), root_layer->clip_tree_index()); |
| 7496 DCHECK_EQ(hud->effect_tree_index(), root_layer->effect_tree_index()); | 7496 DCHECK_EQ(hud->effect_tree_index(), root_layer->effect_tree_index()); |
| 7497 DCHECK_EQ(hud->scroll_tree_index(), root_layer->scroll_tree_index()); | 7497 DCHECK_EQ(hud->scroll_tree_index(), root_layer->scroll_tree_index()); |
| 7498 } | 7498 } |
| 7499 | 7499 |
| 7500 void AfterTest() override {} | 7500 void AfterTest() override {} |
| 7501 }; | 7501 }; |
| 7502 | 7502 |
| 7503 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHudLayerWithLayerLists); | 7503 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHudLayerWithLayerLists); |
| 7504 | 7504 |
| 7505 // Verifies that LayerTreeHost does not receive frame acks from a released | |
|
danakj
2017/04/18 20:58:42
LayerTreeHostClient
Saman Sami
2017/04/18 21:37:13
Done.
| |
| 7506 // CompositorFrameSink. | |
| 7507 class LayerTreeHostTestDiscardAckAfterRelease : public LayerTreeHostTest { | |
| 7508 protected: | |
| 7509 void SetupTree() override { | |
| 7510 scoped_refptr<Layer> root = Layer::Create(); | |
| 7511 root->SetBounds(gfx::Size(10, 10)); | |
| 7512 layer_tree_host()->SetRootLayer(root); | |
|
danakj
2017/04/18 20:58:42
std::move()
Saman Sami
2017/04/18 21:37:13
Done.
| |
| 7513 LayerTreeHostTest::SetupTree(); | |
| 7514 } | |
| 7515 | |
| 7516 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | |
| 7517 | |
| 7518 void WillReceiveCompositorFrameAckOnImplThread() override { | |
| 7519 MainThreadTaskRunner()->PostTask( | |
| 7520 FROM_HERE, base::Bind(&LayerTreeHostTestDiscardAckAfterRelease:: | |
| 7521 ReleaseCompositorFrameSink, | |
| 7522 base::Unretained(this))); | |
| 7523 } | |
| 7524 | |
| 7525 void DidReceiveCompositorFrameAckOnImplThread() override { | |
| 7526 MainThreadTaskRunner()->PostTask( | |
| 7527 FROM_HERE, | |
| 7528 base::Bind( | |
| 7529 &LayerTreeHostTestDiscardAckAfterRelease::VerifyAckNotReceived, | |
|
danakj
2017/04/18 20:58:42
Can you post the VerifyAckNotReceived with a small
Saman Sami
2017/04/18 21:37:13
Done. Good point.
| |
| 7530 base::Unretained(this))); | |
| 7531 } | |
| 7532 | |
| 7533 void DidReceiveCompositorFrameAck() override { received_ack_ = true; } | |
| 7534 | |
| 7535 void ReleaseCompositorFrameSink() { | |
| 7536 layer_tree_host()->SetVisible(false); | |
| 7537 layer_tree_host()->ReleaseCompositorFrameSink(); | |
| 7538 } | |
| 7539 | |
| 7540 void VerifyAckNotReceived() { | |
| 7541 EXPECT_FALSE(received_ack_); | |
| 7542 EndTest(); | |
| 7543 } | |
| 7544 | |
| 7545 void AfterTest() override {} | |
| 7546 | |
| 7547 private: | |
| 7548 bool received_ack_ = false; | |
| 7549 }; | |
| 7550 | |
| 7551 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); | |
| 7552 | |
| 7505 } // namespace | 7553 } // namespace |
| 7506 } // namespace cc | 7554 } // namespace cc |
| OLD | NEW |