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

Side by Side Diff: cc/trees/layer_tree_host.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.h ('k') | cc/trees/layer_tree_host_impl.h » ('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.h" 5 #include "cc/trees/layer_tree_host.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 <stack> 11 #include <stack>
12 #include <string> 12 #include <string>
13 13
14 #include "base/atomic_sequence_num.h" 14 #include "base/atomic_sequence_num.h"
15 #include "base/auto_reset.h" 15 #include "base/auto_reset.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/location.h" 18 #include "base/location.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/thread_task_runner_handle.h" 23 #include "base/thread_task_runner_handle.h"
24 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
25 #include "base/trace_event/trace_event_argument.h" 25 #include "base/trace_event/trace_event_argument.h"
26 #include "cc/animation/animation_events.h"
26 #include "cc/animation/animation_host.h" 27 #include "cc/animation/animation_host.h"
27 #include "cc/animation/animation_registrar.h" 28 #include "cc/animation/animation_registrar.h"
28 #include "cc/animation/layer_animation_controller.h" 29 #include "cc/animation/layer_animation_controller.h"
29 #include "cc/base/math_util.h" 30 #include "cc/base/math_util.h"
30 #include "cc/debug/devtools_instrumentation.h" 31 #include "cc/debug/devtools_instrumentation.h"
31 #include "cc/debug/frame_viewer_instrumentation.h" 32 #include "cc/debug/frame_viewer_instrumentation.h"
32 #include "cc/debug/rendering_stats_instrumentation.h" 33 #include "cc/debug/rendering_stats_instrumentation.h"
33 #include "cc/input/layer_selection_bound.h" 34 #include "cc/input/layer_selection_bound.h"
34 #include "cc/input/page_scale_animation.h" 35 #include "cc/input/page_scale_animation.h"
35 #include "cc/layers/heads_up_display_layer.h" 36 #include "cc/layers/heads_up_display_layer.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 546
546 void LayerTreeHost::SetNextCommitWaitsForActivation() { 547 void LayerTreeHost::SetNextCommitWaitsForActivation() {
547 proxy_->SetNextCommitWaitsForActivation(); 548 proxy_->SetNextCommitWaitsForActivation();
548 } 549 }
549 550
550 void LayerTreeHost::SetNextCommitForcesRedraw() { 551 void LayerTreeHost::SetNextCommitForcesRedraw() {
551 next_commit_forces_redraw_ = true; 552 next_commit_forces_redraw_ = true;
552 proxy_->SetNeedsUpdateLayers(); 553 proxy_->SetNeedsUpdateLayers();
553 } 554 }
554 555
555 void LayerTreeHost::SetAnimationEvents( 556 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEvents> events) {
556 scoped_ptr<AnimationEventsVector> events) {
557 DCHECK(task_runner_provider_->IsMainThread()); 557 DCHECK(task_runner_provider_->IsMainThread());
558 if (animation_host_) 558 if (animation_host_)
559 animation_host_->SetAnimationEvents(std::move(events)); 559 animation_host_->SetAnimationEvents(std::move(events));
560 else 560 else
561 animation_registrar_->SetAnimationEvents(std::move(events)); 561 animation_registrar_->SetAnimationEvents(std::move(events));
562 } 562 }
563 563
564 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { 564 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
565 if (root_layer_.get() == root_layer.get()) 565 if (root_layer_.get() == root_layer.get())
566 return; 566 return;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 bool animate) { 914 bool animate) {
915 // Top controls are only used in threaded mode. 915 // Top controls are only used in threaded mode.
916 DCHECK(IsThreaded()); 916 DCHECK(IsThreaded());
917 proxy_->UpdateTopControlsState(constraints, current, animate); 917 proxy_->UpdateTopControlsState(constraints, current, animate);
918 } 918 }
919 919
920 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { 920 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
921 if (!settings_.accelerated_animation_enabled) 921 if (!settings_.accelerated_animation_enabled)
922 return; 922 return;
923 923
924 AnimationEventsVector events; 924 scoped_ptr<AnimationEvents> events;
925 if (animation_host_) { 925 if (animation_host_) {
926 events = animation_host_->CreateEvents();
926 if (animation_host_->AnimateLayers(monotonic_time)) 927 if (animation_host_->AnimateLayers(monotonic_time))
927 animation_host_->UpdateAnimationState(true, &events); 928 animation_host_->UpdateAnimationState(true, events.get());
928 } else { 929 } else {
930 events = animation_registrar_->CreateEvents();
929 if (animation_registrar_->AnimateLayers(monotonic_time)) 931 if (animation_registrar_->AnimateLayers(monotonic_time))
930 animation_registrar_->UpdateAnimationState(true, &events); 932 animation_registrar_->UpdateAnimationState(true, events.get());
931 } 933 }
932 934
933 if (!events.empty()) 935 if (!events->events_.empty())
934 property_trees_.needs_rebuild = true; 936 property_trees_.needs_rebuild = true;
935 } 937 }
936 938
937 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { 939 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) {
938 DCHECK(client); 940 DCHECK(client);
939 941
940 UIResourceId next_id = next_ui_resource_id_++; 942 UIResourceId next_id = next_ui_resource_id_++;
941 DCHECK(ui_resource_client_map_.find(next_id) == 943 DCHECK(ui_resource_client_map_.find(next_id) ==
942 ui_resource_client_map_.end()); 944 ui_resource_client_map_.end());
943 945
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 return compositor_mode_ == CompositorMode::SingleThreaded; 1272 return compositor_mode_ == CompositorMode::SingleThreaded;
1271 } 1273 }
1272 1274
1273 bool LayerTreeHost::IsThreaded() const { 1275 bool LayerTreeHost::IsThreaded() const {
1274 DCHECK(compositor_mode_ != CompositorMode::Threaded || 1276 DCHECK(compositor_mode_ != CompositorMode::Threaded ||
1275 task_runner_provider_->HasImplThread()); 1277 task_runner_provider_->HasImplThread());
1276 return compositor_mode_ == CompositorMode::Threaded; 1278 return compositor_mode_ == CompositorMode::Threaded;
1277 } 1279 }
1278 1280
1279 } // namespace cc 1281 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698