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

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

Issue 2155123003: cc: Fix use-after-frees for LayerTreeHostAnimationTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test-task-runner-gone: =nullptr 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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 break; 1337 break;
1338 } 1338 }
1339 } 1339 }
1340 1340
1341 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) 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 1346
1347 // Animation state is updated after drawing. 1347 // Animation state is updated after drawing. Only do this once.
1348 ImplThreadTaskRunner()->PostTask( 1348 if (!TestEnded()) {
1349 FROM_HERE, 1349 ImplThreadTaskRunner()->PostTask(
1350 base::Bind(&LayerTreeHostAnimationTestAddAnimationAfterAnimating:: 1350 FROM_HERE,
1351 CheckAnimations, 1351 base::Bind(&LayerTreeHostAnimationTestAddAnimationAfterAnimating::
1352 base::Unretained(this), host_impl)); 1352 CheckAnimations,
1353 base::Unretained(this), host_impl));
1354 }
1353 } 1355 }
1354 1356
1355 void CheckAnimations(LayerTreeHostImpl* host_impl) { 1357 void CheckAnimations(LayerTreeHostImpl* host_impl) {
1356 AnimationHost::ElementToAnimationsMap element_animations_copy = 1358 AnimationHost::ElementToAnimationsMap element_animations_copy =
1357 host_impl->animation_host()->active_element_animations_for_testing(); 1359 host_impl->animation_host()->active_element_animations_for_testing();
1358 EXPECT_EQ(2u, element_animations_copy.size()); 1360 EXPECT_EQ(2u, element_animations_copy.size());
1359 for (auto& it : element_animations_copy) { 1361 for (auto& it : element_animations_copy) {
1360 ElementId id = it.first; 1362 ElementId id = it.first;
1361 if (id == 1363 if (id ==
1362 host_impl->active_tree()->root_layer_for_testing()->element_id()) { 1364 host_impl->active_tree()->root_layer_for_testing()->element_id()) {
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 private: 1857 private:
1856 scoped_refptr<Layer> layer_; 1858 scoped_refptr<Layer> layer_;
1857 FakeContentLayerClient client_; 1859 FakeContentLayerClient client_;
1858 }; 1860 };
1859 1861
1860 MULTI_THREAD_TEST_F( 1862 MULTI_THREAD_TEST_F(
1861 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); 1863 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit);
1862 1864
1863 } // namespace 1865 } // namespace
1864 } // namespace cc 1866 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698