| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/time/time.h" |
| 13 #include "cc/animation/animation.h" | 14 #include "cc/animation/animation.h" |
| 14 #include "cc/animation/animation_events.h" | 15 #include "cc/animation/animation_events.h" |
| 15 #include "cc/animation/keyframed_animation_curve.h" | 16 #include "cc/animation/keyframed_animation_curve.h" |
| 16 #include "cc/animation/layer_animation_controller.h" | 17 #include "cc/animation/layer_animation_controller.h" |
| 17 #include "cc/layers/layer_client.h" | 18 #include "cc/layers/layer_client.h" |
| 18 #include "cc/layers/layer_impl.h" | 19 #include "cc/layers/layer_impl.h" |
| 19 #include "cc/layers/scrollbar_layer_interface.h" | 20 #include "cc/layers/scrollbar_layer_interface.h" |
| 20 #include "cc/output/copy_output_request.h" | 21 #include "cc/output/copy_output_request.h" |
| 21 #include "cc/output/copy_output_result.h" | 22 #include "cc/output/copy_output_result.h" |
| 22 #include "cc/trees/layer_tree_host.h" | 23 #include "cc/trees/layer_tree_host.h" |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 return false; | 1106 return false; |
| 1106 | 1107 |
| 1107 UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer", | 1108 UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer", |
| 1108 !layer_tree_host_); | 1109 !layer_tree_host_); |
| 1109 layer_animation_controller_->AddAnimation(animation.Pass()); | 1110 layer_animation_controller_->AddAnimation(animation.Pass()); |
| 1110 SetNeedsCommit(); | 1111 SetNeedsCommit(); |
| 1111 return true; | 1112 return true; |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 void Layer::PauseAnimation(int animation_id, double time_offset) { | 1115 void Layer::PauseAnimation(int animation_id, double time_offset) { |
| 1115 layer_animation_controller_->PauseAnimation(animation_id, time_offset); | 1116 layer_animation_controller_->PauseAnimation( |
| 1117 animation_id, base::TimeDelta::FromSecondsD(time_offset)); |
| 1116 SetNeedsCommit(); | 1118 SetNeedsCommit(); |
| 1117 } | 1119 } |
| 1118 | 1120 |
| 1119 void Layer::RemoveAnimation(int animation_id) { | 1121 void Layer::RemoveAnimation(int animation_id) { |
| 1120 layer_animation_controller_->RemoveAnimation(animation_id); | 1122 layer_animation_controller_->RemoveAnimation(animation_id); |
| 1121 SetNeedsCommit(); | 1123 SetNeedsCommit(); |
| 1122 } | 1124 } |
| 1123 | 1125 |
| 1124 void Layer::SetLayerAnimationControllerForTest( | 1126 void Layer::SetLayerAnimationControllerForTest( |
| 1125 scoped_refptr<LayerAnimationController> controller) { | 1127 scoped_refptr<LayerAnimationController> controller) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 if (clip_parent_) | 1186 if (clip_parent_) |
| 1185 clip_parent_->RemoveClipChild(this); | 1187 clip_parent_->RemoveClipChild(this); |
| 1186 | 1188 |
| 1187 clip_parent_ = NULL; | 1189 clip_parent_ = NULL; |
| 1188 } | 1190 } |
| 1189 | 1191 |
| 1190 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1192 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1191 benchmark->RunOnLayer(this); | 1193 benchmark->RunOnLayer(this); |
| 1192 } | 1194 } |
| 1193 } // namespace cc | 1195 } // namespace cc |
| OLD | NEW |