Chromium Code Reviews| Index: cc/trees/layer_tree_host_in_process.h |
| diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host_in_process.h |
| similarity index 84% |
| copy from cc/trees/layer_tree_host.h |
| copy to cc/trees/layer_tree_host_in_process.h |
| index b60accaf2ee93f5a90b895680732b790afcaa115..f64fa7beafc8915f3d41474581585bbfa60a25ba 100644 |
| --- a/cc/trees/layer_tree_host.h |
| +++ b/cc/trees/layer_tree_host_in_process.h |
| @@ -2,8 +2,8 @@ |
| // 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_ |
| +#ifndef CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |
| +#define CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |
| #include <stddef.h> |
| #include <stdint.h> |
| @@ -36,8 +36,8 @@ |
| #include "cc/resources/resource_format.h" |
| #include "cc/trees/compositor_mode.h" |
| #include "cc/trees/layer_tree.h" |
| +#include "cc/trees/layer_tree_host.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" |
| @@ -45,20 +45,16 @@ |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/gfx/geometry/rect.h" |
| -namespace gpu { |
| -class GpuMemoryBufferManager; |
| -} |
| - |
| namespace cc { |
| - |
| -class AnimationEvents; |
| class AnimationHost; |
| +class AnimationEvents; |
| class BeginFrameSource; |
| class ClientPictureCache; |
| class EnginePictureCache; |
| class HeadsUpDisplayLayer; |
| class ImageSerializationProcessor; |
| class Layer; |
| +class LayerTreeHostClient; |
| class LayerTreeHostImpl; |
| class LayerTreeHostImplClient; |
| class LayerTreeHostSingleThreadClient; |
| @@ -80,20 +76,7 @@ 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 CC_EXPORT LayerTreeHostInProcess : public LayerTreeHost { |
| public: |
| // TODO(sad): InitParams should be a movable type so that it can be |
| // std::move()d to the Create* functions. |
| @@ -113,32 +96,32 @@ class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface { |
| }; |
| // The SharedBitmapManager will be used on the compositor thread. |
| - static std::unique_ptr<LayerTreeHostInterface> CreateThreaded( |
| + static std::unique_ptr<LayerTreeHostInProcess> CreateThreaded( |
|
Khushal
2016/09/15 00:56:20
I made these return the in process one itself. If
|
| scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| InitParams* params); |
| - static std::unique_ptr<LayerTreeHost> CreateSingleThreaded( |
| + static std::unique_ptr<LayerTreeHostInProcess> CreateSingleThreaded( |
| LayerTreeHostSingleThreadClient* single_thread_client, |
| InitParams* params); |
| - static std::unique_ptr<LayerTreeHostInterface> CreateRemoteServer( |
| + static std::unique_ptr<LayerTreeHostInProcess> 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 |
| + // The lifetime of this LayerTreeHostInProcess is tied to the lifetime of the |
| + // remote server LayerTreeHostInProcess. 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( |
| + // LayerTreeHostInProcess on the server is destroyed. |
| + static std::unique_ptr<LayerTreeHostInProcess> CreateRemoteClient( |
| RemoteProtoChannel* remote_proto_channel, |
| scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| InitParams* params); |
| - ~LayerTreeHost() override; |
| + ~LayerTreeHostInProcess() override; |
| - // LayerTreeHostInterface implementation. |
| + // LayerTreeHost implementation. |
| int GetId() const override; |
| int SourceFrameNumber() const override; |
| LayerTree* GetLayerTree() override; |
| @@ -181,8 +164,10 @@ class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface { |
| bool SendMessageToMicroBenchmark(int id, |
| std::unique_ptr<base::Value> value) override; |
| SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override; |
| + void SetNextCommitWaitsForActivation() override; |
| + void ResetGpuRasterizationTracking() override; |
| - // LayerTreeHost interface to Proxy. |
| + // LayerTreeHostInProcess interface to Proxy. |
| void WillBeginMainFrame(); |
| void DidBeginMainFrame(); |
| void BeginMainFrame(const BeginFrameArgs& args); |
| @@ -217,8 +202,6 @@ class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface { |
| return rendering_stats_instrumentation_.get(); |
| } |
| - void SetNextCommitWaitsForActivation(); |
| - |
| void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); |
| bool has_gpu_rasterization_trigger() const { |
| @@ -227,18 +210,18 @@ class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface { |
| 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. |
| + // Serializes the parts of this LayerTreeHostInProcess 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. |
| + // Deserializes the protobuf into this LayerTreeHostInProcess 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; |
| @@ -258,14 +241,12 @@ class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface { |
| 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); |
| + LayerTreeHostInProcess(InitParams* params, |
| + CompositorMode mode, |
| + std::unique_ptr<LayerTree> layer_tree); |
| + LayerTreeHostInProcess(InitParams* params, CompositorMode mode); |
| void InitializeThreaded( |
| scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| @@ -384,9 +365,9 @@ class CC_EXPORT LayerTreeHost : public LayerTreeHostInterface { |
| SurfaceSequenceGenerator surface_sequence_generator_; |
| uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
| - DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostInProcess); |
| }; |
| } // namespace cc |
| -#endif // CC_TREES_LAYER_TREE_HOST_H_ |
| +#endif // CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |