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

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

Issue 1531913003: CC Animations: Make ui::LayerAnimator a LayerAnimationEventObserver (instead of ui::Layer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayerAnimator::SetDelegate Created 5 years 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 | « no previous file | ui/compositor/layer.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_H_ 5 #ifndef UI_COMPOSITOR_LAYER_H_
6 #define UI_COMPOSITOR_LAYER_H_ 6 #define UI_COMPOSITOR_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "cc/animation/animation_events.h" 15 #include "cc/animation/animation_events.h"
16 #include "cc/animation/layer_animation_event_observer.h"
17 #include "cc/base/region.h" 16 #include "cc/base/region.h"
18 #include "cc/layers/content_layer_client.h" 17 #include "cc/layers/content_layer_client.h"
19 #include "cc/layers/layer_client.h" 18 #include "cc/layers/layer_client.h"
20 #include "cc/layers/surface_layer.h" 19 #include "cc/layers/surface_layer.h"
21 #include "cc/layers/texture_layer_client.h" 20 #include "cc/layers/texture_layer_client.h"
22 #include "cc/resources/texture_mailbox.h" 21 #include "cc/resources/texture_mailbox.h"
23 #include "cc/surfaces/surface_id.h" 22 #include "cc/surfaces/surface_id.h"
24 #include "third_party/skia/include/core/SkColor.h" 23 #include "third_party/skia/include/core/SkColor.h"
25 #include "third_party/skia/include/core/SkRegion.h" 24 #include "third_party/skia/include/core/SkRegion.h"
26 #include "ui/compositor/compositor.h" 25 #include "ui/compositor/compositor.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Coordinate system used in layers is DIP (Density Independent Pixel) 60 // Coordinate system used in layers is DIP (Density Independent Pixel)
62 // coordinates unless explicitly mentioned as pixel coordinates. 61 // coordinates unless explicitly mentioned as pixel coordinates.
63 // 62 //
64 // NOTE: Unlike Views, each Layer does *not* own its child Layers. If you 63 // NOTE: Unlike Views, each Layer does *not* own its child Layers. If you
65 // delete a Layer and it has children, the parent of each child Layer is set to 64 // delete a Layer and it has children, the parent of each child Layer is set to
66 // NULL, but the children are not deleted. 65 // NULL, but the children are not deleted.
67 class COMPOSITOR_EXPORT Layer 66 class COMPOSITOR_EXPORT Layer
68 : public LayerAnimationDelegate, 67 : public LayerAnimationDelegate,
69 NON_EXPORTED_BASE(public cc::ContentLayerClient), 68 NON_EXPORTED_BASE(public cc::ContentLayerClient),
70 NON_EXPORTED_BASE(public cc::TextureLayerClient), 69 NON_EXPORTED_BASE(public cc::TextureLayerClient),
71 NON_EXPORTED_BASE(public cc::LayerClient), 70 NON_EXPORTED_BASE(public cc::LayerClient) {
72 NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) {
73 public: 71 public:
74 Layer(); 72 Layer();
75 explicit Layer(LayerType type); 73 explicit Layer(LayerType type);
76 ~Layer() override; 74 ~Layer() override;
77 75
78 static const cc::LayerSettings& UILayerSettings(); 76 static const cc::LayerSettings& UILayerSettings();
79 static void InitializeUILayerSettings(); 77 static void InitializeUILayerSettings();
80 78
81 // Retrieves the Layer's compositor. The Layer will walk up its parent chain 79 // Retrieves the Layer's compositor. The Layer will walk up its parent chain
82 // to locate it. Returns NULL if the Layer is not attached to a compositor. 80 // to locate it. Returns NULL if the Layer is not attached to a compositor.
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 363
366 // Forces a render surface to be used on this layer. This has no positive 364 // Forces a render surface to be used on this layer. This has no positive
367 // impact, and is only used for benchmarking/testing purpose. 365 // impact, and is only used for benchmarking/testing purpose.
368 void SetForceRenderSurface(bool force); 366 void SetForceRenderSurface(bool force);
369 bool force_render_surface() const { return force_render_surface_; } 367 bool force_render_surface() const { return force_render_surface_; }
370 368
371 // LayerClient 369 // LayerClient
372 scoped_refptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo( 370 scoped_refptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo(
373 cc::Layer* layer) override; 371 cc::Layer* layer) override;
374 372
375 // LayerAnimationEventObserver
376 void OnAnimationStarted(const cc::AnimationEvent& event) override;
377
378 // Whether this layer has animations waiting to get sent to its cc::Layer. 373 // Whether this layer has animations waiting to get sent to its cc::Layer.
379 bool HasPendingThreadedAnimations() { 374 bool HasPendingThreadedAnimations() {
380 return pending_threaded_animations_.size() != 0; 375 return pending_threaded_animations_.size() != 0;
381 } 376 }
382 377
383 // Triggers a call to SwitchToLayer. 378 // Triggers a call to SwitchToLayer.
384 void SwitchCCLayerForTest(); 379 void SwitchCCLayerForTest();
385 380
386 private: 381 private:
387 friend class LayerOwner; 382 friend class LayerOwner;
(...skipping 20 matching lines...) Expand all
408 gfx::Transform GetTransformForAnimation() const override; 403 gfx::Transform GetTransformForAnimation() const override;
409 float GetOpacityForAnimation() const override; 404 float GetOpacityForAnimation() const override;
410 bool GetVisibilityForAnimation() const override; 405 bool GetVisibilityForAnimation() const override;
411 float GetBrightnessForAnimation() const override; 406 float GetBrightnessForAnimation() const override;
412 float GetGrayscaleForAnimation() const override; 407 float GetGrayscaleForAnimation() const override;
413 SkColor GetColorForAnimation() const override; 408 SkColor GetColorForAnimation() const override;
414 float GetDeviceScaleFactor() const override; 409 float GetDeviceScaleFactor() const override;
415 void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) override; 410 void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) override;
416 void RemoveThreadedAnimation(int animation_id) override; 411 void RemoveThreadedAnimation(int animation_id) override;
417 LayerAnimatorCollection* GetLayerAnimatorCollection() override; 412 LayerAnimatorCollection* GetLayerAnimatorCollection() override;
413 cc::Layer* GetCcLayer() const override;
418 414
419 // Creates a corresponding composited layer for |type_|. 415 // Creates a corresponding composited layer for |type_|.
420 void CreateCcLayer(); 416 void CreateCcLayer();
421 417
422 // Recomputes and sets to |cc_layer_|. 418 // Recomputes and sets to |cc_layer_|.
423 void RecomputeDrawsContentAndUVRect(); 419 void RecomputeDrawsContentAndUVRect();
424 void RecomputePosition(); 420 void RecomputePosition();
425 421
426 // Set all filters which got applied to the layer. 422 // Set all filters which got applied to the layer.
427 void SetLayerFilters(); 423 void SetLayerFilters();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // The size of the frame or texture in DIP, set when SetShowDelegatedContent 530 // The size of the frame or texture in DIP, set when SetShowDelegatedContent
535 // or SetTextureMailbox was called. 531 // or SetTextureMailbox was called.
536 gfx::Size frame_size_in_dip_; 532 gfx::Size frame_size_in_dip_;
537 533
538 DISALLOW_COPY_AND_ASSIGN(Layer); 534 DISALLOW_COPY_AND_ASSIGN(Layer);
539 }; 535 };
540 536
541 } // namespace ui 537 } // namespace ui
542 538
543 #endif // UI_COMPOSITOR_LAYER_H_ 539 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698