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

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

Issue 231133002: CC::Animations should use TimeTicks & TimeDelta to represent time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding Animation related changes and unittests Created 6 years, 8 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 current, 1127 current,
1128 animate)); 1128 animate));
1129 } 1129 }
1130 1130
1131 scoped_ptr<base::Value> LayerTreeHost::AsValue() const { 1131 scoped_ptr<base::Value> LayerTreeHost::AsValue() const {
1132 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1132 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1133 state->Set("proxy", proxy_->AsValue().release()); 1133 state->Set("proxy", proxy_->AsValue().release());
1134 return state.PassAs<base::Value>(); 1134 return state.PassAs<base::Value>();
1135 } 1135 }
1136 1136
1137 void LayerTreeHost::AnimateLayers(base::TimeTicks time) { 1137 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
1138 if (!settings_.accelerated_animation_enabled || 1138 if (!settings_.accelerated_animation_enabled ||
1139 animation_registrar_->active_animation_controllers().empty()) 1139 animation_registrar_->active_animation_controllers().empty())
1140 return; 1140 return;
1141 1141
1142 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); 1142 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers");
1143 1143
1144 double monotonic_time = (time - base::TimeTicks()).InSecondsF();
1145
1146 AnimationRegistrar::AnimationControllerMap copy = 1144 AnimationRegistrar::AnimationControllerMap copy =
1147 animation_registrar_->active_animation_controllers(); 1145 animation_registrar_->active_animation_controllers();
1148 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); 1146 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
1149 iter != copy.end(); 1147 iter != copy.end();
1150 ++iter) { 1148 ++iter) {
1151 (*iter).second->Animate(monotonic_time); 1149 (*iter).second->Animate(monotonic_time);
1152 bool start_ready_animations = true; 1150 bool start_ready_animations = true;
1153 (*iter).second->UpdateState(start_ready_animations, NULL); 1151 (*iter).second->UpdateState(start_ready_animations, NULL);
1154 } 1152 }
1155 } 1153 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 swap_promise_list_.push_back(swap_promise.Pass()); 1246 swap_promise_list_.push_back(swap_promise.Pass());
1249 } 1247 }
1250 1248
1251 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1249 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1252 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1250 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1253 swap_promise_list_[i]->DidNotSwap(reason); 1251 swap_promise_list_[i]->DidNotSwap(reason);
1254 swap_promise_list_.clear(); 1252 swap_promise_list_.clear();
1255 } 1253 }
1256 1254
1257 } // namespace cc 1255 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698