Chromium Code Reviews| 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 "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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "cc/trees/layer_tree_host_client.h" | 13 #include "cc/trees/layer_tree_host_client.h" |
| 14 #include "cc/trees/layer_tree_host_single_thread_client.h" | 14 #include "cc/trees/layer_tree_host_single_thread_client.h" |
| 15 #include "content/browser/android/resource_manager_impl.h" | |
| 15 #include "content/browser/android/ui_resource_provider_impl.h" | 16 #include "content/browser/android/ui_resource_provider_impl.h" |
| 16 #include "content/browser/renderer_host/image_transport_factory_android.h" | 17 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/common/gpu/client/context_provider_command_buffer.h" | 19 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 19 #include "content/public/browser/android/compositor.h" | 20 #include "content/public/browser/android/compositor.h" |
| 20 #include "gpu/command_buffer/common/capabilities.h" | 21 #include "gpu/command_buffer/common/capabilities.h" |
| 21 #include "third_party/khronos/GLES2/gl2.h" | 22 #include "third_party/khronos/GLES2/gl2.h" |
| 22 #include "ui/base/android/system_ui_resource_manager.h" | 23 #include "ui/base/android/system_ui_resource_manager.h" |
| 23 #include "ui/base/android/window_android_compositor.h" | 24 #include "ui/base/android/window_android_compositor.h" |
| 24 | 25 |
| 25 class SkBitmap; | 26 class SkBitmap; |
| 26 struct ANativeWindow; | 27 struct ANativeWindow; |
| 27 | 28 |
| 28 namespace cc { | 29 namespace cc { |
| 29 class Layer; | 30 class Layer; |
| 30 class LayerTreeHost; | 31 class LayerTreeHost; |
| 31 class SurfaceIdAllocator; | 32 class SurfaceIdAllocator; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace content { | 35 namespace content { |
| 35 class CompositorClient; | 36 class CompositorClient; |
| 36 class OnscreenDisplayClient; | 37 class OnscreenDisplayClient; |
| 38 class ResourceManager; | |
|
jdduke (slow)
2014/11/19 18:26:48
Nit: We're already including the header, no need t
Jaekyun Seok (inactive)
2014/11/21 12:35:33
Done.
| |
| 37 class UIResourceProvider; | 39 class UIResourceProvider; |
| 38 | 40 |
| 39 // ----------------------------------------------------------------------------- | 41 // ----------------------------------------------------------------------------- |
| 40 // Browser-side compositor that manages a tree of content and UI layers. | 42 // Browser-side compositor that manages a tree of content and UI layers. |
| 41 // ----------------------------------------------------------------------------- | 43 // ----------------------------------------------------------------------------- |
| 42 class CONTENT_EXPORT CompositorImpl | 44 class CONTENT_EXPORT CompositorImpl |
| 43 : public Compositor, | 45 : public Compositor, |
| 44 public cc::LayerTreeHostClient, | 46 public cc::LayerTreeHostClient, |
| 45 public cc::LayerTreeHostSingleThreadClient, | 47 public cc::LayerTreeHostSingleThreadClient, |
| 46 public ImageTransportFactoryAndroidObserver, | 48 public ImageTransportFactoryAndroidObserver, |
| 47 public ui::WindowAndroidCompositor { | 49 public ui::WindowAndroidCompositor { |
| 48 public: | 50 public: |
| 49 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); | 51 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); |
| 50 virtual ~CompositorImpl(); | 52 virtual ~CompositorImpl(); |
| 51 | 53 |
| 52 static bool IsInitialized(); | 54 static bool IsInitialized(); |
| 53 | 55 |
| 54 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); | 56 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 // Compositor implementation. | 59 // Compositor implementation. |
| 58 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) override; | 60 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) override; |
| 59 virtual void SetSurface(jobject surface) override; | 61 virtual void SetSurface(jobject surface) override; |
| 60 virtual void SetVisible(bool visible) override; | 62 virtual void SetVisible(bool visible) override; |
| 61 virtual void setDeviceScaleFactor(float factor) override; | 63 virtual void setDeviceScaleFactor(float factor) override; |
| 62 virtual void SetWindowBounds(const gfx::Size& size) override; | 64 virtual void SetWindowBounds(const gfx::Size& size) override; |
| 63 virtual void SetHasTransparentBackground(bool flag) override; | 65 virtual void SetHasTransparentBackground(bool flag) override; |
| 64 virtual void SetNeedsComposite() override; | 66 virtual void SetNeedsComposite() override; |
| 65 virtual UIResourceProvider& GetUIResourceProvider() override; | 67 virtual UIResourceProvider& GetUIResourceProvider() override; |
| 68 virtual ResourceManager& GetResourceManager() override; | |
| 66 | 69 |
| 67 // LayerTreeHostClient implementation. | 70 // LayerTreeHostClient implementation. |
| 68 virtual void WillBeginMainFrame(int frame_id) override {} | 71 virtual void WillBeginMainFrame(int frame_id) override {} |
| 69 virtual void DidBeginMainFrame() override {} | 72 virtual void DidBeginMainFrame() override {} |
| 70 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override {} | 73 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override {} |
| 71 virtual void Layout() override; | 74 virtual void Layout() override; |
| 72 virtual void ApplyViewportDeltas( | 75 virtual void ApplyViewportDeltas( |
| 73 const gfx::Vector2d& inner_delta, | 76 const gfx::Vector2d& inner_delta, |
| 74 const gfx::Vector2d& outer_delta, | 77 const gfx::Vector2d& outer_delta, |
| 75 float page_scale, | 78 float page_scale, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 } | 139 } |
| 137 void OnGpuChannelEstablished(); | 140 void OnGpuChannelEstablished(); |
| 138 | 141 |
| 139 // root_layer_ is the persistent internal root layer, while subroot_layer_ | 142 // root_layer_ is the persistent internal root layer, while subroot_layer_ |
| 140 // is the one attached by the compositor client. | 143 // is the one attached by the compositor client. |
| 141 scoped_refptr<cc::Layer> root_layer_; | 144 scoped_refptr<cc::Layer> root_layer_; |
| 142 scoped_refptr<cc::Layer> subroot_layer_; | 145 scoped_refptr<cc::Layer> subroot_layer_; |
| 143 | 146 |
| 144 scoped_ptr<cc::LayerTreeHost> host_; | 147 scoped_ptr<cc::LayerTreeHost> host_; |
| 145 content::UIResourceProviderImpl ui_resource_provider_; | 148 content::UIResourceProviderImpl ui_resource_provider_; |
| 149 content::ResourceManagerImpl resource_manager_; | |
| 146 | 150 |
| 147 scoped_ptr<OnscreenDisplayClient> display_client_; | 151 scoped_ptr<OnscreenDisplayClient> display_client_; |
| 148 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 152 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 149 | 153 |
| 150 gfx::Size size_; | 154 gfx::Size size_; |
| 151 bool has_transparent_background_; | 155 bool has_transparent_background_; |
| 152 float device_scale_factor_; | 156 float device_scale_factor_; |
| 153 | 157 |
| 154 ANativeWindow* window_; | 158 ANativeWindow* window_; |
| 155 int surface_id_; | 159 int surface_id_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 base::TimeTicks last_vsync_; | 193 base::TimeTicks last_vsync_; |
| 190 | 194 |
| 191 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 195 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
| 192 | 196 |
| 193 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 197 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 194 }; | 198 }; |
| 195 | 199 |
| 196 } // namespace content | 200 } // namespace content |
| 197 | 201 |
| 198 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 202 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |