Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.h

Issue 1371523003: Android: Don't destroy LayerTreeHost when Surface goes away (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/cancelable_callback.h" 9 #include "base/cancelable_callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 25 matching lines...) Expand all
36 namespace content { 36 namespace content {
37 class CompositorClient; 37 class CompositorClient;
38 38
39 // ----------------------------------------------------------------------------- 39 // -----------------------------------------------------------------------------
40 // Browser-side compositor that manages a tree of content and UI layers. 40 // Browser-side compositor that manages a tree of content and UI layers.
41 // ----------------------------------------------------------------------------- 41 // -----------------------------------------------------------------------------
42 class CONTENT_EXPORT CompositorImpl 42 class CONTENT_EXPORT CompositorImpl
43 : public Compositor, 43 : public Compositor,
44 public cc::LayerTreeHostClient, 44 public cc::LayerTreeHostClient,
45 public cc::LayerTreeHostSingleThreadClient, 45 public cc::LayerTreeHostSingleThreadClient,
46 public ui::UIResourceProvider,
46 public ui::WindowAndroidCompositor { 47 public ui::WindowAndroidCompositor {
47 public: 48 public:
48 class VSyncObserver { 49 class VSyncObserver {
49 public: 50 public:
50 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase, 51 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase,
51 base::TimeDelta interval) = 0; 52 base::TimeDelta interval) = 0;
52 }; 53 };
53 54
54 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); 55 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window);
55 ~CompositorImpl() override; 56 ~CompositorImpl() override;
56 57
57 static bool IsInitialized(); 58 static bool IsInitialized();
58 59
59 static cc::SurfaceManager* GetSurfaceManager(); 60 static cc::SurfaceManager* GetSurfaceManager();
60 static scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator(); 61 static scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator();
61 62
62 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); 63 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities);
63 64
64 void AddObserver(VSyncObserver* observer); 65 void AddObserver(VSyncObserver* observer);
65 void RemoveObserver(VSyncObserver* observer); 66 void RemoveObserver(VSyncObserver* observer);
66 67
68 // ui::ResourceProvider implementation.
69 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) final;
jdduke (slow) 2015/09/30 17:19:43 Should this be "final override"? Do we have any gu
no sievers 2015/09/30 21:58:47 Done.
70 void DeleteUIResource(cc::UIResourceId resource_id) final;
71 bool SupportsETC1NonPowerOfTwo() const final;
72
67 private: 73 private:
68 // Compositor implementation. 74 // Compositor implementation.
69 void SetRootLayer(scoped_refptr<cc::Layer> root) override; 75 void SetRootLayer(scoped_refptr<cc::Layer> root) override;
70 void SetSurface(jobject surface) override; 76 void SetSurface(jobject surface) override;
71 void setDeviceScaleFactor(float factor) override; 77 void setDeviceScaleFactor(float factor) override;
72 void SetWindowBounds(const gfx::Size& size) override; 78 void SetWindowBounds(const gfx::Size& size) override;
73 void SetHasTransparentBackground(bool flag) override; 79 void SetHasTransparentBackground(bool flag) override;
74 void SetNeedsComposite() override; 80 void SetNeedsComposite() override;
75 ui::UIResourceProvider& GetUIResourceProvider() override; 81 ui::UIResourceProvider& GetUIResourceProvider() override;
76 ui::ResourceManager& GetResourceManager() override; 82 ui::ResourceManager& GetResourceManager() override;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 155
150 void OnGpuChannelEstablished(); 156 void OnGpuChannelEstablished();
151 void OnGpuChannelTimeout(); 157 void OnGpuChannelTimeout();
152 158
153 // root_layer_ is the persistent internal root layer, while subroot_layer_ 159 // root_layer_ is the persistent internal root layer, while subroot_layer_
154 // is the one attached by the compositor client. 160 // is the one attached by the compositor client.
155 scoped_refptr<cc::Layer> root_layer_; 161 scoped_refptr<cc::Layer> root_layer_;
156 scoped_refptr<cc::Layer> subroot_layer_; 162 scoped_refptr<cc::Layer> subroot_layer_;
157 163
158 scoped_ptr<cc::LayerTreeHost> host_; 164 scoped_ptr<cc::LayerTreeHost> host_;
159 ui::UIResourceProvider ui_resource_provider_;
160 ui::ResourceManagerImpl resource_manager_; 165 ui::ResourceManagerImpl resource_manager_;
161 166
162 scoped_ptr<cc::OnscreenDisplayClient> display_client_; 167 scoped_ptr<cc::OnscreenDisplayClient> display_client_;
163 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; 168 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
164 169
165 gfx::Size size_; 170 gfx::Size size_;
166 bool has_transparent_background_; 171 bool has_transparent_background_;
167 float device_scale_factor_; 172 float device_scale_factor_;
168 173
169 ANativeWindow* window_; 174 ANativeWindow* window_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 base::TimeTicks last_vsync_; 211 base::TimeTicks last_vsync_;
207 212
208 base::OneShotTimer establish_gpu_channel_timeout_; 213 base::OneShotTimer establish_gpu_channel_timeout_;
209 214
210 // Whether there is an OutputSurface request pending from the current 215 // Whether there is an OutputSurface request pending from the current
211 // |host_|. Becomes |true| if RequestNewOutputSurface is called, and |false| 216 // |host_|. Becomes |true| if RequestNewOutputSurface is called, and |false|
212 // if |host_| is deleted or we succeed in creating *and* initializing an 217 // if |host_| is deleted or we succeed in creating *and* initializing an
213 // OutputSurface (which is essentially the contract with cc). 218 // OutputSurface (which is essentially the contract with cc).
214 bool output_surface_request_pending_; 219 bool output_surface_request_pending_;
215 220
221 gpu::Capabilities gpu_capabilities_;
222
216 base::ObserverList<VSyncObserver, true> observer_list_; 223 base::ObserverList<VSyncObserver, true> observer_list_;
217 224
218 base::WeakPtrFactory<CompositorImpl> weak_factory_; 225 base::WeakPtrFactory<CompositorImpl> weak_factory_;
219 226
220 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 227 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
221 }; 228 };
222 229
223 } // namespace content 230 } // namespace content
224 231
225 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 232 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698