| 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" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool WillCompositeThisFrame() const { | 117 bool WillCompositeThisFrame() const { |
| 118 return current_composite_task_ && | 118 return current_composite_task_ && |
| 119 !current_composite_task_->callback().is_null(); | 119 !current_composite_task_->callback().is_null(); |
| 120 } | 120 } |
| 121 bool DidCompositeThisFrame() const { | 121 bool DidCompositeThisFrame() const { |
| 122 return current_composite_task_ && | 122 return current_composite_task_ && |
| 123 current_composite_task_->callback().is_null(); | 123 current_composite_task_->callback().is_null(); |
| 124 } | 124 } |
| 125 bool WillComposite() const { | 125 bool WillComposite() const { |
| 126 return WillCompositeThisFrame() || | 126 return WillCompositeThisFrame() || |
| 127 composite_on_vsync_trigger_ != DO_NOT_COMPOSITE; | 127 composite_on_vsync_trigger_ != DO_NOT_COMPOSITE || |
| 128 defer_composite_for_gpu_channel_; |
| 128 } | 129 } |
| 129 void CancelComposite() { | 130 void CancelComposite() { |
| 130 DCHECK(WillComposite()); | 131 DCHECK(WillComposite()); |
| 131 if (WillCompositeThisFrame()) | 132 if (WillCompositeThisFrame()) |
| 132 current_composite_task_->Cancel(); | 133 current_composite_task_->Cancel(); |
| 133 current_composite_task_.reset(); | 134 current_composite_task_.reset(); |
| 134 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE; | 135 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE; |
| 135 will_composite_immediately_ = false; | 136 will_composite_immediately_ = false; |
| 136 } | 137 } |
| 137 void OnGpuChannelEstablished(); | 138 void OnGpuChannelEstablished(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // How we should schedule Composite during the next vsync. | 179 // How we should schedule Composite during the next vsync. |
| 179 CompositingTrigger composite_on_vsync_trigger_; | 180 CompositingTrigger composite_on_vsync_trigger_; |
| 180 | 181 |
| 181 // The Composite operation scheduled for the current vsync interval. | 182 // The Composite operation scheduled for the current vsync interval. |
| 182 scoped_ptr<base::CancelableClosure> current_composite_task_; | 183 scoped_ptr<base::CancelableClosure> current_composite_task_; |
| 183 | 184 |
| 184 // The number of SwapBuffer calls that have not returned and ACK'd from | 185 // The number of SwapBuffer calls that have not returned and ACK'd from |
| 185 // the GPU thread. | 186 // the GPU thread. |
| 186 unsigned int pending_swapbuffers_; | 187 unsigned int pending_swapbuffers_; |
| 187 | 188 |
| 189 // Whether we are currently deferring a requested Composite operation until |
| 190 // the GPU channel is established (it was either lost or not yet fully |
| 191 // established the first time we tried to composite). |
| 192 bool defer_composite_for_gpu_channel_; |
| 193 |
| 188 base::TimeDelta vsync_period_; | 194 base::TimeDelta vsync_period_; |
| 189 base::TimeTicks last_vsync_; | 195 base::TimeTicks last_vsync_; |
| 190 | 196 |
| 191 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 197 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
| 192 | 198 |
| 193 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 199 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| 194 }; | 200 }; |
| 195 | 201 |
| 196 } // namespace content | 202 } // namespace content |
| 197 | 203 |
| 198 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 204 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
| OLD | NEW |