| Index: cc/trees/layer_tree_host.h
|
| diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
|
| index b60accaf2ee93f5a90b895680732b790afcaa115..660c192fa4c1c6f20ff1120b99a12eddd3e407b6 100644
|
| --- a/cc/trees/layer_tree_host.h
|
| +++ b/cc/trees/layer_tree_host.h
|
| @@ -1,390 +1,208 @@
|
| -// Copyright 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| #ifndef CC_TREES_LAYER_TREE_HOST_H_
|
| #define CC_TREES_LAYER_TREE_HOST_H_
|
|
|
| -#include <stddef.h>
|
| -#include <stdint.h>
|
| -
|
| -#include <limits>
|
| -#include <memory>
|
| -#include <set>
|
| -#include <string>
|
| -#include <unordered_map>
|
| -#include <vector>
|
| -
|
| -#include "base/cancelable_callback.h"
|
| #include "base/macros.h"
|
| -#include "base/memory/ref_counted.h"
|
| #include "base/memory/weak_ptr.h"
|
| -#include "base/time/time.h"
|
| -#include "cc/animation/target_property.h"
|
| #include "cc/base/cc_export.h"
|
| #include "cc/debug/micro_benchmark.h"
|
| -#include "cc/debug/micro_benchmark_controller.h"
|
| -#include "cc/input/event_listener_properties.h"
|
| -#include "cc/input/input_handler.h"
|
| -#include "cc/input/layer_selection_bound.h"
|
| -#include "cc/input/scrollbar.h"
|
| #include "cc/input/top_controls_state.h"
|
| -#include "cc/layers/layer_collections.h"
|
| -#include "cc/layers/layer_list_iterator.h"
|
| -#include "cc/output/output_surface.h"
|
| -#include "cc/output/swap_promise.h"
|
| -#include "cc/resources/resource_format.h"
|
| -#include "cc/trees/compositor_mode.h"
|
| -#include "cc/trees/layer_tree.h"
|
| -#include "cc/trees/layer_tree_host_client.h"
|
| -#include "cc/trees/layer_tree_host_interface.h"
|
| -#include "cc/trees/layer_tree_settings.h"
|
| -#include "cc/trees/proxy.h"
|
| -#include "cc/trees/surface_sequence_generator.h"
|
| -#include "cc/trees/swap_promise_manager.h"
|
| -#include "third_party/skia/include/core/SkColor.h"
|
| -#include "ui/gfx/geometry/rect.h"
|
| +
|
| +namespace base {
|
| +class TimeTicks;
|
| +} // namespace base
|
| +
|
| +namespace gfx {
|
| +class Rect;
|
| +} // namespace gfx
|
|
|
| namespace gpu {
|
| class GpuMemoryBufferManager;
|
| -}
|
| +} // namespace gpu
|
|
|
| namespace cc {
|
| -
|
| -class AnimationEvents;
|
| -class AnimationHost;
|
| -class BeginFrameSource;
|
| -class ClientPictureCache;
|
| -class EnginePictureCache;
|
| -class HeadsUpDisplayLayer;
|
| -class ImageSerializationProcessor;
|
| -class Layer;
|
| -class LayerTreeHostImpl;
|
| -class LayerTreeHostImplClient;
|
| -class LayerTreeHostSingleThreadClient;
|
| +class InputHandler;
|
| +class LayerTree;
|
| +class LayerTreeDebugState;
|
| class LayerTreeMutator;
|
| -class PropertyTrees;
|
| -class Region;
|
| -class RemoteProtoChannel;
|
| -class RenderingStatsInstrumentation;
|
| -class ResourceProvider;
|
| -class ResourceUpdateQueue;
|
| -class SharedBitmapManager;
|
| -class TaskGraphRunner;
|
| -class TopControlsManager;
|
| -struct PendingPageScaleAnimation;
|
| -struct RenderingStats;
|
| -struct ScrollAndScaleSet;
|
| -
|
| -namespace proto {
|
| -class LayerTreeHost;
|
| -}
|
| -
|
| -// This class is being refactored to an interface, see LayerTreeHostInterface,
|
| -// which is the API for the cc embedder. When adding new code to this class,
|
| -// consider the following:
|
| -// 1) If its state/data that gets pushed to the LayerTreeImpl during commit, add
|
| -// it to the LayerTree.
|
| -// 2) If it's a call from the embedder, add it to the LayerTreeHostInterface.
|
| -// 3) If it's a call from any of the internal cc classes, i.e., LayerTree or
|
| -// PropertyTreeBuilder, etc., add it to the LayerTreeHostInterface.
|
| -// 4) If it's a notification from the impl thread or a call from Proxy, add it
|
| -// to this class.
|
| -// This class will be renamed to LayerTreeHostInProcess and will be the
|
| -// LayerTreeHost implementation for when the impl thread for the compositor runs
|
| -// in the same process, and thus uses a Proxy.
|
| -class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface {
|
| +class LayerTreeSettings;
|
| +class OutputSurface;
|
| +class SurfaceSequenceGenerator;
|
| +class SwapPromise;
|
| +class SwapPromiseManager;
|
| +class SwapPromiseMonitor;
|
| +class TaskRunnerProvider;
|
| +class UIResourceManager;
|
| +
|
| +// This encapsulates the API for any embedder to use cc. The
|
| +// LayerTreeHostInProcess provides the implementation where the compositor
|
| +// thread components of this host run within the same process. Use
|
| +// LayerTreeHostInProcess::CreateThreaded/CreateSingleThread to get either.
|
| +class CC_EXPORT LayerTreeHost {
|
| public:
|
| - // TODO(sad): InitParams should be a movable type so that it can be
|
| - // std::move()d to the Create* functions.
|
| - struct CC_EXPORT InitParams {
|
| - LayerTreeHostClient* client = nullptr;
|
| - SharedBitmapManager* shared_bitmap_manager = nullptr;
|
| - gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr;
|
| - TaskGraphRunner* task_graph_runner = nullptr;
|
| - LayerTreeSettings const* settings = nullptr;
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner;
|
| - std::unique_ptr<BeginFrameSource> external_begin_frame_source;
|
| - ImageSerializationProcessor* image_serialization_processor = nullptr;
|
| - std::unique_ptr<AnimationHost> animation_host;
|
| -
|
| - InitParams();
|
| - ~InitParams();
|
| - };
|
| -
|
| - // The SharedBitmapManager will be used on the compositor thread.
|
| - static std::unique_ptr<LayerTreeHostInterface> CreateThreaded(
|
| - scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
|
| - InitParams* params);
|
| -
|
| - static std::unique_ptr<LayerTreeHost> CreateSingleThreaded(
|
| - LayerTreeHostSingleThreadClient* single_thread_client,
|
| - InitParams* params);
|
| -
|
| - static std::unique_ptr<LayerTreeHostInterface> CreateRemoteServer(
|
| - RemoteProtoChannel* remote_proto_channel,
|
| - InitParams* params);
|
| -
|
| - // The lifetime of this LayerTreeHost is tied to the lifetime of the remote
|
| - // server LayerTreeHost. It should be created on receiving
|
| - // CompositorMessageToImpl::InitializeImpl message and destroyed on receiving
|
| - // a CompositorMessageToImpl::CloseImpl message from the server. This ensures
|
| - // that the client will not send any compositor messages once the
|
| - // LayerTreeHost on the server is destroyed.
|
| - static std::unique_ptr<LayerTreeHostInterface> CreateRemoteClient(
|
| - RemoteProtoChannel* remote_proto_channel,
|
| - scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
|
| - InitParams* params);
|
| -
|
| - ~LayerTreeHost() override;
|
| -
|
| - // LayerTreeHostInterface implementation.
|
| - int GetId() const override;
|
| - int SourceFrameNumber() const override;
|
| - LayerTree* GetLayerTree() override;
|
| - const LayerTree* GetLayerTree() const override;
|
| - UIResourceManager* GetUIResourceManager() const override;
|
| - TaskRunnerProvider* GetTaskRunnerProvider() const override;
|
| - const LayerTreeSettings& GetSettings() const override;
|
| - void SetSurfaceClientId(uint32_t client_id) override;
|
| - void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override;
|
| - void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override;
|
| - SwapPromiseManager* GetSwapPromiseManager() override;
|
| - void SetHasGpuRasterizationTrigger(bool has_trigger) override;
|
| - void SetVisible(bool visible) override;
|
| - bool IsVisible() const override;
|
| - void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface) override;
|
| - std::unique_ptr<OutputSurface> ReleaseOutputSurface() override;
|
| - void SetNeedsAnimate() override;
|
| - void SetNeedsUpdateLayers() override;
|
| - void SetNeedsCommit() override;
|
| - bool BeginMainFrameRequested() const override;
|
| - bool CommitRequested() const override;
|
| - void SetDeferCommits(bool defer_commits) override;
|
| - void LayoutAndUpdateLayers() override;
|
| - void Composite(base::TimeTicks frame_begin_time) override;
|
| - void SetNeedsRedraw() override;
|
| - void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
|
| - void SetNextCommitForcesRedraw() override;
|
| - void NotifyInputThrottledUntilCommit() override;
|
| - void UpdateTopControlsState(TopControlsState constraints,
|
| - TopControlsState current,
|
| - bool animate) override;
|
| - const base::WeakPtr<InputHandler>& GetInputHandler() const override;
|
| - void DidStopFlinging() override;
|
| - void SetDebugState(const LayerTreeDebugState& debug_state) override;
|
| - const LayerTreeDebugState& GetDebugState() const override;
|
| - int ScheduleMicroBenchmark(
|
| - const std::string& benchmark_name,
|
| - std::unique_ptr<base::Value> value,
|
| - const MicroBenchmark::DoneCallback& callback) override;
|
| - bool SendMessageToMicroBenchmark(int id,
|
| - std::unique_ptr<base::Value> value) override;
|
| - SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override;
|
| -
|
| - // LayerTreeHost interface to Proxy.
|
| - void WillBeginMainFrame();
|
| - void DidBeginMainFrame();
|
| - void BeginMainFrame(const BeginFrameArgs& args);
|
| - void BeginMainFrameNotExpectedSoon();
|
| - void AnimateLayers(base::TimeTicks monotonic_frame_begin_time);
|
| - void RequestMainFrameUpdate();
|
| - void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl);
|
| - void WillCommit();
|
| - void CommitComplete();
|
| - void RequestNewOutputSurface();
|
| - void DidInitializeOutputSurface();
|
| - void DidFailToInitializeOutputSurface();
|
| - virtual std::unique_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl(
|
| - LayerTreeHostImplClient* client);
|
| - void DidLoseOutputSurface();
|
| - void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); }
|
| - void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); }
|
| - bool UpdateLayers();
|
| - // Called when the compositor completed page scale animation.
|
| - void DidCompletePageScaleAnimation();
|
| - void ApplyScrollAndScale(ScrollAndScaleSet* info);
|
| -
|
| - LayerTreeHostClient* client() { return client_; }
|
| -
|
| - bool gpu_rasterization_histogram_recorded() const {
|
| - return gpu_rasterization_histogram_recorded_;
|
| - }
|
| -
|
| - void CollectRenderingStats(RenderingStats* stats) const;
|
| -
|
| - RenderingStatsInstrumentation* rendering_stats_instrumentation() const {
|
| - return rendering_stats_instrumentation_.get();
|
| - }
|
| -
|
| - void SetNextCommitWaitsForActivation();
|
| -
|
| - void SetAnimationEvents(std::unique_ptr<AnimationEvents> events);
|
| -
|
| - bool has_gpu_rasterization_trigger() const {
|
| - return has_gpu_rasterization_trigger_;
|
| - }
|
| -
|
| - Proxy* proxy() const { return proxy_.get(); }
|
| -
|
| - // Serializes the parts of this LayerTreeHost that is needed for a commit to a
|
| - // protobuf message. Not all members are serialized as they are not helpful
|
| - // for remote usage.
|
| - // The |swap_promise_list_| is transferred to the serializer in
|
| - // |swap_promises|.
|
| - void ToProtobufForCommit(
|
| - proto::LayerTreeHost* proto,
|
| - std::vector<std::unique_ptr<SwapPromise>>* swap_promises);
|
| -
|
| - // Deserializes the protobuf into this LayerTreeHost before a commit. The
|
| - // expected input is a serialized remote LayerTreeHost. After deserializing
|
| - // the protobuf, the normal commit-flow should continue.
|
| - void FromProtobufForCommit(const proto::LayerTreeHost& proto);
|
| -
|
| - bool IsSingleThreaded() const;
|
| - bool IsThreaded() const;
|
| - bool IsRemoteServer() const;
|
| - bool IsRemoteClient() const;
|
| -
|
| - ImageSerializationProcessor* image_serialization_processor() const {
|
| - return image_serialization_processor_;
|
| - }
|
| -
|
| - EnginePictureCache* engine_picture_cache() const {
|
| - return engine_picture_cache_ ? engine_picture_cache_.get() : nullptr;
|
| - }
|
| -
|
| - ClientPictureCache* client_picture_cache() const {
|
| - return client_picture_cache_ ? client_picture_cache_.get() : nullptr;
|
| - }
|
| -
|
| - void ResetGpuRasterizationTracking();
|
| -
|
| - protected:
|
| - // Allow tests to inject the LayerTree.
|
| - LayerTreeHost(InitParams* params,
|
| - CompositorMode mode,
|
| - std::unique_ptr<LayerTree> layer_tree);
|
| - LayerTreeHost(InitParams* params, CompositorMode mode);
|
| -
|
| - void InitializeThreaded(
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
|
| - scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
|
| - std::unique_ptr<BeginFrameSource> external_begin_frame_source);
|
| - void InitializeSingleThreaded(
|
| - LayerTreeHostSingleThreadClient* single_thread_client,
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
|
| - std::unique_ptr<BeginFrameSource> external_begin_frame_source);
|
| - void InitializeRemoteServer(
|
| - RemoteProtoChannel* remote_proto_channel,
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner);
|
| - void InitializeRemoteClient(
|
| - RemoteProtoChannel* remote_proto_channel,
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
|
| - scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
|
| - void InitializeForTesting(
|
| - std::unique_ptr<TaskRunnerProvider> task_runner_provider,
|
| - std::unique_ptr<Proxy> proxy_for_testing,
|
| - std::unique_ptr<BeginFrameSource> external_begin_frame_source);
|
| - void InitializePictureCacheForTesting();
|
| - void SetTaskRunnerProviderForTesting(
|
| - std::unique_ptr<TaskRunnerProvider> task_runner_provider);
|
| - void SetUIResourceManagerForTesting(
|
| - std::unique_ptr<UIResourceManager> ui_resource_manager);
|
| -
|
| - // shared_bitmap_manager(), gpu_memory_buffer_manager(), and
|
| - // task_graph_runner() return valid values only until the LayerTreeHostImpl is
|
| - // created in CreateLayerTreeHostImpl().
|
| - SharedBitmapManager* shared_bitmap_manager() const {
|
| - return shared_bitmap_manager_;
|
| - }
|
| - gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const {
|
| - return gpu_memory_buffer_manager_;
|
| - }
|
| - TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; }
|
| + virtual ~LayerTreeHost() {}
|
| +
|
| + // Returns the process global unique identifier for this LayerTreeHost.
|
| + virtual int GetId() const = 0;
|
| +
|
| + // The current source frame number. This is incremented for each main frame
|
| + // update(commit) pushed to the compositor thread.
|
| + virtual int SourceFrameNumber() const = 0;
|
| +
|
| + // Returns the LayerTree that holds the main frame state pushed to the
|
| + // LayerTreeImpl on commit.
|
| + virtual LayerTree* GetLayerTree() = 0;
|
| + virtual const LayerTree* GetLayerTree() const = 0;
|
| +
|
| + // Returns the UIResourceManager used to create UIResources for
|
| + // UIResourceLayers pushed to the LayerTree.
|
| + virtual UIResourceManager* GetUIResourceManager() const = 0;
|
| +
|
| + // Returns the TaskRunnerProvider used to access the main and compositor
|
| + // thread task runners.
|
| + virtual TaskRunnerProvider* GetTaskRunnerProvider() const = 0;
|
| +
|
| + // Returns the settings used by this host.
|
| + virtual const LayerTreeSettings& GetSettings() const = 0;
|
| +
|
| + // Sets the client id used to generate the SurfaceId that uniquely identifies
|
| + // the Surfaces produced by this compositor.
|
| + virtual void SetSurfaceClientId(uint32_t client_id) = 0;
|
| +
|
| + // Sets the LayerTreeMutator interface used to directly mutate the compositor
|
| + // state on the compositor thread. (Compositor-Worker)
|
| + virtual void SetLayerTreeMutator(
|
| + std::unique_ptr<LayerTreeMutator> mutator) = 0;
|
| +
|
| + // Call this function when you expect there to be a swap buffer.
|
| + // See swap_promise.h for how to use SwapPromise.
|
| + virtual void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) = 0;
|
|
|
| - void OnCommitForSwapPromises();
|
| + // Returns the SwapPromiseManager used to create SwapPromiseMonitors for this
|
| + // host.
|
| + virtual SwapPromiseManager* GetSwapPromiseManager() = 0;
|
|
|
| - void RecordGpuRasterizationHistogram();
|
| + // Sets whether the content is suitable to use Gpu Rasterization.
|
| + virtual void SetHasGpuRasterizationTrigger(bool has_trigger) = 0;
|
|
|
| - MicroBenchmarkController micro_benchmark_controller_;
|
| -
|
| - std::unique_ptr<LayerTree> layer_tree_;
|
| + // Visibility and OutputSurface -------------------------------
|
|
|
| - base::WeakPtr<InputHandler> input_handler_weak_ptr_;
|
| -
|
| - private:
|
| - friend class LayerTreeHostSerializationTest;
|
| -
|
| - // This is the number of consecutive frames in which we want the content to be
|
| - // suitable for GPU rasterization before re-enabling it.
|
| - enum { kNumFramesToConsiderBeforeGpuRasterization = 60 };
|
| -
|
| - void ApplyViewportDeltas(ScrollAndScaleSet* info);
|
| - void ApplyPageScaleDeltaFromImplSide(float page_scale_delta);
|
| - void InitializeProxy(
|
| - std::unique_ptr<Proxy> proxy,
|
| - std::unique_ptr<BeginFrameSource> external_begin_frame_source);
|
| -
|
| - bool DoUpdateLayers(Layer* root_layer);
|
| - void UpdateHudLayer();
|
| -
|
| - bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
|
| -
|
| - void CalculateLCDTextMetricsCallback(Layer* layer);
|
| -
|
| - void SetPropertyTreesNeedRebuild();
|
| -
|
| - const CompositorMode compositor_mode_;
|
| -
|
| - std::unique_ptr<UIResourceManager> ui_resource_manager_;
|
| -
|
| - LayerTreeHostClient* client_;
|
| - std::unique_ptr<Proxy> proxy_;
|
| - std::unique_ptr<TaskRunnerProvider> task_runner_provider_;
|
| -
|
| - int source_frame_number_;
|
| - std::unique_ptr<RenderingStatsInstrumentation>
|
| - rendering_stats_instrumentation_;
|
| -
|
| - SwapPromiseManager swap_promise_manager_;
|
| -
|
| - // |current_output_surface_| can't be updated until we've successfully
|
| - // initialized a new output surface. |new_output_surface_| contains the
|
| - // new output surface that is currently being initialized. If initialization
|
| - // is successful then |new_output_surface_| replaces
|
| - // |current_output_surface_|.
|
| - std::unique_ptr<OutputSurface> new_output_surface_;
|
| - std::unique_ptr<OutputSurface> current_output_surface_;
|
| -
|
| - const LayerTreeSettings settings_;
|
| - LayerTreeDebugState debug_state_;
|
| -
|
| - bool visible_;
|
| -
|
| - bool has_gpu_rasterization_trigger_;
|
| - bool content_is_suitable_for_gpu_rasterization_;
|
| - bool gpu_rasterization_histogram_recorded_;
|
| -
|
| - // If set, then page scale animation has completed, but the client hasn't been
|
| - // notified about it yet.
|
| - bool did_complete_scale_animation_;
|
| -
|
| - int id_;
|
| - bool next_commit_forces_redraw_;
|
| + virtual void SetVisible(bool visible) = 0;
|
| + virtual bool IsVisible() const = 0;
|
|
|
| - SharedBitmapManager* shared_bitmap_manager_;
|
| - gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
|
| - TaskGraphRunner* task_graph_runner_;
|
| + // Called in response to an OutputSurface request made to the client using
|
| + // LayerTreeHostClient::RequestNewOutputSurface. The client will be informed
|
| + // of the OutputSurface initialization status using DidInitializaOutputSurface
|
| + // or DidFailToInitializeOutputSurface. The request is completed when the host
|
| + // successfully initializes an OutputSurface.
|
| + virtual void SetOutputSurface(
|
| + std::unique_ptr<OutputSurface> output_surface) = 0;
|
|
|
| - ImageSerializationProcessor* image_serialization_processor_;
|
| - std::unique_ptr<EnginePictureCache> engine_picture_cache_;
|
| - std::unique_ptr<ClientPictureCache> client_picture_cache_;
|
| + // Forces the host to immediately release all references to the OutputSurface,
|
| + // if any. Can be safely called any time.
|
| + virtual std::unique_ptr<OutputSurface> ReleaseOutputSurface() = 0;
|
|
|
| - SurfaceSequenceGenerator surface_sequence_generator_;
|
| - uint32_t num_consecutive_frames_suitable_for_gpu_ = 0;
|
| + // Frame Scheduling (main and compositor frames) requests -------
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
|
| + // Requests a main frame update even if no content has changed. This is used,
|
| + // for instance in the case of RequestAnimationFrame from blink to ensure the
|
| + // main frame update is run on the next tick without pre-emptively forcing a
|
| + // full commit synchronization or layer updates.
|
| + virtual void SetNeedsAnimate() = 0;
|
| +
|
| + // Requests a main frame update and also ensure that the host pulls layer
|
| + // updates from the client, even if no content might have changed, without
|
| + // forcing a full commit synchronization.
|
| + virtual void SetNeedsUpdateLayers() = 0;
|
| +
|
| + // Requests that the next main frame update performs a full commit
|
| + // synchronization.
|
| + virtual void SetNeedsCommit() = 0;
|
| +
|
| + // Returns true if a main frame (for any pipeline stage above) has been
|
| + // requested.
|
| + virtual bool BeginMainFrameRequested() const = 0;
|
| +
|
| + // Returns true if a main frame with commit synchronization has been
|
| + // requested.
|
| + virtual bool CommitRequested() const = 0;
|
| +
|
| + // Enables/disables the compositor from requesting main frame updates from the
|
| + // client.
|
| + virtual void SetDeferCommits(bool defer_commits) = 0;
|
| +
|
| + // Synchronously performs a main frame update and layer updates. Used only in
|
| + // single threaded mode when the compositor's internal scheduling is disabled.
|
| + virtual void LayoutAndUpdateLayers() = 0;
|
| +
|
| + // Synchronously performs a complete main frame update, commit and compositor
|
| + // frame. Used only in single threaded mode when the compositor's internal
|
| + // scheduling is disabled.
|
| + virtual void Composite(base::TimeTicks frame_begin_time) = 0;
|
| +
|
| + // Requests a redraw (compositor frame) for the complete viewport.
|
| + virtual void SetNeedsRedraw() = 0;
|
| +
|
| + // Requests a redraw (compositor frame) for the given rect.
|
| + virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0;
|
| +
|
| + // Requests a main frame (including layer updates) and ensures that this main
|
| + // frame results in a redraw for the complete viewport when producing the
|
| + // CompositorFrame.
|
| + virtual void SetNextCommitForcesRedraw() = 0;
|
| +
|
| + // Input Handling ---------------------------------------------
|
| +
|
| + // Notifies the compositor that input from the browser is being throttled till
|
| + // the next commit. The compositor will prioritize activation of the pending
|
| + // tree so a commit can be performed.
|
| + virtual void NotifyInputThrottledUntilCommit() = 0;
|
| +
|
| + // Sets the state of the top controls. (Used for URL bar animations on
|
| + // android).
|
| + virtual void UpdateTopControlsState(TopControlsState constraints,
|
| + TopControlsState current,
|
| + bool animate) = 0;
|
| +
|
| + // Returns a reference to the InputHandler used to respond to input events on
|
| + // the compositor thread.
|
| + virtual const base::WeakPtr<InputHandler>& GetInputHandler() const = 0;
|
| +
|
| + // Informs the compositor that an active fling gesture being processed on the
|
| + // main thread has been finished.
|
| + virtual void DidStopFlinging() = 0;
|
| +
|
| + // Debugging and benchmarks ---------------------------------
|
| + virtual void SetDebugState(const LayerTreeDebugState& debug_state) = 0;
|
| + virtual const LayerTreeDebugState& GetDebugState() const = 0;
|
| +
|
| + // Returns the id of the benchmark on success, 0 otherwise.
|
| + virtual int ScheduleMicroBenchmark(
|
| + const std::string& benchmark_name,
|
| + std::unique_ptr<base::Value> value,
|
| + const MicroBenchmark::DoneCallback& callback) = 0;
|
| +
|
| + // Returns true if the message was successfully delivered and handled.
|
| + virtual bool SendMessageToMicroBenchmark(
|
| + int id,
|
| + std::unique_ptr<base::Value> value) = 0;
|
| +
|
| + // Methods used internally in cc. These are not intended to be a part of the
|
| + // public API for use by the embedder ----------------------
|
| + virtual SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() = 0;
|
| +
|
| + // When the main thread informs the impl thread that it is ready to commit,
|
| + // generally it would remain blocked till the main thread state is copied to
|
| + // the pending tree. Calling this would ensure that the main thread remains
|
| + // blocked till the pending tree is activated.
|
| + virtual void SetNextCommitWaitsForActivation() = 0;
|
| +
|
| + // The LayerTreeHost tracks whether the content is suitable for Gpu raster.
|
| + // Calling this will reset it back to not suitable state.
|
| + virtual void ResetGpuRasterizationTracking() = 0;
|
| };
|
|
|
| } // namespace cc
|
|
|