Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/blimp/layer_tree_host_remote.h" | 5 #include "cc/blimp/layer_tree_host_remote.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 // Destroy a layer and send a scroll update for it. We should be informed that | 406 // Destroy a layer and send a scroll update for it. We should be informed that |
| 407 // the update could not be applied successfully. | 407 // the update could not be applied successfully. |
| 408 child_layer1->RemoveAllChildren(); | 408 child_layer1->RemoveAllChildren(); |
| 409 scroll_updates.clear(); | 409 scroll_updates.clear(); |
| 410 scroll_updates[child_layer2->id()] = gfx::ScrollOffset(3, 2); | 410 scroll_updates[child_layer2->id()] = gfx::ScrollOffset(3, 2); |
| 411 updates_applied = | 411 updates_applied = |
| 412 remote_compositor_bridge_->SendUpdates(scroll_updates, new_scale_factor); | 412 remote_compositor_bridge_->SendUpdates(scroll_updates, new_scale_factor); |
| 413 EXPECT_FALSE(updates_applied); | 413 EXPECT_FALSE(updates_applied); |
| 414 } | 414 } |
| 415 | 415 |
| 416 TEST_F(LayerTreeHostRemoteTest, IdentifiedLayersToSkipUpdates) { | |
| 417 EXPECT_BEGIN_MAIN_FRAME_AND_COMMIT(mock_layer_tree_host_client_, 1); | |
| 418 | |
| 419 scoped_refptr<MockLayer> non_drawable_layer = new MockLayer(true); | |
| 420 non_drawable_layer->SetIsDrawable(false); | |
| 421 non_drawable_layer->SetBounds(gfx::Size(5, 5)); | |
| 422 | |
| 423 scoped_refptr<MockLayer> empty_bound_layer = new MockLayer(true); | |
|
ajuma
2016/11/01 21:37:07
nit: empty_bounds_layer
| |
| 424 empty_bound_layer->SetIsDrawable(true); | |
| 425 empty_bound_layer->SetBounds(gfx::Size()); | |
| 426 | |
| 427 scoped_refptr<MockLayer> transparent_layer = new MockLayer(true); | |
| 428 transparent_layer->SetIsDrawable(true); | |
| 429 transparent_layer->SetBounds(gfx::Size(5, 5)); | |
| 430 transparent_layer->SetOpacity(0.f); | |
| 431 | |
| 432 scoped_refptr<MockLayer> updated_layer = new MockLayer(true); | |
| 433 updated_layer->SetIsDrawable(true); | |
| 434 updated_layer->SetBounds(gfx::Size(5, 5)); | |
| 435 | |
| 436 root_layer_->AddChild(non_drawable_layer); | |
| 437 root_layer_->AddChild(empty_bound_layer); | |
| 438 empty_bound_layer->SetMaskLayer(transparent_layer.get()); | |
| 439 empty_bound_layer->AddChild(updated_layer); | |
| 440 DCHECK(updated_layer->GetLayerTreeHostForTesting()); | |
| 441 | |
| 442 // Commit and serialize. | |
| 443 layer_tree_host_->SetNeedsCommit(); | |
| 444 base::RunLoop().RunUntilIdle(); | |
| 445 | |
| 446 // Only the updated_layer should have been updated. | |
| 447 EXPECT_FALSE(non_drawable_layer->did_update()); | |
| 448 EXPECT_FALSE(empty_bound_layer->did_update()); | |
| 449 EXPECT_FALSE(transparent_layer->did_update()); | |
| 450 EXPECT_TRUE(updated_layer->did_update()); | |
| 451 } | |
| 452 | |
| 416 } // namespace | 453 } // namespace |
| 417 } // namespace cc | 454 } // namespace cc |
| OLD | NEW |