| 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/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_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 "cc/trees/layer_tree_host_single_thread_client.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/public/browser/android/compositor.h" | 19 #include "content/public/browser/android/compositor.h" |
| 19 #include "third_party/khronos/GLES2/gl2.h" | 20 #include "third_party/khronos/GLES2/gl2.h" |
| 20 #include "ui/base/android/window_android_compositor.h" | 21 #include "ui/base/android/window_android_compositor.h" |
| 21 | 22 |
| 22 class SkBitmap; | 23 class SkBitmap; |
| 23 struct ANativeWindow; | 24 struct ANativeWindow; |
| 24 | 25 |
| 25 namespace cc { | 26 namespace cc { |
| 26 class InputHandlerClient; | 27 class InputHandlerClient; |
| 27 class Layer; | 28 class Layer; |
| 28 class LayerTreeHost; | 29 class LayerTreeHost; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace content { | 32 namespace content { |
| 32 class CompositorClient; | 33 class CompositorClient; |
| 33 class GraphicsContext; | 34 class GraphicsContext; |
| 35 class UIResourceProvider; |
| 34 | 36 |
| 35 // ----------------------------------------------------------------------------- | 37 // ----------------------------------------------------------------------------- |
| 36 // 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. |
| 37 // ----------------------------------------------------------------------------- | 39 // ----------------------------------------------------------------------------- |
| 38 class CONTENT_EXPORT CompositorImpl | 40 class CONTENT_EXPORT CompositorImpl |
| 39 : public Compositor, | 41 : public Compositor, |
| 40 public cc::LayerTreeHostClient, | 42 public cc::LayerTreeHostClient, |
| 41 public cc::LayerTreeHostSingleThreadClient, | 43 public cc::LayerTreeHostSingleThreadClient, |
| 42 public ImageTransportFactoryAndroidObserver, | 44 public ImageTransportFactoryAndroidObserver, |
| 43 public ui::WindowAndroidCompositor { | 45 public ui::WindowAndroidCompositor { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 private: | 59 private: |
| 58 // Compositor implementation. | 60 // Compositor implementation. |
| 59 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; | 61 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; |
| 60 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | 62 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; |
| 61 virtual void SetSurface(jobject surface) OVERRIDE; | 63 virtual void SetSurface(jobject surface) OVERRIDE; |
| 62 virtual void SetVisible(bool visible) OVERRIDE; | 64 virtual void SetVisible(bool visible) OVERRIDE; |
| 63 virtual void setDeviceScaleFactor(float factor) OVERRIDE; | 65 virtual void setDeviceScaleFactor(float factor) OVERRIDE; |
| 64 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; | 66 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; |
| 65 virtual void SetHasTransparentBackground(bool flag) OVERRIDE; | 67 virtual void SetHasTransparentBackground(bool flag) OVERRIDE; |
| 66 virtual void SetNeedsComposite() OVERRIDE; | 68 virtual void SetNeedsComposite() OVERRIDE; |
| 67 virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap, | 69 virtual UIResourceProvider& GetUIResourceProvider() OVERRIDE; |
| 68 bool is_transient) OVERRIDE; | |
| 69 virtual cc::UIResourceId GenerateCompressedUIResource(const gfx::Size& size, | |
| 70 void* pixels, | |
| 71 bool is_transient) | |
| 72 OVERRIDE; | |
| 73 virtual void DeleteUIResource(cc::UIResourceId resource_id) OVERRIDE; | |
| 74 | 70 |
| 75 // LayerTreeHostClient implementation. | 71 // LayerTreeHostClient implementation. |
| 76 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} | 72 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} |
| 77 virtual void DidBeginMainFrame() OVERRIDE {} | 73 virtual void DidBeginMainFrame() OVERRIDE {} |
| 78 virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {} | 74 virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {} |
| 79 virtual void Layout() OVERRIDE; | 75 virtual void Layout() OVERRIDE; |
| 80 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, | 76 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, |
| 81 float page_scale) OVERRIDE {} | 77 float page_scale) OVERRIDE {} |
| 82 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) | 78 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) |
| 83 OVERRIDE; | 79 OVERRIDE; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 current_composite_task_.reset(); | 127 current_composite_task_.reset(); |
| 132 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE; | 128 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE; |
| 133 will_composite_immediately_ = false; | 129 will_composite_immediately_ = false; |
| 134 } | 130 } |
| 135 cc::UIResourceId GenerateUIResourceFromUIResourceBitmap( | 131 cc::UIResourceId GenerateUIResourceFromUIResourceBitmap( |
| 136 const cc::UIResourceBitmap& bitmap, | 132 const cc::UIResourceBitmap& bitmap, |
| 137 bool is_transient); | 133 bool is_transient); |
| 138 | 134 |
| 139 scoped_refptr<cc::Layer> root_layer_; | 135 scoped_refptr<cc::Layer> root_layer_; |
| 140 scoped_ptr<cc::LayerTreeHost> host_; | 136 scoped_ptr<cc::LayerTreeHost> host_; |
| 137 content::UIResourceProviderImpl ui_resource_provider_; |
| 141 | 138 |
| 142 gfx::Size size_; | 139 gfx::Size size_; |
| 143 bool has_transparent_background_; | 140 bool has_transparent_background_; |
| 144 float device_scale_factor_; | 141 float device_scale_factor_; |
| 145 | 142 |
| 146 ANativeWindow* window_; | 143 ANativeWindow* window_; |
| 147 int surface_id_; | 144 int surface_id_; |
| 148 | 145 |
| 149 CompositorClient* client_; | 146 CompositorClient* client_; |
| 150 | 147 |
| 151 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::UIResourceClient> | |
| 152 UIResourceMap; | |
| 153 UIResourceMap ui_resource_map_; | |
| 154 | |
| 155 gfx::NativeWindow root_window_; | 148 gfx::NativeWindow root_window_; |
| 156 | 149 |
| 157 // Used locally to track whether a call to LTH::Composite() did result in | 150 // Used locally to track whether a call to LTH::Composite() did result in |
| 158 // a posted SwapBuffers(). | 151 // a posted SwapBuffers(). |
| 159 bool did_post_swapbuffers_; | 152 bool did_post_swapbuffers_; |
| 160 | 153 |
| 161 // Used locally to inhibit ScheduleComposite() during Layout(). | 154 // Used locally to inhibit ScheduleComposite() during Layout(). |
| 162 bool ignore_schedule_composite_; | 155 bool ignore_schedule_composite_; |
| 163 | 156 |
| 164 // Whether we need to composite in general because of any invalidation or | 157 // Whether we need to composite in general because of any invalidation or |
| (...skipping 18 matching lines...) Expand all Loading... |
| 183 | 176 |
| 184 base::TimeDelta vsync_period_; | 177 base::TimeDelta vsync_period_; |
| 185 base::TimeTicks last_vsync_; | 178 base::TimeTicks last_vsync_; |
| 186 | 179 |
| 187 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 180 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 188 }; | 181 }; |
| 189 | 182 |
| 190 } // namespace content | 183 } // namespace content |
| 191 | 184 |
| 192 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 185 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |