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

Side by Side Diff: ui/compositor/layer_animation_element.h

Issue 2631333002: [animations] Adds metrics for jank on selected layer animations (Closed)
Patch Set: Adds UMA reporting for ripples and overview mode (query refresh rate) Created 3 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 | « ui/compositor/layer_animation_delegate.h ('k') | ui/compositor/layer_animation_element.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "cc/animation/animation.h" 16 #include "cc/animation/animation.h"
17 #include "third_party/skia/include/core/SkColor.h" 17 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/compositor/compositor_export.h" 18 #include "ui/compositor/compositor_export.h"
19 #include "ui/gfx/animation/tween.h" 19 #include "ui/gfx/animation/tween.h"
20 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
21 #include "ui/gfx/transform.h" 21 #include "ui/gfx/transform.h"
22 22
23 namespace ui { 23 namespace ui {
24 24
25 class InterpolatedTransform; 25 class InterpolatedTransform;
26 class LayerAnimationDelegate; 26 class LayerAnimationDelegate;
27 27
28 class AnimationMetricsReporter {
29 public:
30 virtual ~AnimationMetricsReporter() {}
31 virtual void Report(int value) = 0;
32 };
33
28 // LayerAnimationElements represent one segment of an animation between two 34 // LayerAnimationElements represent one segment of an animation between two
29 // keyframes. They know how to update a LayerAnimationDelegate given a value 35 // keyframes. They know how to update a LayerAnimationDelegate given a value
30 // between 0 and 1 (0 for initial, and 1 for final). 36 // between 0 and 1 (0 for initial, and 1 for final).
31 class COMPOSITOR_EXPORT LayerAnimationElement { 37 class COMPOSITOR_EXPORT LayerAnimationElement {
32 public: 38 public:
33 enum AnimatableProperty { 39 enum AnimatableProperty {
34 UNKNOWN = 0, 40 UNKNOWN = 0,
35 TRANSFORM = (1 << 0), 41 TRANSFORM = (1 << 0),
36 BOUNDS = (1 << 1), 42 BOUNDS = (1 << 1),
37 OPACITY = (1 << 2), 43 OPACITY = (1 << 2),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 181
176 // The properties that the element modifies. 182 // The properties that the element modifies.
177 AnimatableProperties properties() const { return properties_; } 183 AnimatableProperties properties() const { return properties_; }
178 184
179 // Whether this element animates on the compositor thread. 185 // Whether this element animates on the compositor thread.
180 virtual bool IsThreaded() const; 186 virtual bool IsThreaded() const;
181 187
182 gfx::Tween::Type tween_type() const { return tween_type_; } 188 gfx::Tween::Type tween_type() const { return tween_type_; }
183 void set_tween_type(gfx::Tween::Type tween_type) { tween_type_ = tween_type; } 189 void set_tween_type(gfx::Tween::Type tween_type) { tween_type_ = tween_type; }
184 190
191 void set_animation_metrics_reporter(AnimationMetricsReporter* reporter) {
192 animation_metrics_reporter_ = reporter;
193 }
194
185 // Each LayerAnimationElement has a unique animation_id. Elements belonging 195 // Each LayerAnimationElement has a unique animation_id. Elements belonging
186 // to sequences that are supposed to start together have the same 196 // to sequences that are supposed to start together have the same
187 // animation_group_id. 197 // animation_group_id.
188 int animation_id() const { return animation_id_; } 198 int animation_id() const { return animation_id_; }
189 int animation_group_id() const { return animation_group_id_; } 199 int animation_group_id() const { return animation_group_id_; }
190 void set_animation_group_id(int id) { animation_group_id_ = id; } 200 void set_animation_group_id(int id) { animation_group_id_ = id; }
191 201
192 base::TimeDelta duration() const { return duration_; } 202 base::TimeDelta duration() const { return duration_; }
193 203
194 // The fraction of the animation that has been completed after the last 204 // The fraction of the animation that has been completed after the last
(...skipping 26 matching lines...) Expand all
221 // When the animation actually started, taking into account queueing delays. 231 // When the animation actually started, taking into account queueing delays.
222 base::TimeTicks effective_start_time_; 232 base::TimeTicks effective_start_time_;
223 const base::TimeDelta duration_; 233 const base::TimeDelta duration_;
224 gfx::Tween::Type tween_type_; 234 gfx::Tween::Type tween_type_;
225 235
226 const int animation_id_; 236 const int animation_id_;
227 int animation_group_id_; 237 int animation_group_id_;
228 238
229 double last_progressed_fraction_; 239 double last_progressed_fraction_;
230 240
241 // To obtain metrics of animation performance tag animation elements and
242 // keep track of sequential compositor frame number.
243 AnimationMetricsReporter* animation_metrics_reporter_;
244 int start_frame_number_;
245
231 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_; 246 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_;
232 247
233 DISALLOW_ASSIGN(LayerAnimationElement); 248 DISALLOW_ASSIGN(LayerAnimationElement);
234 }; 249 };
235 250
236 } // namespace ui 251 } // namespace ui
237 252
238 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 253 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW
« no previous file with comments | « ui/compositor/layer_animation_delegate.h ('k') | ui/compositor/layer_animation_element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698