Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2822303003: cc : Compute subtree has copy requests before property tree building (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 6490 matching lines...) Expand 10 before | Expand all | Expand 10 after
6501 LayerTreeHostTest::SetupTree(); 6501 LayerTreeHostTest::SetupTree();
6502 } 6502 }
6503 6503
6504 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} 6504 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
6505 6505
6506 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6506 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6507 6507
6508 void WillCommit() override { 6508 void WillCommit() override {
6509 switch (layer_tree_host()->SourceFrameNumber()) { 6509 switch (layer_tree_host()->SourceFrameNumber()) {
6510 case 1: 6510 case 1:
6511 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); 6511 EXPECT_TRUE(root->has_copy_requests_in_target_subtree());
6512 break; 6512 break;
6513 } 6513 }
6514 } 6514 }
6515 6515
6516 void DidCommit() override { 6516 void DidCommit() override {
6517 gfx::Transform transform; 6517 gfx::Transform transform;
6518 switch (layer_tree_host()->SourceFrameNumber()) { 6518 switch (layer_tree_host()->SourceFrameNumber()) {
6519 case 1: 6519 case 1:
6520 child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 6520 child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
6521 base::Bind(CopyOutputCallback))); 6521 base::Bind(CopyOutputCallback)));
6522 transform.Scale(2.0, 2.0); 6522 transform.Scale(2.0, 2.0);
6523 child->SetTransform(transform); 6523 child->SetTransform(transform);
6524 break; 6524 break;
6525 case 2: 6525 case 2:
6526 // By changing the scale of a layer which already owns a transform node, 6526 // By changing the scale of a layer which already owns a transform node,
6527 // a commit will be triggered but a property tree rebuild will not, this 6527 // a commit will be triggered but a property tree rebuild will not, this
6528 // is used to test sure that clearing copy requestts does trigger a 6528 // is used to test sure that clearing copy requestts does trigger a
6529 // rebuild whenever next commit happens. 6529 // rebuild whenever next commit happens.
6530 transform.Scale(1.5, 1.5); 6530 transform.Scale(1.5, 1.5);
6531 child->SetTransform(transform); 6531 child->SetTransform(transform);
6532 break; 6532 break;
6533 case 3: 6533 case 3:
6534 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 0); 6534 EXPECT_FALSE(root->has_copy_requests_in_target_subtree());
6535 EndTest(); 6535 EndTest();
6536 break; 6536 break;
6537 } 6537 }
6538 } 6538 }
6539 6539
6540 void AfterTest() override {} 6540 void AfterTest() override {}
6541 6541
6542 private: 6542 private:
6543 scoped_refptr<Layer> root; 6543 scoped_refptr<Layer> root;
6544 scoped_refptr<Layer> child; 6544 scoped_refptr<Layer> child;
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } // namespace 7505 } // namespace
7506 } // namespace cc 7506 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698