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

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

Issue 2151433004: cc: Make LayerTreeHostImpl::SwapBuffers not virtual. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removedidswap
Patch Set: novirtualswapbuffers: . Created 4 years, 5 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "cc/animation/animation_curve.h" 9 #include "cc/animation/animation_curve.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 AddAnimatedTransformToPlayer(player_.get(), 0.1, 5, 5); 1331 AddAnimatedTransformToPlayer(player_.get(), 0.1, 5, 5);
1332 break; 1332 break;
1333 case 2: 1333 case 2:
1334 // Second frame: add an animation to the content layer. The root layer 1334 // Second frame: add an animation to the content layer. The root layer
1335 // animation has caused us to animate already during this frame. 1335 // animation has caused us to animate already during this frame.
1336 AddOpacityTransitionToPlayer(player_child_.get(), 0.1, 5, 5, false); 1336 AddOpacityTransitionToPlayer(player_child_.get(), 0.1, 5, 5, false);
1337 break; 1337 break;
1338 } 1338 }
1339 } 1339 }
1340 1340
1341 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { 1341 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
1342 // After both animations have started, verify that they have valid 1342 // After both animations have started, verify that they have valid
1343 // start times. 1343 // start times.
1344 if (host_impl->active_tree()->source_frame_number() < 2) 1344 if (host_impl->active_tree()->source_frame_number() < 2)
1345 return; 1345 return;
1346
1347 // Animation state is updated after drawing.
danakj 2016/07/13 21:50:18 This one is a bit awk. ProxyImpl does Draw -> Upda
1348 ImplThreadTaskRunner()->PostTask(
1349 FROM_HERE,
1350 base::Bind(&LayerTreeHostAnimationTestAddAnimationAfterAnimating::
1351 CheckAnimations,
1352 base::Unretained(this), host_impl));
1353 }
1354
1355 void CheckAnimations(LayerTreeHostImpl* host_impl) {
1346 AnimationHost::ElementToAnimationsMap element_animations_copy = 1356 AnimationHost::ElementToAnimationsMap element_animations_copy =
1347 host_impl->animation_host()->active_element_animations_for_testing(); 1357 host_impl->animation_host()->active_element_animations_for_testing();
1348 EXPECT_EQ(2u, element_animations_copy.size()); 1358 EXPECT_EQ(2u, element_animations_copy.size());
1349 for (auto& it : element_animations_copy) { 1359 for (auto& it : element_animations_copy) {
1350 ElementId id = it.first; 1360 ElementId id = it.first;
1351 if (id == 1361 if (id ==
1352 host_impl->active_tree()->root_layer_for_testing()->element_id()) { 1362 host_impl->active_tree()->root_layer_for_testing()->element_id()) {
1353 Animation* anim = it.second->GetAnimation(TargetProperty::TRANSFORM); 1363 Animation* anim = it.second->GetAnimation(TargetProperty::TRANSFORM);
1354 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); 1364 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
1355 } else if (id == layer_->element_id()) { 1365 } else if (id == layer_->element_id()) {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 private: 1855 private:
1846 scoped_refptr<Layer> layer_; 1856 scoped_refptr<Layer> layer_;
1847 FakeContentLayerClient client_; 1857 FakeContentLayerClient client_;
1848 }; 1858 };
1849 1859
1850 MULTI_THREAD_TEST_F( 1860 MULTI_THREAD_TEST_F(
1851 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); 1861 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit);
1852 1862
1853 } // namespace 1863 } // namespace
1854 } // namespace cc 1864 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698