| OLD | NEW |
| 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 CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace cc { | 34 namespace cc { |
| 35 class AnimationHost; | 35 class AnimationHost; |
| 36 class Display; | 36 class Display; |
| 37 class Layer; | 37 class Layer; |
| 38 class LayerTreeHost; | 38 class LayerTreeHost; |
| 39 class OutputSurface; | 39 class OutputSurface; |
| 40 class VulkanContextProvider; | 40 class VulkanContextProvider; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace ui { |
| 44 class ViewRoot; |
| 45 } |
| 46 |
| 43 namespace content { | 47 namespace content { |
| 44 class CompositorClient; | 48 class CompositorClient; |
| 45 | 49 |
| 46 // ----------------------------------------------------------------------------- | 50 // ----------------------------------------------------------------------------- |
| 47 // Browser-side compositor that manages a tree of content and UI layers. | 51 // Browser-side compositor that manages a tree of content and UI layers. |
| 48 // ----------------------------------------------------------------------------- | 52 // ----------------------------------------------------------------------------- |
| 49 class CONTENT_EXPORT CompositorImpl | 53 class CONTENT_EXPORT CompositorImpl |
| 50 : public Compositor, | 54 : public Compositor, |
| 51 public cc::LayerTreeHostClient, | 55 public cc::LayerTreeHostClient, |
| 52 public cc::LayerTreeHostSingleThreadClient, | 56 public cc::LayerTreeHostSingleThreadClient, |
| 53 public ui::UIResourceProvider, | 57 public ui::UIResourceProvider, |
| 54 public ui::WindowAndroidCompositor { | 58 public ui::WindowAndroidCompositor { |
| 55 public: | 59 public: |
| 56 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); | 60 CompositorImpl(CompositorClient* client, ui::ViewRoot* view_root); |
| 57 ~CompositorImpl() override; | 61 ~CompositorImpl() override; |
| 58 | 62 |
| 59 static bool IsInitialized(); | 63 static bool IsInitialized(); |
| 60 | 64 |
| 61 // ui::ResourceProvider implementation. | 65 // ui::ResourceProvider implementation. |
| 62 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; | 66 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; |
| 63 void DeleteUIResource(cc::UIResourceId resource_id) override; | 67 void DeleteUIResource(cc::UIResourceId resource_id) override; |
| 64 bool SupportsETC1NonPowerOfTwo() const override; | 68 bool SupportsETC1NonPowerOfTwo() const override; |
| 65 | 69 |
| 66 private: | 70 private: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void InitializeDisplay( | 124 void InitializeDisplay( |
| 121 std::unique_ptr<cc::OutputSurface> display_output_surface, | 125 std::unique_ptr<cc::OutputSurface> display_output_surface, |
| 122 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, | 126 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, |
| 123 scoped_refptr<cc::ContextProvider> context_provider); | 127 scoped_refptr<cc::ContextProvider> context_provider); |
| 124 | 128 |
| 125 bool HavePendingReadbacks(); | 129 bool HavePendingReadbacks(); |
| 126 void SetBackgroundColor(int color); | 130 void SetBackgroundColor(int color); |
| 127 | 131 |
| 128 cc::FrameSinkId frame_sink_id_; | 132 cc::FrameSinkId frame_sink_id_; |
| 129 | 133 |
| 130 // root_layer_ is the persistent internal root layer, while subroot_layer_ | 134 // Layer in |view_root_| is the persistent internal root layer, |
| 131 // is the one attached by the compositor client. | 135 // while subroot_layer_ is the one attached by the compositor client. |
| 132 scoped_refptr<cc::Layer> subroot_layer_; | 136 scoped_refptr<cc::Layer> subroot_layer_; |
| 133 | 137 |
| 134 // Subtree for hidden layers with CopyOutputRequests on them. | 138 // Subtree for hidden layers with CopyOutputRequests on them. |
| 135 scoped_refptr<cc::Layer> readback_layer_tree_; | 139 scoped_refptr<cc::Layer> readback_layer_tree_; |
| 136 | 140 |
| 137 // Destruction order matters here: | 141 // Destruction order matters here: |
| 138 std::unique_ptr<cc::AnimationHost> animation_host_; | 142 std::unique_ptr<cc::AnimationHost> animation_host_; |
| 139 std::unique_ptr<cc::LayerTreeHost> host_; | 143 std::unique_ptr<cc::LayerTreeHost> host_; |
| 140 ui::ResourceManagerImpl resource_manager_; | 144 ui::ResourceManagerImpl resource_manager_; |
| 141 | 145 |
| 142 std::unique_ptr<cc::Display> display_; | 146 std::unique_ptr<cc::Display> display_; |
| 143 | 147 |
| 144 gfx::Size size_; | 148 gfx::Size size_; |
| 145 bool has_transparent_background_; | 149 bool has_transparent_background_; |
| 146 | 150 |
| 147 ANativeWindow* window_; | 151 ANativeWindow* window_; |
| 148 gpu::SurfaceHandle surface_handle_; | 152 gpu::SurfaceHandle surface_handle_; |
| 149 | 153 |
| 150 CompositorClient* client_; | 154 CompositorClient* client_; |
| 151 | 155 |
| 152 gfx::NativeWindow root_window_; | 156 gfx::NativeWindow root_window_; |
| 157 ui::ViewRoot* view_root_; |
| 153 | 158 |
| 154 // Whether we need to update animations on the next composite. | 159 // Whether we need to update animations on the next composite. |
| 155 bool needs_animate_; | 160 bool needs_animate_; |
| 156 | 161 |
| 157 // The number of SwapBuffer calls that have not returned and ACK'd from | 162 // The number of SwapBuffer calls that have not returned and ACK'd from |
| 158 // the GPU thread. | 163 // the GPU thread. |
| 159 unsigned int pending_swapbuffers_; | 164 unsigned int pending_swapbuffers_; |
| 160 | 165 |
| 161 size_t num_successive_context_creation_failures_; | 166 size_t num_successive_context_creation_failures_; |
| 162 | 167 |
| 163 // Whether there is an CompositorFrameSink request pending from the current | 168 // Whether there is an CompositorFrameSink request pending from the current |
| 164 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and | 169 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and |
| 165 // |false| if |host_| is deleted or we succeed in creating *and* initializing | 170 // |false| if |host_| is deleted or we succeed in creating *and* initializing |
| 166 // a CompositorFrameSink (which is essentially the contract with cc). | 171 // a CompositorFrameSink (which is essentially the contract with cc). |
| 167 bool compositor_frame_sink_request_pending_; | 172 bool compositor_frame_sink_request_pending_; |
| 168 | 173 |
| 169 gpu::Capabilities gpu_capabilities_; | 174 gpu::Capabilities gpu_capabilities_; |
| 170 bool has_compositor_frame_sink_ = false; | 175 bool has_compositor_frame_sink_ = false; |
| 171 std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> | 176 std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> |
| 172 pending_child_frame_sink_ids_; | 177 pending_child_frame_sink_ids_; |
| 173 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 178 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
| 174 | 179 |
| 175 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 180 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 176 }; | 181 }; |
| 177 | 182 |
| 178 } // namespace content | 183 } // namespace content |
| 179 | 184 |
| 180 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 185 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |