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

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

Issue 1584743002: CC Animation: Replace AnimiationEventsVector with AnimiationEvents class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows compilation with MSVC. Created 4 years, 11 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <limits> 11 #include <limits>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 14
15 #include "base/auto_reset.h" 15 #include "base/auto_reset.h"
16 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
17 #include "base/containers/small_map.h" 17 #include "base/containers/small_map.h"
18 #include "base/json/json_writer.h" 18 #include "base/json/json_writer.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/numerics/safe_conversions.h" 20 #include "base/numerics/safe_conversions.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/trace_event/trace_event_argument.h" 23 #include "base/trace_event/trace_event_argument.h"
24 #include "cc/animation/animation_events.h"
24 #include "cc/animation/animation_host.h" 25 #include "cc/animation/animation_host.h"
25 #include "cc/animation/animation_id_provider.h" 26 #include "cc/animation/animation_id_provider.h"
26 #include "cc/animation/scroll_offset_animation_curve.h" 27 #include "cc/animation/scroll_offset_animation_curve.h"
27 #include "cc/animation/scrollbar_animation_controller.h" 28 #include "cc/animation/scrollbar_animation_controller.h"
28 #include "cc/animation/timing_function.h" 29 #include "cc/animation/timing_function.h"
29 #include "cc/base/histograms.h" 30 #include "cc/base/histograms.h"
30 #include "cc/base/math_util.h" 31 #include "cc/base/math_util.h"
31 #include "cc/debug/benchmark_instrumentation.h" 32 #include "cc/debug/benchmark_instrumentation.h"
32 #include "cc/debug/debug_rect_history.h" 33 #include "cc/debug/debug_rect_history.h"
33 #include "cc/debug/devtools_instrumentation.h" 34 #include "cc/debug/devtools_instrumentation.h"
(...skipping 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 // the active tree. There's no need to cause a draw to take place from 3227 // the active tree. There's no need to cause a draw to take place from
3227 // animations starting/ticking on the pending tree. 3228 // animations starting/ticking on the pending tree.
3228 return animated; 3229 return animated;
3229 } 3230 }
3230 3231
3231 void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { 3232 void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
3232 if (!settings_.accelerated_animation_enabled) 3233 if (!settings_.accelerated_animation_enabled)
3233 return; 3234 return;
3234 3235
3235 bool has_active_animations = false; 3236 bool has_active_animations = false;
3236 scoped_ptr<AnimationEventsVector> events; 3237 scoped_ptr<AnimationEvents> events;
3237 3238
3238 if (animation_host_) { 3239 if (animation_host_) {
3239 events = animation_host_->CreateEvents(); 3240 events = animation_host_->CreateEvents();
3240 has_active_animations = animation_host_->UpdateAnimationState( 3241 has_active_animations = animation_host_->UpdateAnimationState(
3241 start_ready_animations, events.get()); 3242 start_ready_animations, events.get());
3242 } else { 3243 } else {
3243 events = animation_registrar_->CreateEvents(); 3244 events = animation_registrar_->CreateEvents();
3244 has_active_animations = animation_registrar_->UpdateAnimationState( 3245 has_active_animations = animation_registrar_->UpdateAnimationState(
3245 start_ready_animations, events.get()); 3246 start_ready_animations, events.get());
3246 } 3247 }
3247 3248
3248 if (!events->empty()) 3249 if (!events->events_.empty())
3249 client_->PostAnimationEventsToMainThreadOnImplThread(std::move(events)); 3250 client_->PostAnimationEventsToMainThreadOnImplThread(std::move(events));
3250 3251
3251 if (has_active_animations) 3252 if (has_active_animations)
3252 SetNeedsOneBeginImplFrame(); 3253 SetNeedsOneBeginImplFrame();
3253 } 3254 }
3254 3255
3255 void LayerTreeHostImpl::ActivateAnimations() { 3256 void LayerTreeHostImpl::ActivateAnimations() {
3256 if (!settings_.accelerated_animation_enabled) 3257 if (!settings_.accelerated_animation_enabled)
3257 return; 3258 return;
3258 3259
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 return task_runner_provider_->HasImplThread(); 3797 return task_runner_provider_->HasImplThread();
3797 } 3798 }
3798 3799
3799 bool LayerTreeHostImpl::CommitToActiveTree() const { 3800 bool LayerTreeHostImpl::CommitToActiveTree() const {
3800 // In single threaded mode we skip the pending tree and commit directly to the 3801 // In single threaded mode we skip the pending tree and commit directly to the
3801 // active tree. 3802 // active tree.
3802 return !task_runner_provider_->HasImplThread(); 3803 return !task_runner_provider_->HasImplThread();
3803 } 3804 }
3804 3805
3805 } // namespace cc 3806 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698