| 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.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/resources/ui_resource_client.h" | 13 #include "cc/resources/ui_resource_client.h" |
| 14 #include "cc/trees/layer_tree_host_client.h" | 14 #include "cc/trees/layer_tree_host_client.h" |
| 15 #include "cc/trees/layer_tree_host_single_thread_client.h" |
| 15 #include "content/browser/renderer_host/image_transport_factory_android.h" | 16 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 17 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 18 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 18 #include "content/public/browser/android/compositor.h" | 19 #include "content/public/browser/android/compositor.h" |
| 19 | 20 |
| 20 struct ANativeWindow; | 21 struct ANativeWindow; |
| 21 | 22 |
| 22 namespace cc { | 23 namespace cc { |
| 23 class InputHandlerClient; | 24 class InputHandlerClient; |
| 24 class Layer; | 25 class Layer; |
| 25 class LayerTreeHost; | 26 class LayerTreeHost; |
| 26 class ScopedUIResource; | 27 class ScopedUIResource; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 class CompositorClient; | 31 class CompositorClient; |
| 31 class GraphicsContext; | 32 class GraphicsContext; |
| 32 | 33 |
| 33 // ----------------------------------------------------------------------------- | 34 // ----------------------------------------------------------------------------- |
| 34 // Browser-side compositor that manages a tree of content and UI layers. | 35 // Browser-side compositor that manages a tree of content and UI layers. |
| 35 // ----------------------------------------------------------------------------- | 36 // ----------------------------------------------------------------------------- |
| 36 class CONTENT_EXPORT CompositorImpl | 37 class CONTENT_EXPORT CompositorImpl |
| 37 : public Compositor, | 38 : public Compositor, |
| 38 public cc::LayerTreeHostClient, | 39 public cc::LayerTreeHostClient, |
| 40 public cc::LayerTreeHostSingleThreadClient, |
| 39 public WebGraphicsContext3DSwapBuffersClient, | 41 public WebGraphicsContext3DSwapBuffersClient, |
| 40 public ImageTransportFactoryAndroidObserver { | 42 public ImageTransportFactoryAndroidObserver { |
| 41 public: | 43 public: |
| 42 explicit CompositorImpl(CompositorClient* client); | 44 explicit CompositorImpl(CompositorClient* client); |
| 43 virtual ~CompositorImpl(); | 45 virtual ~CompositorImpl(); |
| 44 | 46 |
| 45 static bool IsInitialized(); | 47 static bool IsInitialized(); |
| 46 static bool IsThreadingEnabled(); | |
| 47 | 48 |
| 48 // Returns the Java Surface object for a given view surface id. | 49 // Returns the Java Surface object for a given view surface id. |
| 49 static jobject GetSurface(int surface_id); | 50 static jobject GetSurface(int surface_id); |
| 50 | 51 |
| 51 // Compositor implementation. | 52 // Compositor implementation. |
| 52 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; | 53 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; |
| 53 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | 54 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; |
| 54 virtual void SetSurface(jobject surface) OVERRIDE; | 55 virtual void SetSurface(jobject surface) OVERRIDE; |
| 55 virtual void SetVisible(bool visible) OVERRIDE; | 56 virtual void SetVisible(bool visible) OVERRIDE; |
| 56 virtual void setDeviceScaleFactor(float factor) OVERRIDE; | 57 virtual void setDeviceScaleFactor(float factor) OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 78 virtual void Layout() OVERRIDE {} | 79 virtual void Layout() OVERRIDE {} |
| 79 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 80 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| 80 float page_scale) OVERRIDE {} | 81 float page_scale) OVERRIDE {} |
| 81 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) | 82 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) |
| 82 OVERRIDE; | 83 OVERRIDE; |
| 83 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} | 84 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} |
| 84 virtual void WillCommit() OVERRIDE {} | 85 virtual void WillCommit() OVERRIDE {} |
| 85 virtual void DidCommit() OVERRIDE {} | 86 virtual void DidCommit() OVERRIDE {} |
| 86 virtual void DidCommitAndDrawFrame() OVERRIDE {} | 87 virtual void DidCommitAndDrawFrame() OVERRIDE {} |
| 87 virtual void DidCompleteSwapBuffers() OVERRIDE; | 88 virtual void DidCompleteSwapBuffers() OVERRIDE; |
| 88 virtual void ScheduleComposite() OVERRIDE; | |
| 89 virtual scoped_refptr<cc::ContextProvider> | 89 virtual scoped_refptr<cc::ContextProvider> |
| 90 OffscreenContextProvider() OVERRIDE; | 90 OffscreenContextProvider() OVERRIDE; |
| 91 | 91 |
| 92 // LayerTreeHostSingleThreadClient implementation. |
| 93 virtual void ScheduleComposite() OVERRIDE; |
| 94 virtual void DidPostSwapBuffers() OVERRIDE {} |
| 95 virtual void DidAbortSwapBuffers() OVERRIDE {} |
| 96 |
| 92 // WebGraphicsContext3DSwapBuffersClient implementation. | 97 // WebGraphicsContext3DSwapBuffersClient implementation. |
| 93 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; | 98 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; |
| 94 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; | 99 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; |
| 95 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; | 100 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; |
| 96 | 101 |
| 97 // ImageTransportFactoryAndroidObserver implementation. | 102 // ImageTransportFactoryAndroidObserver implementation. |
| 98 virtual void OnLostResources() OVERRIDE; | 103 virtual void OnLostResources() OVERRIDE; |
| 99 | 104 |
| 100 private: | 105 private: |
| 101 WebKit::WebGLId BuildBasicTexture(); | 106 WebKit::WebGLId BuildBasicTexture(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 119 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> | 124 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> |
| 120 UIResourceMap; | 125 UIResourceMap; |
| 121 UIResourceMap ui_resource_map_; | 126 UIResourceMap ui_resource_map_; |
| 122 | 127 |
| 123 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 128 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 124 }; | 129 }; |
| 125 | 130 |
| 126 } // namespace content | 131 } // namespace content |
| 127 | 132 |
| 128 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 133 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |