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

Unified Diff: cc/layer_tree_host_impl.h

Issue 11598005: Ref count layer animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/layer_tree_host_impl.h
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index 79c26c02fb5ae982552c968edf152cfa2d758678..2f18014424391ebca620e82f1531ee97ee062854 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "cc/animation_events.h"
+#include "cc/animation_registrar.h"
#include "cc/cc_export.h"
#include "cc/input_handler.h"
#include "cc/output_surface_client.h"
@@ -112,6 +113,7 @@ private:
class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
public RendererClient,
public TileManagerClient,
+ public AnimationRegistrar,
public OutputSurfaceClient {
typedef std::vector<LayerImpl*> LayerList;
@@ -246,9 +248,7 @@ public:
bool hasTransparentBackground() const { return m_hasTransparentBackground; }
void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
-
- bool needsAnimateLayers() const { return m_needsAnimateLayers; }
- void setNeedsAnimateLayers() { m_needsAnimateLayers = true; }
+ bool needsAnimateLayers() const { return !m_activeAnimationControllers.empty(); }
bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties; }
void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; }
@@ -304,6 +304,8 @@ public:
static void removeRenderPasses(RenderPassCuller, FrameData&);
protected:
+ typedef base::hash_map<int, LayerAnimationController*> AnimationControllerMap;
+
LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
void animatePageScale(base::TimeTicks monotonicTime);
@@ -321,6 +323,8 @@ protected:
// Virtual for testing.
virtual base::TimeDelta lowFrequencyAnimationInterval() const;
+ const AnimationControllerMap& activeAnimationControllers() const { return m_activeAnimationControllers; }
+
LayerTreeHostImplClient* m_client;
Proxy* m_proxy;
@@ -350,6 +354,13 @@ private:
void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const;
+ // AnimationRegistar implementation.
+ virtual scoped_refptr<LayerAnimationController> GetAnimationControllerForId(int id) OVERRIDE;
+ virtual void DidActivateAnimationController(LayerAnimationController*) OVERRIDE;
+ virtual void DidDeactivateAnimationController(LayerAnimationController*) OVERRIDE;
+ virtual void RegisterAnimationController(LayerAnimationController*) OVERRIDE;
+ virtual void UnregisterAnimationController(LayerAnimationController*) OVERRIDE;
+
scoped_ptr<OutputSurface> m_outputSurface;
scoped_ptr<ResourceProvider> m_resourceProvider;
scoped_ptr<Renderer> m_renderer;
@@ -371,8 +382,6 @@ private:
SkColor m_backgroundColor;
bool m_hasTransparentBackground;
- // If this is true, it is necessary to traverse the layer tree ticking the animators.
- bool m_needsAnimateLayers;
bool m_needsUpdateDrawProperties;
bool m_pinchGestureActive;
gfx::Point m_previousPinchAnchor;
@@ -402,6 +411,9 @@ private:
size_t m_lastSentMemoryVisibleAndNearbyBytes;
size_t m_lastSentMemoryUseBytes;
+ AnimationControllerMap m_activeAnimationControllers;
+ AnimationControllerMap m_allAnimationControllers;
+
DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
};

Powered by Google App Engine
This is Rietveld 408576698