| Index: cc/layer_tree_host_impl.h
|
| diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
|
| index 23bf1add8672ba1b8f106e11c9d30e8a6d8fd189..6e90e93fc2913272e7a89bfde1b324240eb4e5d9 100644
|
| --- a/cc/layer_tree_host_impl.h
|
| +++ b/cc/layer_tree_host_impl.h
|
| @@ -43,334 +43,402 @@ struct RenderingStats;
|
|
|
| // LayerTreeHost->Proxy callback interface.
|
| class LayerTreeHostImplClient {
|
| -public:
|
| - virtual void didLoseOutputSurfaceOnImplThread() = 0;
|
| - virtual void onSwapBuffersCompleteOnImplThread() = 0;
|
| - virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) = 0;
|
| - virtual void onCanDrawStateChanged(bool canDraw) = 0;
|
| - virtual void onHasPendingTreeStateChanged(bool hasPendingTree) = 0;
|
| - virtual void setNeedsRedrawOnImplThread() = 0;
|
| - virtual void didUploadVisibleHighResolutionTileOnImplThread() = 0;
|
| - virtual void setNeedsCommitOnImplThread() = 0;
|
| - virtual void setNeedsManageTilesOnImplThread() = 0;
|
| - virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) = 0;
|
| - // Returns true if resources were deleted by this call.
|
| - virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) = 0;
|
| - virtual void reduceWastedContentsTextureMemoryOnImplThread() = 0;
|
| - virtual void sendManagedMemoryStats() = 0;
|
| - virtual bool isInsideDraw() = 0;
|
| - virtual void renewTreePriority() = 0;
|
| + public:
|
| + virtual void DidLoseOutputSurfaceOnImplThread() = 0;
|
| + virtual void OnSwapBuffersCompleteOnImplThread() = 0;
|
| + virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
|
| + base::TimeDelta interval) = 0;
|
| + virtual void OnCanDrawStateChanged(bool can_draw) = 0;
|
| + virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0;
|
| + virtual void SetNeedsRedrawOnImplThread() = 0;
|
| + virtual void DidUploadVisibleHighResolutionTileOnImplThread() = 0;
|
| + virtual void SetNeedsCommitOnImplThread() = 0;
|
| + virtual void SetNeedsManageTilesOnImplThread() = 0;
|
| + virtual void PostAnimationEventsToMainThreadOnImplThread(
|
| + scoped_ptr<AnimationEventsVector> events,
|
| + base::Time wall_clock_time) = 0;
|
| + // Returns true if resources were deleted by this call.
|
| + virtual bool ReduceContentsTextureMemoryOnImplThread(
|
| + size_t limit_bytes,
|
| + int priority_cutoff) = 0;
|
| + virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0;
|
| + virtual void SendManagedMemoryStats() = 0;
|
| + virtual bool IsInsideDraw() = 0;
|
| + virtual void RenewTreePriority() = 0;
|
| };
|
|
|
| -// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state
|
| +// LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
|
| +// state.
|
| class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
|
| public RendererClient,
|
| public TileManagerClient,
|
| public OutputSurfaceClient,
|
| public TopControlsManagerClient {
|
| - typedef std::vector<LayerImpl*> LayerList;
|
| -
|
| -public:
|
| - static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
|
| - virtual ~LayerTreeHostImpl();
|
| -
|
| - // InputHandlerClient implementation
|
| - virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandlerClient::ScrollInputType) OVERRIDE;
|
| - virtual bool scrollBy(const gfx::Point&, const gfx::Vector2dF&) OVERRIDE;
|
| - virtual void scrollEnd() OVERRIDE;
|
| - virtual void pinchGestureBegin() OVERRIDE;
|
| - virtual void pinchGestureUpdate(float, gfx::Point) OVERRIDE;
|
| - virtual void pinchGestureEnd() OVERRIDE;
|
| - virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration) OVERRIDE;
|
| - virtual void scheduleAnimation() OVERRIDE;
|
| - virtual bool haveTouchEventHandlersAt(const gfx::Point&) OVERRIDE;
|
| -
|
| - // TopControlsManagerClient implementation.
|
| - virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
|
| - virtual void setNeedsRedraw() OVERRIDE;
|
| - virtual bool haveRootScrollLayer() const OVERRIDE;
|
| - virtual float rootScrollLayerTotalScrollY() const OVERRIDE;
|
| -
|
| - struct CC_EXPORT FrameData : public RenderPassSink {
|
| - FrameData();
|
| - ~FrameData();
|
| -
|
| - std::vector<gfx::Rect> occludingScreenSpaceRects;
|
| - std::vector<gfx::Rect> nonOccludingScreenSpaceRects;
|
| - RenderPassList renderPasses;
|
| - RenderPassIdHashMap renderPassesById;
|
| - const LayerList* renderSurfaceLayerList;
|
| - LayerList willDrawLayers;
|
| - bool containsIncompleteTile;
|
| -
|
| - // RenderPassSink implementation.
|
| - virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE;
|
| - };
|
| -
|
| - // Virtual for testing.
|
| - virtual void beginCommit();
|
| - virtual void commitComplete();
|
| - virtual void animate(base::TimeTicks monotonicTime, base::Time wallClockTime);
|
| - virtual void setVisible(bool);
|
| -
|
| - void manageTiles();
|
| -
|
| - // Returns false if problems occured preparing the frame, and we should try
|
| - // to avoid displaying the frame. If prepareToDraw is called,
|
| - // didDrawAllLayers must also be called, regardless of whether drawLayers is
|
| - // called between the two.
|
| - virtual bool prepareToDraw(FrameData&);
|
| - virtual void drawLayers(FrameData&);
|
| - // Must be called if and only if prepareToDraw was called.
|
| - void didDrawAllLayers(const FrameData&);
|
| -
|
| - // RendererClient implementation
|
| - virtual gfx::Size DeviceViewportSize() const OVERRIDE;
|
| - virtual const LayerTreeSettings& Settings() const OVERRIDE;
|
| - virtual void DidLoseOutputSurface() OVERRIDE;
|
| - virtual void OnSwapBuffersComplete() OVERRIDE;
|
| - virtual void SetFullRootLayerDamage() OVERRIDE;
|
| - virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
|
| - virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
|
| - virtual bool HasImplThread() const OVERRIDE;
|
| - virtual bool ShouldClearRootRenderPass() const OVERRIDE;
|
| - virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
|
| -
|
| - // TileManagerClient implementation.
|
| - virtual void ScheduleManageTiles() OVERRIDE;
|
| - virtual void DidUploadVisibleHighResolutionTile() OVERRIDE;
|
| -
|
| - // OutputSurfaceClient implementation.
|
| - virtual void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
|
| - virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck&) OVERRIDE;
|
| -
|
| - // Called from LayerTreeImpl.
|
| - void OnCanDrawStateChangedForTree(LayerTreeImpl*);
|
| -
|
| - // Implementation
|
| - bool canDraw();
|
| - OutputSurface* outputSurface() const;
|
| -
|
| - std::string layerTreeAsText() const;
|
| - std::string layerTreeAsJson() const;
|
| -
|
| - void finishAllRendering();
|
| - int sourceAnimationFrameNumber() const;
|
| -
|
| - virtual bool initializeRenderer(scoped_ptr<OutputSurface>);
|
| - bool isContextLost();
|
| - TileManager* tileManager() { return m_tileManager.get(); }
|
| - Renderer* renderer() { return m_renderer.get(); }
|
| - const RendererCapabilities& rendererCapabilities() const;
|
| -
|
| - bool swapBuffers();
|
| -
|
| - void readback(void* pixels, gfx::Rect rect_in_device_viewport);
|
| -
|
| - LayerTreeImpl* activeTree() { return m_activeTree.get(); }
|
| - const LayerTreeImpl* activeTree() const { return m_activeTree.get(); }
|
| - LayerTreeImpl* pendingTree() { return m_pendingTree.get(); }
|
| - const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); }
|
| - const LayerTreeImpl* recycleTree() const { return m_recycleTree.get(); }
|
| - void createPendingTree();
|
| - void checkForCompletedTileUploads();
|
| - virtual bool activatePendingTreeIfNeeded();
|
| -
|
| - // Shortcuts to layers on the active tree.
|
| - LayerImpl* rootLayer() const;
|
| - LayerImpl* rootScrollLayer() const;
|
| - LayerImpl* currentlyScrollingLayer() const;
|
| + typedef std::vector<LayerImpl*> LayerList;
|
| +
|
| + public:
|
| + static scoped_ptr<LayerTreeHostImpl> Create(
|
| + const LayerTreeSettings& settings,
|
| + LayerTreeHostImplClient* client,
|
| + Proxy* proxy);
|
| + virtual ~LayerTreeHostImpl();
|
| +
|
| + // InputHandlerClient implementation
|
| + virtual InputHandlerClient::ScrollStatus ScrollBegin(
|
| + gfx::Point viewport_point,
|
| + InputHandlerClient::ScrollInputType type) OVERRIDE;
|
| + virtual bool ScrollBy(gfx::Point viewport_point,
|
| + gfx::Vector2dF scroll_delta) OVERRIDE;
|
| + virtual void ScrollEnd() OVERRIDE;
|
| + virtual void PinchGestureBegin() OVERRIDE;
|
| + virtual void PinchGestureUpdate(float magnify_delta,
|
| + gfx::Point anchor) OVERRIDE;
|
| + virtual void PinchGestureEnd() OVERRIDE;
|
| + virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
|
| + bool anchor_point,
|
| + float page_scale,
|
| + base::TimeTicks start_time,
|
| + base::TimeDelta duration) OVERRIDE;
|
| + virtual void ScheduleAnimation() OVERRIDE;
|
| + virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE;
|
| +
|
| + // TopControlsManagerClient implementation.
|
| + virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
|
| + virtual void setNeedsRedraw() OVERRIDE;
|
| + virtual bool haveRootScrollLayer() const OVERRIDE;
|
| + virtual float rootScrollLayerTotalScrollY() const OVERRIDE;
|
| +
|
| + struct CC_EXPORT FrameData : public RenderPassSink {
|
| + FrameData();
|
| + ~FrameData();
|
| +
|
| + std::vector<gfx::Rect> occluding_screen_space_rects;
|
| + std::vector<gfx::Rect> non_occluding_screen_space_rects;
|
| + RenderPassList render_passes;
|
| + RenderPassIdHashMap render_passes_by_id;
|
| + const LayerList* render_surface_layer_list;
|
| + LayerList will_draw_layers;
|
| + bool contains_incomplete_tile;
|
| +
|
| + // RenderPassSink implementation.
|
| + virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE;
|
| + };
|
| +
|
| + virtual void BeginCommit();
|
| + virtual void CommitComplete();
|
| + virtual void Animate(base::TimeTicks monotonic_time,
|
| + base::Time wall_clock_time);
|
| +
|
| + void ManageTiles();
|
| +
|
| + // Returns false if problems occured preparing the frame, and we should try
|
| + // to avoid displaying the frame. If prepareToDraw is called, DidDrawAllLayers
|
| + // must also be called, regardless of whether DrawLayers is called between the
|
| + // two.
|
| + virtual bool PrepareToDraw(FrameData* frame);
|
| + virtual void DrawLayers(FrameData* frame);
|
| + // Must be called if and only if PrepareToDraw was called.
|
| + void DidDrawAllLayers(const FrameData& frame);
|
| +
|
| + const LayerTreeSettings& settings() const { return settings_; }
|
| +
|
| + // RendererClient implementation
|
| + private:
|
| + virtual gfx::Size DeviceViewportSize() const OVERRIDE;
|
| + virtual const LayerTreeSettings& Settings() const OVERRIDE;
|
| + public:
|
| + virtual void DidLoseOutputSurface() OVERRIDE;
|
| + virtual void OnSwapBuffersComplete() OVERRIDE;
|
| + virtual void SetFullRootLayerDamage() OVERRIDE;
|
| + virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
|
| + OVERRIDE;
|
| + virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
|
| + OVERRIDE;
|
| + virtual bool HasImplThread() const OVERRIDE;
|
| + virtual bool ShouldClearRootRenderPass() const OVERRIDE;
|
| + virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
|
| +
|
| + // TileManagerClient implementation.
|
| + virtual void ScheduleManageTiles() OVERRIDE;
|
| + virtual void DidUploadVisibleHighResolutionTile() OVERRIDE;
|
| +
|
| + // OutputSurfaceClient implementation.
|
| + virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
|
| + base::TimeDelta interval) OVERRIDE;
|
| + virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
|
| + OVERRIDE;
|
| +
|
| + // Called from LayerTreeImpl.
|
| + void OnCanDrawStateChangedForTree();
|
| +
|
| + // Implementation
|
| + bool CanDraw();
|
| + OutputSurface* output_surface() const { return output_surface_.get(); }
|
| +
|
| + std::string LayerTreeAsText() const;
|
| + std::string LayerTreeAsJson() const;
|
| +
|
| + void FinishAllRendering();
|
| + int SourceAnimationFrameNumber() const;
|
| +
|
| + virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
|
| + bool IsContextLost();
|
| + TileManager* tile_manager() { return tile_manager_.get(); }
|
| + Renderer* renderer() { return renderer_.get(); }
|
| + const RendererCapabilities& GetRendererCapabilities() const;
|
| +
|
| + bool SwapBuffers();
|
| +
|
| + void Readback(void* pixels, gfx::Rect rect_in_device_viewport);
|
| +
|
| + LayerTreeImpl* active_tree() { return active_tree_.get(); }
|
| + const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
|
| + LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
|
| + const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
|
| + const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
|
| + void CreatePendingTree();
|
| + void CheckForCompletedTileUploads();
|
| + virtual bool ActivatePendingTreeIfNeeded();
|
| +
|
| + // Shortcuts to layers on the active tree.
|
| + LayerImpl* RootLayer() const;
|
| + LayerImpl* RootScrollLayer() const;
|
| + LayerImpl* CurrentlyScrollingLayer() const;
|
| +
|
| + virtual void SetVisible(bool visible);
|
| + bool visible() const { return visible_; }
|
| +
|
| + size_t memory_allocation_limit_bytes() const {
|
| + return managed_memory_policy_.bytesLimitWhenVisible;
|
| + }
|
| +
|
| + void SetViewportSize(gfx::Size layout_viewport_size,
|
| + gfx::Size device_viewport_size);
|
| + gfx::Size layout_viewport_size() const { return layout_viewport_size_; }
|
| + gfx::Size device_viewport_size() const { return device_viewport_size_; }
|
| +
|
| + void SetDeviceScaleFactor(float device_scale_factor);
|
| + float device_scale_factor() const { return device_scale_factor_; }
|
| +
|
| + scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
|
| +
|
| + void StartPageScaleAnimation(gfx::Vector2d target_offset,
|
| + bool use_anchor,
|
| + float scale,
|
| + base::TimeDelta duration);
|
| +
|
| + bool needs_animate_layers() const {
|
| + return !animation_registrar_->active_animation_controllers().empty();
|
| + }
|
| +
|
| + void CollectRenderingStats(RenderingStats* stats) const;
|
| +
|
| + void SendManagedMemoryStats(
|
| + size_t memory_visible_bytes,
|
| + size_t memory_visible_and_nearby_bytes,
|
| + size_t memoryUseBytes);
|
| +
|
| + FrameRateCounter* fps_counter() {
|
| + return fps_counter_.get();
|
| + }
|
| + PaintTimeCounter* paint_time_counter() {
|
| + return paint_time_counter_.get();
|
| + }
|
| + MemoryHistory* memory_history() {
|
| + return memory_history_.get();
|
| + }
|
| + DebugRectHistory* debug_rect_history() {
|
| + return debug_rect_history_.get();
|
| + }
|
| + ResourceProvider* resource_provider() {
|
| + return resource_provider_.get();
|
| + }
|
| + TopControlsManager* top_controls_manager() {
|
| + return top_controls_manager_.get();
|
| + }
|
| +
|
| + Proxy* proxy() const { return proxy_; }
|
| +
|
| + AnimationRegistrar* animation_registrar() const {
|
| + return animation_registrar_.get();
|
| + }
|
| +
|
| + void SetDebugState(const LayerTreeDebugState& debug_state);
|
| + const LayerTreeDebugState& debug_state() const { return debug_state_; }
|
| +
|
| + void SavePaintTime(const base::TimeDelta& total_paint_time,
|
| + int commit_number);
|
| +
|
| + class CC_EXPORT CullRenderPassesWithCachedTextures {
|
| + public:
|
| + bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
|
| + const FrameData& frame) const;
|
| +
|
| + // Iterates from the root first, in order to remove the surfaces closest
|
| + // to the root with cached textures, and all surfaces that draw into
|
| + // them.
|
| + size_t RenderPassListBegin(const RenderPassList& list) const {
|
| + return list.size() - 1;
|
| + }
|
| + size_t RenderPassListEnd(const RenderPassList& list) const { return 0 - 1; }
|
| + size_t RenderPassListNext(size_t it) const { return it - 1; }
|
| +
|
| + CullRenderPassesWithCachedTextures(Renderer& renderer)
|
| + : renderer_(renderer) {}
|
| + private:
|
| + Renderer& renderer_;
|
| + };
|
| +
|
| + class CC_EXPORT CullRenderPassesWithNoQuads {
|
| + public:
|
| + bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
|
| + const FrameData& frame) const;
|
| +
|
| + // Iterates in draw order, so that when a surface is removed, and its
|
| + // target becomes empty, then its target can be removed also.
|
| + size_t RenderPassListBegin(const RenderPassList& list) const { return 0; }
|
| + size_t RenderPassListEnd(const RenderPassList& list) const {
|
| + return list.size();
|
| + }
|
| + size_t RenderPassListNext(size_t it) const { return it + 1; }
|
| + };
|
| +
|
| + template <typename RenderPassCuller>
|
| + static void RemoveRenderPasses(RenderPassCuller culler, FrameData* frame);
|
| +
|
| + skia::RefPtr<SkPicture> CapturePicture();
|
| +
|
| + bool pinch_gesture_active() const { return pinch_gesture_active_; }
|
| +
|
| + void SetTreePriority(TreePriority priority);
|
| +
|
| + void BeginNextFrame();
|
| + base::TimeTicks CurrentFrameTime();
|
| +
|
| + scoped_ptr<base::Value> AsValue() const;
|
| + scoped_ptr<base::Value> ActivationStateAsValue() const;
|
| + scoped_ptr<base::Value> FrameStateAsValue() const;
|
| +
|
| + bool page_scale_animation_active() const { return !!page_scale_animation_; }
|
| +
|
| + protected:
|
| + LayerTreeHostImpl(const LayerTreeSettings& settings,
|
| + LayerTreeHostImplClient* client,
|
| + Proxy* proxy);
|
| + void ActivatePendingTree();
|
| +
|
| + // Virtual for testing.
|
| + virtual void AnimateLayers(base::TimeTicks monotonic_time,
|
| + base::Time wall_clock_time);
|
| + virtual void UpdateAnimationState();
|
| +
|
| + // Virtual for testing.
|
| + virtual base::TimeDelta LowFrequencyAnimationInterval() const;
|
| +
|
| + const AnimationRegistrar::AnimationControllerMap&
|
| + active_animation_controllers() const {
|
| + return animation_registrar_->active_animation_controllers();
|
| + }
|
| +
|
| + LayerTreeHostImplClient* client_;
|
| + Proxy* proxy_;
|
| +
|
| + private:
|
| + void AnimatePageScale(base::TimeTicks monotonic_time);
|
| + void AnimateScrollbars(base::TimeTicks monotonic_time);
|
| +
|
| + gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
|
| + LayerImpl* layerImpl,
|
| + float scaleFromViewportToScreenSpace,
|
| + gfx::PointF viewportPoint,
|
| + gfx::Vector2dF viewportDelta);
|
|
|
| - bool visible() const { return m_visible; }
|
| + void UpdateMaxScrollOffset();
|
| + void TrackDamageForAllSurfaces(LayerImpl* root_draw_layer,
|
| + const LayerList& render_surface_layer_list);
|
|
|
| - size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
|
| + // Returns false if the frame should not be displayed. This function should
|
| + // only be called from prepareToDraw, as didDrawAllLayers must be called
|
| + // if this helper function is called.
|
| + bool CalculateRenderPasses(FrameData* frame);
|
| + void SetBackgroundTickingEnabled(bool enabled);
|
|
|
| - void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
|
| - const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
|
| + void SendDidLoseOutputSurfaceRecursive(LayerImpl* current);
|
| + void ClearRenderSurfaces();
|
| + bool EnsureRenderSurfaceLayerList();
|
| + void ClearCurrentlyScrollingLayer();
|
|
|
| - float deviceScaleFactor() const { return m_deviceScaleFactor; }
|
| - void setDeviceScaleFactor(float);
|
| + void AnimateScrollbarsRecursive(LayerImpl* layer,
|
| + base::TimeTicks time);
|
|
|
| - scoped_ptr<ScrollAndScaleSet> processScrollDeltas();
|
| + void DumpRenderSurfaces(std::string* str,
|
| + int indent,
|
| + const LayerImpl* layer) const;
|
|
|
| - void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration);
|
| + static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer);
|
|
|
| - bool needsAnimateLayers() const { return !m_animationRegistrar->active_animation_controllers().empty(); }
|
| + scoped_ptr<OutputSurface> output_surface_;
|
| + scoped_ptr<ResourceProvider> resource_provider_;
|
| + scoped_ptr<Renderer> renderer_;
|
| + scoped_ptr<TileManager> tile_manager_;
|
|
|
| - void renderingStats(RenderingStats*) const;
|
| + // Tree currently being drawn.
|
| + scoped_ptr<LayerTreeImpl> active_tree_;
|
|
|
| - void sendManagedMemoryStats(
|
| - size_t memoryVisibleBytes,
|
| - size_t memoryVisibleAndNearbyBytes,
|
| - size_t memoryUseBytes);
|
| + // In impl-side painting mode, tree with possibly incomplete rasterized
|
| + // content. May be promoted to active by ActivatePendingTreeIfNeeded().
|
| + scoped_ptr<LayerTreeImpl> pending_tree_;
|
|
|
| - FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
|
| - PaintTimeCounter* paintTimeCounter() const { return m_paintTimeCounter.get(); }
|
| - MemoryHistory* memoryHistory() const { return m_memoryHistory.get(); }
|
| - DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
|
| - ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
|
| - TopControlsManager* topControlsManager() const { return m_topControlsManager.get(); }
|
| + // In impl-side painting mode, inert tree with layers that can be recycled
|
| + // by the next sync from the main thread.
|
| + scoped_ptr<LayerTreeImpl> recycle_tree_;
|
|
|
| - Proxy* proxy() const { return m_proxy; }
|
| + bool did_lock_scrolling_layer_;
|
| + bool should_bubble_scrolls_;
|
| + bool wheel_scrolling_;
|
| + LayerTreeSettings settings_;
|
| + LayerTreeDebugState debug_state_;
|
| + gfx::Size layout_viewport_size_;
|
| + gfx::Size device_viewport_size_;
|
| + float device_scale_factor_;
|
| + bool visible_;
|
| + ManagedMemoryPolicy managed_memory_policy_;
|
|
|
| - AnimationRegistrar* animationRegistrar() const { return m_animationRegistrar.get(); }
|
| + bool pinch_gesture_active_;
|
| + gfx::Point previous_pinch_anchor_;
|
|
|
| - void setDebugState(const LayerTreeDebugState& debugState);
|
| - const LayerTreeDebugState& debugState() const { return m_debugState; }
|
| + // This is set by AnimateLayers() and used by UpdateAnimationState()
|
| + // when sending animation events to the main thread.
|
| + base::Time last_animation_time_;
|
|
|
| - void savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber);
|
| + scoped_ptr<TopControlsManager> top_controls_manager_;
|
|
|
| - class CC_EXPORT CullRenderPassesWithCachedTextures {
|
| - public:
|
| - bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
|
| + scoped_ptr<PageScaleAnimation> page_scale_animation_;
|
|
|
| - // Iterates from the root first, in order to remove the surfaces closest
|
| - // to the root with cached textures, and all surfaces that draw into
|
| - // them.
|
| - size_t renderPassListBegin(const RenderPassList& list) const { return list.size() - 1; }
|
| - size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; }
|
| - size_t renderPassListNext(size_t it) const { return it - 1; }
|
| + // This is used for ticking animations slowly when hidden.
|
| + scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_;
|
|
|
| - CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(renderer) { }
|
| - private:
|
| - Renderer& m_renderer;
|
| - };
|
| + scoped_ptr<FrameRateCounter> fps_counter_;
|
| + scoped_ptr<PaintTimeCounter> paint_time_counter_;
|
| + scoped_ptr<MemoryHistory> memory_history_;
|
| + scoped_ptr<DebugRectHistory> debug_rect_history_;
|
|
|
| - class CC_EXPORT CullRenderPassesWithNoQuads {
|
| - public:
|
| - bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
|
| + int64 num_impl_thread_scrolls_;
|
| + int64 num_main_thread_scrolls_;
|
|
|
| - // Iterates in draw order, so that when a surface is removed, and its
|
| - // target becomes empty, then its target can be removed also.
|
| - size_t renderPassListBegin(const RenderPassList&) const { return 0; }
|
| - size_t renderPassListEnd(const RenderPassList& list) const { return list.size(); }
|
| - size_t renderPassListNext(size_t it) const { return it + 1; }
|
| - };
|
| + int64 cumulative_num_layers_drawn_;
|
|
|
| - template<typename RenderPassCuller>
|
| - static void removeRenderPasses(RenderPassCuller, FrameData&);
|
| + int64 cumulative_num_missing_tiles_;
|
|
|
| - skia::RefPtr<SkPicture> capturePicture();
|
| + size_t last_sent_memory_visible_bytes_;
|
| + size_t last_sent_memory_visible_and_nearby_bytes_;
|
| + size_t last_sent_memory_use_bytes_;
|
|
|
| - bool pinchGestureActive() const { return m_pinchGestureActive; }
|
| + base::TimeTicks current_frame_time_;
|
|
|
| - void setTreePriority(TreePriority priority);
|
| + scoped_ptr<AnimationRegistrar> animation_registrar_;
|
|
|
| - void beginNextFrame();
|
| - base::TimeTicks currentFrameTime();
|
| -
|
| - scoped_ptr<base::Value> asValue() const;
|
| - scoped_ptr<base::Value> activationStateAsValue() const;
|
| - scoped_ptr<base::Value> frameStateAsValue() const;
|
| -
|
| - bool pageScaleAnimationActive() const { return !!m_pageScaleAnimation; }
|
| -
|
| -protected:
|
| - LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
|
| - void activatePendingTree();
|
| -
|
| - // Virtual for testing.
|
| - virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime);
|
| - virtual void updateAnimationState();
|
| -
|
| - // Virtual for testing.
|
| - virtual base::TimeDelta lowFrequencyAnimationInterval() const;
|
| -
|
| - const AnimationRegistrar::AnimationControllerMap& activeAnimationControllers() const { return m_animationRegistrar->active_animation_controllers(); }
|
| -
|
| - LayerTreeHostImplClient* m_client;
|
| - Proxy* m_proxy;
|
| -
|
| -private:
|
| - void animatePageScale(base::TimeTicks monotonicTime);
|
| - void animateScrollbars(base::TimeTicks monotonicTime);
|
| -
|
| - void setPageScaleDelta(float);
|
| - gfx::Vector2dF scrollLayerWithViewportSpaceDelta(LayerImpl* layerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx::Vector2dF viewportDelta);
|
| -
|
| - void updateMaxScrollOffset();
|
| - void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList);
|
| -
|
| - // Returns false if the frame should not be displayed. This function should
|
| - // only be called from prepareToDraw, as didDrawAllLayers must be called
|
| - // if this helper function is called.
|
| - bool calculateRenderPasses(FrameData&);
|
| - void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base::Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
|
| - void setBackgroundTickingEnabled(bool);
|
| -
|
| - void sendDidLoseOutputSurfaceRecursive(LayerImpl*);
|
| - void clearRenderSurfaces();
|
| - bool ensureRenderSurfaceLayerList();
|
| - void clearCurrentlyScrollingLayer();
|
| -
|
| - void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime);
|
| -
|
| - void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const;
|
| -
|
| - static LayerImpl* getNonCompositedContentLayerRecursive(LayerImpl* layer);
|
| -
|
| - scoped_ptr<OutputSurface> m_outputSurface;
|
| - scoped_ptr<ResourceProvider> m_resourceProvider;
|
| - scoped_ptr<Renderer> m_renderer;
|
| - scoped_ptr<TileManager> m_tileManager;
|
| -
|
| - // Tree currently being drawn.
|
| - scoped_ptr<LayerTreeImpl> m_activeTree;
|
| -
|
| - // In impl-side painting mode, tree with possibly incomplete rasterized
|
| - // content. May be promoted to active by activatePendingTreeIfNeeded().
|
| - scoped_ptr<LayerTreeImpl> m_pendingTree;
|
| -
|
| - // In impl-side painting mode, inert tree with layers that can be recycled
|
| - // by the next sync from the main thread.
|
| - scoped_ptr<LayerTreeImpl> m_recycleTree;
|
| -
|
| - bool m_didLockScrollingLayer;
|
| - bool m_shouldBubbleScrolls;
|
| - bool m_wheelScrolling;
|
| - LayerTreeSettings m_settings;
|
| - LayerTreeDebugState m_debugState;
|
| - gfx::Size m_layoutViewportSize;
|
| - gfx::Size m_deviceViewportSize;
|
| - float m_deviceScaleFactor;
|
| - bool m_visible;
|
| - ManagedMemoryPolicy m_managedMemoryPolicy;
|
| -
|
| - bool m_pinchGestureActive;
|
| - gfx::Point m_previousPinchAnchor;
|
| -
|
| - // This is set by animateLayers() and used by updateAnimationState()
|
| - // when sending animation events to the main thread.
|
| - base::Time m_lastAnimationTime;
|
| -
|
| - scoped_ptr<TopControlsManager> m_topControlsManager;
|
| -
|
| - scoped_ptr<PageScaleAnimation> m_pageScaleAnimation;
|
| -
|
| - // This is used for ticking animations slowly when hidden.
|
| - scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
|
| -
|
| - scoped_ptr<FrameRateCounter> m_fpsCounter;
|
| - scoped_ptr<PaintTimeCounter> m_paintTimeCounter;
|
| - scoped_ptr<MemoryHistory> m_memoryHistory;
|
| - scoped_ptr<DebugRectHistory> m_debugRectHistory;
|
| -
|
| - int64 m_numImplThreadScrolls;
|
| - int64 m_numMainThreadScrolls;
|
| -
|
| - int64 m_cumulativeNumLayersDrawn;
|
| -
|
| - int64 m_cumulativeNumMissingTiles;
|
| -
|
| - size_t m_lastSentMemoryVisibleBytes;
|
| - size_t m_lastSentMemoryVisibleAndNearbyBytes;
|
| - size_t m_lastSentMemoryUseBytes;
|
| -
|
| - base::TimeTicks m_currentFrameTime;
|
| -
|
| - scoped_ptr<AnimationRegistrar> m_animationRegistrar;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
|
| + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
|
| };
|
|
|
| } // namespace cc
|
|
|