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

Side by Side Diff: cc/blimp/layer_tree_host_remote_unittest.cc

Issue 2467043002: cc/blimp: Eliminate Layer updates for common cases. (Closed)
Patch Set: tests Created 4 years, 1 month 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
« no previous file with comments | « cc/blimp/layer_tree_host_remote.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/blimp/layer_tree_host_remote.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698