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

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: Rebase. 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 // the active tree. There's no need to cause a draw to take place from 3259 // the active tree. There's no need to cause a draw to take place from
3259 // animations starting/ticking on the pending tree. 3260 // animations starting/ticking on the pending tree.
3260 return animated; 3261 return animated;
3261 } 3262 }
3262 3263
3263 void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { 3264 void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
3264 if (!settings_.accelerated_animation_enabled) 3265 if (!settings_.accelerated_animation_enabled)
3265 return; 3266 return;
3266 3267
3267 bool has_active_animations = false; 3268 bool has_active_animations = false;
3268 scoped_ptr<AnimationEventsVector> events; 3269 scoped_ptr<AnimationEvents> events;
3269 3270
3270 if (animation_host_) { 3271 if (animation_host_) {
3271 events = animation_host_->CreateEvents(); 3272 events = animation_host_->CreateEvents();
3272 has_active_animations = animation_host_->UpdateAnimationState( 3273 has_active_animations = animation_host_->UpdateAnimationState(
3273 start_ready_animations, events.get()); 3274 start_ready_animations, events.get());
3274 } else { 3275 } else {
3275 events = animation_registrar_->CreateEvents(); 3276 events = animation_registrar_->CreateEvents();
3276 has_active_animations = animation_registrar_->UpdateAnimationState( 3277 has_active_animations = animation_registrar_->UpdateAnimationState(
3277 start_ready_animations, events.get()); 3278 start_ready_animations, events.get());
3278 } 3279 }
3279 3280
3280 if (!events->empty()) 3281 if (!events->events_.empty())
3281 client_->PostAnimationEventsToMainThreadOnImplThread(std::move(events)); 3282 client_->PostAnimationEventsToMainThreadOnImplThread(std::move(events));
3282 3283
3283 if (has_active_animations) 3284 if (has_active_animations)
3284 SetNeedsOneBeginImplFrame(); 3285 SetNeedsOneBeginImplFrame();
3285 } 3286 }
3286 3287
3287 void LayerTreeHostImpl::ActivateAnimations() { 3288 void LayerTreeHostImpl::ActivateAnimations() {
3288 if (!settings_.accelerated_animation_enabled) 3289 if (!settings_.accelerated_animation_enabled)
3289 return; 3290 return;
3290 3291
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
3830 return task_runner_provider_->HasImplThread(); 3831 return task_runner_provider_->HasImplThread();
3831 } 3832 }
3832 3833
3833 bool LayerTreeHostImpl::CommitToActiveTree() const { 3834 bool LayerTreeHostImpl::CommitToActiveTree() const {
3834 // In single threaded mode we skip the pending tree and commit directly to the 3835 // In single threaded mode we skip the pending tree and commit directly to the
3835 // active tree. 3836 // active tree.
3836 return !task_runner_provider_->HasImplThread(); 3837 return !task_runner_provider_->HasImplThread();
3837 } 3838 }
3838 3839
3839 } // namespace cc 3840 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698