| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 public: | 56 public: |
| 57 virtual void OnVSync(base::TimeTicks timebase, | 57 virtual void OnVSync(base::TimeTicks timebase, |
| 58 base::TimeDelta interval) = 0; | 58 base::TimeDelta interval) = 0; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); | 61 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); |
| 62 ~CompositorImpl() override; | 62 ~CompositorImpl() override; |
| 63 | 63 |
| 64 static bool IsInitialized(); | 64 static bool IsInitialized(); |
| 65 | 65 |
| 66 static cc::SurfaceManager* GetSurfaceManager(); | |
| 67 static uint32_t AllocateSurfaceClientId(); | |
| 68 | |
| 69 static scoped_refptr<cc::VulkanInProcessContextProvider> | |
| 70 SharedVulkanContextProviderAndroid(); | |
| 71 | |
| 72 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); | 66 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); |
| 73 | 67 |
| 74 void AddObserver(VSyncObserver* observer); | 68 void AddObserver(VSyncObserver* observer); |
| 75 void RemoveObserver(VSyncObserver* observer); | 69 void RemoveObserver(VSyncObserver* observer); |
| 76 void OnNeedsBeginFramesChange(bool needs_begin_frames); | 70 void OnNeedsBeginFramesChange(bool needs_begin_frames); |
| 77 | 71 |
| 78 // ui::ResourceProvider implementation. | 72 // ui::ResourceProvider implementation. |
| 79 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; | 73 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; |
| 80 void DeleteUIResource(cc::UIResourceId resource_id) override; | 74 void DeleteUIResource(cc::UIResourceId resource_id) override; |
| 81 bool SupportsETC1NonPowerOfTwo() const override; | 75 bool SupportsETC1NonPowerOfTwo() const override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void DidPostSwapBuffers() override; | 109 void DidPostSwapBuffers() override; |
| 116 void DidAbortSwapBuffers() override; | 110 void DidAbortSwapBuffers() override; |
| 117 | 111 |
| 118 // WindowAndroidCompositor implementation. | 112 // WindowAndroidCompositor implementation. |
| 119 void RequestCopyOfOutputOnRootLayer( | 113 void RequestCopyOfOutputOnRootLayer( |
| 120 std::unique_ptr<cc::CopyOutputRequest> request) override; | 114 std::unique_ptr<cc::CopyOutputRequest> request) override; |
| 121 void OnVSync(base::TimeTicks frame_time, | 115 void OnVSync(base::TimeTicks frame_time, |
| 122 base::TimeDelta vsync_period) override; | 116 base::TimeDelta vsync_period) override; |
| 123 void SetNeedsAnimate() override; | 117 void SetNeedsAnimate() override; |
| 124 void SetVisible(bool visible); | 118 void SetVisible(bool visible); |
| 125 void CreateOutputSurface(); | 119 void CreateOutputSurface(scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| 126 void CreateLayerTreeHost(); | 120 void CreateLayerTreeHost(); |
| 127 | 121 |
| 128 void OnGpuChannelEstablished(); | 122 void OnGpuChannelEstablished( |
| 129 void OnGpuChannelTimeout(); | 123 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| 130 | 124 |
| 131 // root_layer_ is the persistent internal root layer, while subroot_layer_ | 125 // root_layer_ is the persistent internal root layer, while subroot_layer_ |
| 132 // is the one attached by the compositor client. | 126 // is the one attached by the compositor client. |
| 133 scoped_refptr<cc::Layer> subroot_layer_; | 127 scoped_refptr<cc::Layer> subroot_layer_; |
| 134 | 128 |
| 135 // Destruction order matters here: | 129 // Destruction order matters here: |
| 136 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 130 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 137 base::ObserverList<VSyncObserver, true> observer_list_; | 131 base::ObserverList<VSyncObserver, true> observer_list_; |
| 138 std::unique_ptr<cc::LayerTreeHost> host_; | 132 std::unique_ptr<cc::LayerTreeHost> host_; |
| 139 ui::ResourceManagerImpl resource_manager_; | 133 ui::ResourceManagerImpl resource_manager_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 153 | 147 |
| 154 // Whether we need to update animations on the next composite. | 148 // Whether we need to update animations on the next composite. |
| 155 bool needs_animate_; | 149 bool needs_animate_; |
| 156 | 150 |
| 157 // The number of SwapBuffer calls that have not returned and ACK'd from | 151 // The number of SwapBuffer calls that have not returned and ACK'd from |
| 158 // the GPU thread. | 152 // the GPU thread. |
| 159 unsigned int pending_swapbuffers_; | 153 unsigned int pending_swapbuffers_; |
| 160 | 154 |
| 161 size_t num_successive_context_creation_failures_; | 155 size_t num_successive_context_creation_failures_; |
| 162 | 156 |
| 163 base::OneShotTimer establish_gpu_channel_timeout_; | |
| 164 | |
| 165 // Whether there is an OutputSurface request pending from the current | 157 // Whether there is an OutputSurface request pending from the current |
| 166 // |host_|. Becomes |true| if RequestNewOutputSurface is called, and |false| | 158 // |host_|. Becomes |true| if RequestNewOutputSurface is called, and |false| |
| 167 // if |host_| is deleted or we succeed in creating *and* initializing an | 159 // if |host_| is deleted or we succeed in creating *and* initializing an |
| 168 // OutputSurface (which is essentially the contract with cc). | 160 // OutputSurface (which is essentially the contract with cc). |
| 169 bool output_surface_request_pending_; | 161 bool output_surface_request_pending_; |
| 170 | 162 |
| 171 gpu::Capabilities gpu_capabilities_; | 163 gpu::Capabilities gpu_capabilities_; |
| 172 bool needs_begin_frames_; | 164 bool needs_begin_frames_; |
| 173 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 165 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
| 174 | 166 |
| 175 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 167 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 176 }; | 168 }; |
| 177 | 169 |
| 178 } // namespace content | 170 } // namespace content |
| 179 | 171 |
| 180 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 172 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |