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/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 "cc/resources/ui_resource_client.h" | 12 #include "cc/resources/ui_resource_client.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/renderer_host/image_transport_factory_android.h" | 15 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 17 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 18 #include "content/public/browser/android/compositor.h" | 18 #include "content/public/browser/android/compositor.h" |
| 19 | 19 |
| 20 struct ANativeWindow; | 20 struct ANativeWindow; |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 class InputHandlerClient; | 23 class InputHandlerClient; |
| 24 class Layer; | 24 class Layer; |
| 25 class LayerTreeHost; | 25 class LayerTreeHost; |
| 26 class ScopedUIResource; | 26 class ScopedUIResource; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace ui { | |
| 30 class WindowAndroid; | |
| 31 } | |
| 32 | |
| 29 namespace content { | 33 namespace content { |
| 30 class CompositorClient; | 34 class CompositorClient; |
| 31 class GraphicsContext; | 35 class GraphicsContext; |
| 32 | 36 |
| 33 // ----------------------------------------------------------------------------- | 37 // ----------------------------------------------------------------------------- |
| 34 // Browser-side compositor that manages a tree of content and UI layers. | 38 // Browser-side compositor that manages a tree of content and UI layers. |
| 35 // ----------------------------------------------------------------------------- | 39 // ----------------------------------------------------------------------------- |
| 36 class CONTENT_EXPORT CompositorImpl | 40 class CONTENT_EXPORT CompositorImpl |
| 37 : public Compositor, | 41 : public Compositor, |
| 38 public cc::LayerTreeHostClient, | 42 public cc::LayerTreeHostClient, |
| 39 public cc::LayerTreeHostSingleThreadClient, | 43 public cc::LayerTreeHostSingleThreadClient, |
| 40 public ImageTransportFactoryAndroidObserver { | 44 public ImageTransportFactoryAndroidObserver { |
| 41 public: | 45 public: |
| 42 explicit CompositorImpl(CompositorClient* client); | 46 CompositorImpl(CompositorClient* client, ui::WindowAndroid* window_android); |
| 43 virtual ~CompositorImpl(); | 47 virtual ~CompositorImpl(); |
| 44 | 48 |
| 45 static bool IsInitialized(); | 49 static bool IsInitialized(); |
| 46 | 50 |
| 47 // Returns the Java Surface object for a given view surface id. | 51 // Returns the Java Surface object for a given view surface id. |
| 48 static jobject GetSurface(int surface_id); | 52 static jobject GetSurface(int surface_id); |
| 49 | 53 |
| 50 // Compositor implementation. | 54 // Compositor implementation. |
| 51 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; | 55 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; |
| 52 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | 56 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 74 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} | 78 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} |
| 75 virtual void DidBeginMainFrame() OVERRIDE {} | 79 virtual void DidBeginMainFrame() OVERRIDE {} |
| 76 virtual void Animate(double frame_begin_time) OVERRIDE {} | 80 virtual void Animate(double frame_begin_time) OVERRIDE {} |
| 77 virtual void Layout() OVERRIDE {} | 81 virtual void Layout() OVERRIDE {} |
| 78 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 82 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| 79 float page_scale) OVERRIDE {} | 83 float page_scale) OVERRIDE {} |
| 80 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) | 84 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) |
| 81 OVERRIDE; | 85 OVERRIDE; |
| 82 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} | 86 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} |
| 83 virtual void WillCommit() OVERRIDE {} | 87 virtual void WillCommit() OVERRIDE {} |
| 84 virtual void DidCommit() OVERRIDE {} | 88 virtual void DidCommit() OVERRIDE; |
| 85 virtual void DidCommitAndDrawFrame() OVERRIDE {} | 89 virtual void DidCommitAndDrawFrame() OVERRIDE {} |
| 86 virtual void DidCompleteSwapBuffers() OVERRIDE; | 90 virtual void DidCompleteSwapBuffers() OVERRIDE; |
| 87 virtual scoped_refptr<cc::ContextProvider> | 91 virtual scoped_refptr<cc::ContextProvider> |
| 88 OffscreenContextProvider() OVERRIDE; | 92 OffscreenContextProvider() OVERRIDE; |
| 89 | 93 |
| 90 // LayerTreeHostSingleThreadClient implementation. | 94 // LayerTreeHostSingleThreadClient implementation. |
| 91 virtual void ScheduleComposite() OVERRIDE; | 95 virtual void ScheduleComposite() OVERRIDE; |
| 92 virtual void DidPostSwapBuffers() OVERRIDE; | 96 virtual void DidPostSwapBuffers() OVERRIDE; |
| 93 virtual void DidAbortSwapBuffers() OVERRIDE; | 97 virtual void DidAbortSwapBuffers() OVERRIDE; |
| 94 | 98 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 110 int surface_id_; | 114 int surface_id_; |
| 111 | 115 |
| 112 CompositorClient* client_; | 116 CompositorClient* client_; |
| 113 | 117 |
| 114 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_; | 118 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_; |
| 115 | 119 |
| 116 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> | 120 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> |
| 117 UIResourceMap; | 121 UIResourceMap; |
| 118 UIResourceMap ui_resource_map_; | 122 UIResourceMap ui_resource_map_; |
| 119 | 123 |
| 124 ui::WindowAndroid* window_android_; | |
|
no sievers
2013/11/14 22:01:01
nit: maybe call it |root_window_| or so?
powei
2013/11/15 02:18:26
Done.
| |
| 125 | |
| 120 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 126 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } // namespace content | 129 } // namespace content |
| 124 | 130 |
| 125 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 131 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |