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

Side by Side Diff: cc/animation/layer_animation_controller.cc

Issue 1151763011: Fix assumptions made in LAC::MarkAnimationsForDeletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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
« no previous file with comments | « cc/animation/animation.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/animation/animation.h" 10 #include "cc/animation/animation.h"
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 marked_animations_for_deletions = true; 803 marked_animations_for_deletions = true;
804 continue; 804 continue;
805 } 805 }
806 806
807 bool all_anims_with_same_id_are_finished = false; 807 bool all_anims_with_same_id_are_finished = false;
808 808
809 // Since deleting an animation on the main thread leads to its deletion 809 // Since deleting an animation on the main thread leads to its deletion
810 // on the impl thread, we only mark a FINISHED main thread animation for 810 // on the impl thread, we only mark a FINISHED main thread animation for
811 // deletion once it has received a FINISHED event from the impl thread. 811 // deletion once it has received a FINISHED event from the impl thread.
812 bool animation_i_will_send_or_has_received_finish_event = 812 bool animation_i_will_send_or_has_received_finish_event =
813 events || animations_[i]->received_finished_event(); 813 animations_[i]->is_controlling_instance() ||
814 animations_[i]->is_impl_only() ||
815 animations_[i]->received_finished_event();
814 // If an animation is finished, and not already marked for deletion, 816 // If an animation is finished, and not already marked for deletion,
815 // find out if all other animations in the same group are also finished. 817 // find out if all other animations in the same group are also finished.
816 if (animations_[i]->run_state() == Animation::FINISHED && 818 if (animations_[i]->run_state() == Animation::FINISHED &&
817 animation_i_will_send_or_has_received_finish_event) { 819 animation_i_will_send_or_has_received_finish_event) {
818 // Clear the animations_with_same_group_id if it was added for 820 // Clear the animations_with_same_group_id if it was added for
819 // the previous animation's iteration. 821 // the previous animation's iteration.
820 if (animations_with_same_group_id.size() > 0) 822 if (animations_with_same_group_id.size() > 0)
821 animations_with_same_group_id.clear(); 823 animations_with_same_group_id.clear();
822 all_anims_with_same_id_are_finished = true; 824 all_anims_with_same_id_are_finished = true;
823 for (size_t j = 0; j < animations_.size(); ++j) { 825 for (size_t j = 0; j < animations_.size(); ++j) {
824 bool animation_j_will_send_or_has_received_finish_event = 826 bool animation_j_will_send_or_has_received_finish_event =
825 events || animations_[j]->received_finished_event(); 827 animations_[j]->is_controlling_instance() ||
828 animations_[j]->is_impl_only() ||
829 animations_[j]->received_finished_event();
826 if (group_id == animations_[j]->group()) { 830 if (group_id == animations_[j]->group()) {
827 if (!animations_[j]->is_finished() || 831 if (!animations_[j]->is_finished() ||
828 (animations_[j]->run_state() == Animation::FINISHED && 832 (animations_[j]->run_state() == Animation::FINISHED &&
829 !animation_j_will_send_or_has_received_finish_event)) { 833 !animation_j_will_send_or_has_received_finish_event)) {
830 all_anims_with_same_id_are_finished = false; 834 all_anims_with_same_id_are_finished = false;
831 break; 835 break;
832 } else if (j >= i && 836 } else if (j >= i &&
833 animations_[j]->run_state() != Animation::ABORTED) { 837 animations_[j]->run_state() != Animation::ABORTED) {
834 // Mark down the animations which belong to the same group 838 // Mark down the animations which belong to the same group
835 // and is not yet aborted. If this current iteration finds that all 839 // and is not yet aborted. If this current iteration finds that all
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 &value_observers_); 1063 &value_observers_);
1060 LayerAnimationValueObserver* obs; 1064 LayerAnimationValueObserver* obs;
1061 while ((obs = it.GetNext()) != nullptr) 1065 while ((obs = it.GetNext()) != nullptr)
1062 if (obs->IsActive()) 1066 if (obs->IsActive())
1063 return true; 1067 return true;
1064 } 1068 }
1065 return false; 1069 return false;
1066 } 1070 }
1067 1071
1068 } // namespace cc 1072 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698