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

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: Code changed as per review 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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 current, 1136 current,
1137 animate)); 1137 animate));
1138 } 1138 }
1139 1139
1140 scoped_ptr<base::Value> LayerTreeHost::AsValue() const { 1140 scoped_ptr<base::Value> LayerTreeHost::AsValue() const {
1141 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1141 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1142 state->Set("proxy", proxy_->AsValue().release()); 1142 state->Set("proxy", proxy_->AsValue().release());
1143 return state.PassAs<base::Value>(); 1143 return state.PassAs<base::Value>();
1144 } 1144 }
1145 1145
1146 void LayerTreeHost::AnimateLayers(base::TimeTicks time) { 1146 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
1147 if (!settings_.accelerated_animation_enabled || 1147 if (!settings_.accelerated_animation_enabled ||
1148 animation_registrar_->active_animation_controllers().empty()) 1148 animation_registrar_->active_animation_controllers().empty())
1149 return; 1149 return;
1150 1150
1151 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); 1151 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers");
1152 1152
1153 double monotonic_time = (time - base::TimeTicks()).InSecondsF();
1154
1155 AnimationRegistrar::AnimationControllerMap copy = 1153 AnimationRegistrar::AnimationControllerMap copy =
1156 animation_registrar_->active_animation_controllers(); 1154 animation_registrar_->active_animation_controllers();
1157 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); 1155 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
1158 iter != copy.end(); 1156 iter != copy.end();
1159 ++iter) { 1157 ++iter) {
1160 (*iter).second->Animate(monotonic_time); 1158 (*iter).second->Animate(monotonic_time);
1161 bool start_ready_animations = true; 1159 bool start_ready_animations = true;
1162 (*iter).second->UpdateState(start_ready_animations, NULL); 1160 (*iter).second->UpdateState(start_ready_animations, NULL);
1163 } 1161 }
1164 } 1162 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 swap_promise_list_.push_back(swap_promise.Pass()); 1255 swap_promise_list_.push_back(swap_promise.Pass());
1258 } 1256 }
1259 1257
1260 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1258 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1261 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1259 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1262 swap_promise_list_[i]->DidNotSwap(reason); 1260 swap_promise_list_[i]->DidNotSwap(reason);
1263 swap_promise_list_.clear(); 1261 swap_promise_list_.clear();
1264 } 1262 }
1265 1263
1266 } // namespace cc 1264 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698