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" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 // ImageTransportFactoryAndroidObserver implementation. | 98 // ImageTransportFactoryAndroidObserver implementation. |
99 virtual void OnLostResources() OVERRIDE; | 99 virtual void OnLostResources() OVERRIDE; |
100 | 100 |
101 // WindowAndroidCompositor implementation. | 101 // WindowAndroidCompositor implementation. |
102 virtual void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) OVERRIDE; | 102 virtual void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) OVERRIDE; |
103 virtual void RequestCopyOfOutputOnRootLayer( | 103 virtual void RequestCopyOfOutputOnRootLayer( |
104 scoped_ptr<cc::CopyOutputRequest> request) OVERRIDE; | 104 scoped_ptr<cc::CopyOutputRequest> request) OVERRIDE; |
105 virtual void OnVSync(base::TimeTicks frame_time, | 105 virtual void OnVSync(base::TimeTicks frame_time, |
106 base::TimeDelta vsync_period) OVERRIDE; | 106 base::TimeDelta vsync_period) OVERRIDE; |
| 107 virtual void SetNeedsAnimate() OVERRIDE; |
107 | 108 |
108 void PostComposite(base::TimeDelta delay); | |
109 enum CompositingTrigger { | 109 enum CompositingTrigger { |
110 COMPOSITE_IMMEDIATELY, | 110 COMPOSITE_IMMEDIATELY, |
111 COMPOSITE_ON_VSYNC | 111 COMPOSITE_EVENTUALLY, |
112 }; | 112 }; |
| 113 void PostComposite(CompositingTrigger trigger); |
113 void Composite(CompositingTrigger trigger); | 114 void Composite(CompositingTrigger trigger); |
114 cc::UIResourceId GenerateUIResourceFromUIResourceBitmap( | 115 cc::UIResourceId GenerateUIResourceFromUIResourceBitmap( |
115 const cc::UIResourceBitmap& bitmap, | 116 const cc::UIResourceBitmap& bitmap, |
116 bool is_transient); | 117 bool is_transient); |
117 | 118 |
118 scoped_refptr<cc::Layer> root_layer_; | 119 scoped_refptr<cc::Layer> root_layer_; |
119 scoped_ptr<cc::LayerTreeHost> host_; | 120 scoped_ptr<cc::LayerTreeHost> host_; |
120 | 121 |
121 gfx::Size size_; | 122 gfx::Size size_; |
122 bool has_transparent_background_; | 123 bool has_transparent_background_; |
(...skipping 14 matching lines...) Expand all Loading... |
137 // a posted SwapBuffers(). | 138 // a posted SwapBuffers(). |
138 bool did_post_swapbuffers_; | 139 bool did_post_swapbuffers_; |
139 | 140 |
140 // Used locally to inhibit ScheduleComposite() during Layout(). | 141 // Used locally to inhibit ScheduleComposite() during Layout(). |
141 bool ignore_schedule_composite_; | 142 bool ignore_schedule_composite_; |
142 | 143 |
143 // Whether we need to composite in general because of any invalidation or | 144 // Whether we need to composite in general because of any invalidation or |
144 // explicit request. | 145 // explicit request. |
145 bool needs_composite_; | 146 bool needs_composite_; |
146 | 147 |
147 // When SetNeedsComposite() is getting called, we will try to schedule | 148 // Whether we need to update animations on the next composite. |
148 // regularly during vsync. | 149 bool needs_animate_; |
149 bool should_composite_on_vsync_; | 150 |
| 151 // Whether we posted a task and are about to composite. |
| 152 bool will_composite_immediately_; |
| 153 |
| 154 // Whether we will composite during the next suitable deadline. |
| 155 bool will_composite_eventually_; |
150 | 156 |
151 // Whether we composited already in the current vsync interval. | 157 // Whether we composited already in the current vsync interval. |
152 bool did_composite_this_frame_; | 158 bool did_composite_this_frame_; |
153 | 159 |
154 // The number of SwapBuffer calls that have not returned and ACK'd from | 160 // The number of SwapBuffer calls that have not returned and ACK'd from |
155 // the GPU thread. | 161 // the GPU thread. |
156 unsigned int pending_swapbuffers_; | 162 unsigned int pending_swapbuffers_; |
157 | 163 |
158 base::TimeDelta vsync_period_; | 164 base::TimeDelta vsync_period_; |
| 165 base::TimeTicks last_vsync_; |
159 | 166 |
160 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 167 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
161 | 168 |
162 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 169 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
163 }; | 170 }; |
164 | 171 |
165 } // namespace content | 172 } // namespace content |
166 | 173 |
167 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 174 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
OLD | NEW |