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

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

Issue 632613002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/animation/animation.h" 9 #include "cc/animation/animation.h"
10 #include "cc/animation/animation_delegate.h" 10 #include "cc/animation/animation_delegate.h"
11 #include "cc/animation/animation_registrar.h" 11 #include "cc/animation/animation_registrar.h"
12 #include "cc/animation/keyframed_animation_curve.h" 12 #include "cc/animation/keyframed_animation_curve.h"
13 #include "cc/animation/layer_animation_value_observer.h" 13 #include "cc/animation/layer_animation_value_observer.h"
14 #include "cc/animation/layer_animation_value_provider.h" 14 #include "cc/animation/layer_animation_value_provider.h"
15 #include "cc/animation/scroll_offset_animation_curve.h" 15 #include "cc/animation/scroll_offset_animation_curve.h"
16 #include "cc/base/scoped_ptr_algorithm.h" 16 #include "cc/base/scoped_ptr_algorithm.h"
17 #include "cc/output/filter_operations.h" 17 #include "cc/output/filter_operations.h"
18 #include "ui/gfx/box_f.h" 18 #include "ui/gfx/box_f.h"
19 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
20 20
21 namespace cc { 21 namespace cc {
22 22
23 LayerAnimationController::LayerAnimationController(int id) 23 LayerAnimationController::LayerAnimationController(int id)
24 : registrar_(0), 24 : registrar_(0),
25 id_(id), 25 id_(id),
26 is_active_(false), 26 is_active_(false),
27 value_provider_(NULL), 27 value_provider_(nullptr),
28 layer_animation_delegate_(NULL), 28 layer_animation_delegate_(nullptr),
29 needs_to_start_animations_(false) { 29 needs_to_start_animations_(false) {
30 } 30 }
31 31
32 LayerAnimationController::~LayerAnimationController() { 32 LayerAnimationController::~LayerAnimationController() {
33 if (registrar_) 33 if (registrar_)
34 registrar_->UnregisterAnimationController(this); 34 registrar_->UnregisterAnimationController(this);
35 } 35 }
36 36
37 scoped_refptr<LayerAnimationController> LayerAnimationController::Create( 37 scoped_refptr<LayerAnimationController> LayerAnimationController::Create(
38 int id) { 38 int id) {
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 } 926 }
927 927
928 void LayerAnimationController::NotifyObserversOpacityAnimated( 928 void LayerAnimationController::NotifyObserversOpacityAnimated(
929 float opacity, 929 float opacity,
930 bool notify_active_observers, 930 bool notify_active_observers,
931 bool notify_pending_observers) { 931 bool notify_pending_observers) {
932 if (value_observers_.might_have_observers()) { 932 if (value_observers_.might_have_observers()) {
933 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 933 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
934 value_observers_); 934 value_observers_);
935 LayerAnimationValueObserver* obs; 935 LayerAnimationValueObserver* obs;
936 while ((obs = it.GetNext()) != NULL) { 936 while ((obs = it.GetNext()) != nullptr) {
937 if ((notify_active_observers && notify_pending_observers) || 937 if ((notify_active_observers && notify_pending_observers) ||
938 (notify_active_observers && obs->IsActive()) || 938 (notify_active_observers && obs->IsActive()) ||
939 (notify_pending_observers && !obs->IsActive())) 939 (notify_pending_observers && !obs->IsActive()))
940 obs->OnOpacityAnimated(opacity); 940 obs->OnOpacityAnimated(opacity);
941 } 941 }
942 } 942 }
943 } 943 }
944 944
945 void LayerAnimationController::NotifyObserversTransformAnimated( 945 void LayerAnimationController::NotifyObserversTransformAnimated(
946 const gfx::Transform& transform, 946 const gfx::Transform& transform,
947 bool notify_active_observers, 947 bool notify_active_observers,
948 bool notify_pending_observers) { 948 bool notify_pending_observers) {
949 if (value_observers_.might_have_observers()) { 949 if (value_observers_.might_have_observers()) {
950 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 950 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
951 value_observers_); 951 value_observers_);
952 LayerAnimationValueObserver* obs; 952 LayerAnimationValueObserver* obs;
953 while ((obs = it.GetNext()) != NULL) { 953 while ((obs = it.GetNext()) != nullptr) {
954 if ((notify_active_observers && notify_pending_observers) || 954 if ((notify_active_observers && notify_pending_observers) ||
955 (notify_active_observers && obs->IsActive()) || 955 (notify_active_observers && obs->IsActive()) ||
956 (notify_pending_observers && !obs->IsActive())) 956 (notify_pending_observers && !obs->IsActive()))
957 obs->OnTransformAnimated(transform); 957 obs->OnTransformAnimated(transform);
958 } 958 }
959 } 959 }
960 } 960 }
961 961
962 void LayerAnimationController::NotifyObserversFilterAnimated( 962 void LayerAnimationController::NotifyObserversFilterAnimated(
963 const FilterOperations& filters, 963 const FilterOperations& filters,
964 bool notify_active_observers, 964 bool notify_active_observers,
965 bool notify_pending_observers) { 965 bool notify_pending_observers) {
966 if (value_observers_.might_have_observers()) { 966 if (value_observers_.might_have_observers()) {
967 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 967 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
968 value_observers_); 968 value_observers_);
969 LayerAnimationValueObserver* obs; 969 LayerAnimationValueObserver* obs;
970 while ((obs = it.GetNext()) != NULL) { 970 while ((obs = it.GetNext()) != nullptr) {
971 if ((notify_active_observers && notify_pending_observers) || 971 if ((notify_active_observers && notify_pending_observers) ||
972 (notify_active_observers && obs->IsActive()) || 972 (notify_active_observers && obs->IsActive()) ||
973 (notify_pending_observers && !obs->IsActive())) 973 (notify_pending_observers && !obs->IsActive()))
974 obs->OnFilterAnimated(filters); 974 obs->OnFilterAnimated(filters);
975 } 975 }
976 } 976 }
977 } 977 }
978 978
979 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( 979 void LayerAnimationController::NotifyObserversScrollOffsetAnimated(
980 const gfx::Vector2dF& scroll_offset, 980 const gfx::Vector2dF& scroll_offset,
981 bool notify_active_observers, 981 bool notify_active_observers,
982 bool notify_pending_observers) { 982 bool notify_pending_observers) {
983 if (value_observers_.might_have_observers()) { 983 if (value_observers_.might_have_observers()) {
984 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 984 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
985 value_observers_); 985 value_observers_);
986 LayerAnimationValueObserver* obs; 986 LayerAnimationValueObserver* obs;
987 while ((obs = it.GetNext()) != NULL) { 987 while ((obs = it.GetNext()) != nullptr) {
988 if ((notify_active_observers && notify_pending_observers) || 988 if ((notify_active_observers && notify_pending_observers) ||
989 (notify_active_observers && obs->IsActive()) || 989 (notify_active_observers && obs->IsActive()) ||
990 (notify_pending_observers && !obs->IsActive())) 990 (notify_pending_observers && !obs->IsActive()))
991 obs->OnScrollOffsetAnimated(scroll_offset); 991 obs->OnScrollOffsetAnimated(scroll_offset);
992 } 992 }
993 } 993 }
994 } 994 }
995 995
996 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { 996 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() {
997 FOR_EACH_OBSERVER(LayerAnimationValueObserver, 997 FOR_EACH_OBSERVER(LayerAnimationValueObserver,
998 value_observers_, 998 value_observers_,
999 OnAnimationWaitingForDeletion()); 999 OnAnimationWaitingForDeletion());
1000 } 1000 }
1001 1001
1002 bool LayerAnimationController::HasValueObserver() { 1002 bool LayerAnimationController::HasValueObserver() {
1003 if (value_observers_.might_have_observers()) { 1003 if (value_observers_.might_have_observers()) {
1004 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 1004 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
1005 value_observers_); 1005 value_observers_);
1006 return it.GetNext() != NULL; 1006 return it.GetNext() != nullptr;
1007 } 1007 }
1008 return false; 1008 return false;
1009 } 1009 }
1010 1010
1011 bool LayerAnimationController::HasActiveValueObserver() { 1011 bool LayerAnimationController::HasActiveValueObserver() {
1012 if (value_observers_.might_have_observers()) { 1012 if (value_observers_.might_have_observers()) {
1013 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 1013 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
1014 value_observers_); 1014 value_observers_);
1015 LayerAnimationValueObserver* obs; 1015 LayerAnimationValueObserver* obs;
1016 while ((obs = it.GetNext()) != NULL) 1016 while ((obs = it.GetNext()) != nullptr)
1017 if (obs->IsActive()) 1017 if (obs->IsActive())
1018 return true; 1018 return true;
1019 } 1019 }
1020 return false; 1020 return false;
1021 } 1021 }
1022 1022
1023 } // namespace cc 1023 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698