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 "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "cc/resources/ui_resource_client.h" | 14 #include "cc/resources/ui_resource_client.h" |
15 #include "cc/trees/layer_tree_host_client.h" | 15 #include "cc/trees/layer_tree_host_client.h" |
16 #include "cc/trees/layer_tree_host_single_thread_client.h" | 16 #include "cc/trees/layer_tree_host_single_thread_client.h" |
17 #include "content/browser/android/ui_resource_provider_impl.h" | 17 #include "content/browser/android/ui_resource_provider_impl.h" |
18 #include "content/browser/renderer_host/image_transport_factory_android.h" | 18 #include "content/browser/renderer_host/image_transport_factory_android.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/public/browser/android/compositor.h" | 20 #include "content/public/browser/android/compositor.h" |
21 #include "third_party/khronos/GLES2/gl2.h" | 21 #include "third_party/khronos/GLES2/gl2.h" |
22 #include "ui/base/android/window_android_compositor.h" | 22 #include "ui/base/android/window_android_compositor.h" |
23 | 23 |
24 class SkBitmap; | 24 class SkBitmap; |
25 struct ANativeWindow; | 25 struct ANativeWindow; |
26 | 26 |
27 namespace cc { | 27 namespace cc { |
| 28 class BeginFrameManager; |
28 class Layer; | 29 class Layer; |
29 class LayerTreeHost; | 30 class LayerTreeHost; |
30 } | 31 } |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 class CompositorClient; | 34 class CompositorClient; |
34 class UIResourceProvider; | 35 class UIResourceProvider; |
35 | 36 |
36 // ----------------------------------------------------------------------------- | 37 // ----------------------------------------------------------------------------- |
37 // 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. |
(...skipping 10 matching lines...) Expand all Loading... |
48 | 49 |
49 static bool IsInitialized(); | 50 static bool IsInitialized(); |
50 | 51 |
51 // Creates a surface texture and returns a surface texture id. Returns -1 on | 52 // Creates a surface texture and returns a surface texture id. Returns -1 on |
52 // failure. | 53 // failure. |
53 static int CreateSurfaceTexture(int child_process_id); | 54 static int CreateSurfaceTexture(int child_process_id); |
54 | 55 |
55 // Destroy all surface textures associated with |child_process_id|. | 56 // Destroy all surface textures associated with |child_process_id|. |
56 static void DestroyAllSurfaceTextures(int child_process_id); | 57 static void DestroyAllSurfaceTextures(int child_process_id); |
57 | 58 |
| 59 cc::BeginFrameManager* begin_frame_manager() { |
| 60 return begin_frame_manager_.get(); |
| 61 } |
| 62 |
58 private: | 63 private: |
59 // Compositor implementation. | 64 // Compositor implementation. |
60 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; | 65 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; |
61 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | 66 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; |
62 virtual void SetSurface(jobject surface) OVERRIDE; | 67 virtual void SetSurface(jobject surface) OVERRIDE; |
63 virtual void SetVisible(bool visible) OVERRIDE; | 68 virtual void SetVisible(bool visible) OVERRIDE; |
64 virtual void setDeviceScaleFactor(float factor) OVERRIDE; | 69 virtual void setDeviceScaleFactor(float factor) OVERRIDE; |
65 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; | 70 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; |
66 virtual void SetHasTransparentBackground(bool flag) OVERRIDE; | 71 virtual void SetHasTransparentBackground(bool flag) OVERRIDE; |
67 virtual void SetNeedsComposite() OVERRIDE; | 72 virtual void SetNeedsComposite() OVERRIDE; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // The Composite operation scheduled for the current vsync interval. | 179 // The Composite operation scheduled for the current vsync interval. |
175 scoped_ptr<base::CancelableClosure> current_composite_task_; | 180 scoped_ptr<base::CancelableClosure> current_composite_task_; |
176 | 181 |
177 // The number of SwapBuffer calls that have not returned and ACK'd from | 182 // The number of SwapBuffer calls that have not returned and ACK'd from |
178 // the GPU thread. | 183 // the GPU thread. |
179 unsigned int pending_swapbuffers_; | 184 unsigned int pending_swapbuffers_; |
180 | 185 |
181 base::TimeDelta vsync_period_; | 186 base::TimeDelta vsync_period_; |
182 base::TimeTicks last_vsync_; | 187 base::TimeTicks last_vsync_; |
183 | 188 |
| 189 scoped_ptr<cc::BeginFrameManager> begin_frame_manager_; |
| 190 |
184 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 191 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
185 | 192 |
186 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 193 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
187 }; | 194 }; |
188 | 195 |
189 } // namespace content | 196 } // namespace content |
190 | 197 |
191 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 198 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
OLD | NEW |