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

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: Updated code as per the comments. Created 6 years, 7 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 current, 1143 current,
1144 animate)); 1144 animate));
1145 } 1145 }
1146 1146
1147 scoped_ptr<base::Value> LayerTreeHost::AsValue() const { 1147 scoped_ptr<base::Value> LayerTreeHost::AsValue() const {
1148 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1148 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1149 state->Set("proxy", proxy_->AsValue().release()); 1149 state->Set("proxy", proxy_->AsValue().release());
1150 return state.PassAs<base::Value>(); 1150 return state.PassAs<base::Value>();
1151 } 1151 }
1152 1152
1153 void LayerTreeHost::AnimateLayers(base::TimeTicks time) { 1153 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
1154 if (!settings_.accelerated_animation_enabled || 1154 if (!settings_.accelerated_animation_enabled ||
1155 animation_registrar_->active_animation_controllers().empty()) 1155 animation_registrar_->active_animation_controllers().empty())
1156 return; 1156 return;
1157 1157
1158 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); 1158 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers");
1159 1159
1160 double monotonic_time = (time - base::TimeTicks()).InSecondsF();
1161
1162 AnimationRegistrar::AnimationControllerMap copy = 1160 AnimationRegistrar::AnimationControllerMap copy =
1163 animation_registrar_->active_animation_controllers(); 1161 animation_registrar_->active_animation_controllers();
1164 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); 1162 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
1165 iter != copy.end(); 1163 iter != copy.end();
1166 ++iter) { 1164 ++iter) {
1167 (*iter).second->Animate(monotonic_time); 1165 (*iter).second->Animate(monotonic_time);
1168 bool start_ready_animations = true; 1166 bool start_ready_animations = true;
1169 (*iter).second->UpdateState(start_ready_animations, NULL); 1167 (*iter).second->UpdateState(start_ready_animations, NULL);
1170 } 1168 }
1171 } 1169 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 swap_promise_list_.push_back(swap_promise.Pass()); 1262 swap_promise_list_.push_back(swap_promise.Pass());
1265 } 1263 }
1266 1264
1267 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1265 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1268 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1266 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1269 swap_promise_list_[i]->DidNotSwap(reason); 1267 swap_promise_list_[i]->DidNotSwap(reason);
1270 swap_promise_list_.clear(); 1268 swap_promise_list_.clear();
1271 } 1269 }
1272 1270
1273 } // namespace cc 1271 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698