| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| 7 | 7 |
| 8 #include "android_webview/browser/parent_compositor_draw_constraints.h" | 8 #include "android_webview/browser/parent_compositor_draw_constraints.h" |
| 9 #include "android_webview/browser/shared_renderer_state.h" | 9 #include "android_webview/browser/shared_renderer_state.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const gfx::SizeF& scrollable_size_dip, | 102 const gfx::SizeF& scrollable_size_dip, |
| 103 float page_scale_factor, | 103 float page_scale_factor, |
| 104 float min_page_scale_factor, | 104 float min_page_scale_factor, |
| 105 float max_page_scale_factor) override; | 105 float max_page_scale_factor) override; |
| 106 bool IsExternalFlingActive() const override; | 106 bool IsExternalFlingActive() const override; |
| 107 void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 107 void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
| 108 gfx::Vector2dF latest_overscroll_delta, | 108 gfx::Vector2dF latest_overscroll_delta, |
| 109 gfx::Vector2dF current_fling_velocity) override; | 109 gfx::Vector2dF current_fling_velocity) override; |
| 110 | 110 |
| 111 void UpdateParentDrawConstraints(); | 111 void UpdateParentDrawConstraints(); |
| 112 void DidSkipCommitFrame(); | |
| 113 void DetachFunctorFromView(); | 112 void DetachFunctorFromView(); |
| 114 | 113 |
| 115 private: | 114 private: |
| 116 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); | 115 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); |
| 117 bool CanOnDraw(); | 116 bool CanOnDraw(); |
| 118 // Checks the continuous invalidate and block invalidate state, and schedule | 117 // Checks the continuous invalidate and block invalidate state, and schedule |
| 119 // invalidates appropriately. If |force_invalidate| is true, then send a view | 118 // invalidates appropriately. If |force_invalidate| is true, then send a view |
| 120 // invalidate regardless of compositor expectation. If |skip_reschedule_tick| | 119 // invalidate regardless of compositor expectation. |
| 121 // is true and if there is already a pending fallback tick, don't reschedule | 120 void EnsureContinuousInvalidation(bool force_invalidate); |
| 122 // them. | |
| 123 void EnsureContinuousInvalidation(bool force_invalidate, | |
| 124 bool skip_reschedule_tick); | |
| 125 bool CompositeSW(SkCanvas* canvas); | 121 bool CompositeSW(SkCanvas* canvas); |
| 126 void DidComposite(); | 122 void DidComposite(); |
| 127 void DidSkipCompositeInDraw(); | |
| 128 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 123 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 129 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, | 124 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, |
| 130 const gfx::SizeF& scrollable_size_dip); | 125 const gfx::SizeF& scrollable_size_dip); |
| 131 | 126 |
| 132 scoped_ptr<cc::CompositorFrame> CompositeHw(); | 127 bool CompositeHw(); |
| 133 void ReturnUnusedResource(scoped_ptr<cc::CompositorFrame> frame); | 128 void ReturnUnusedResource(scoped_ptr<cc::CompositorFrame> frame); |
| 134 void ReturnResourceFromParent(); | 129 void ReturnResourceFromParent(); |
| 135 | 130 |
| 136 // If we call up view invalidate and OnDraw is not called before a deadline, | 131 // If we call up view invalidate and OnDraw is not called before a deadline, |
| 137 // then we keep ticking the SynchronousCompositor so it can make progress. | 132 // then we keep ticking the SynchronousCompositor so it can make progress. |
| 138 // Do this in a two stage tick due to native MessageLoop favors delayed task, | 133 // Do this in a two stage tick due to native MessageLoop favors delayed task, |
| 139 // so ensure delayed task is inserted only after the draw task returns. | 134 // so ensure delayed task is inserted only after the draw task returns. |
| 140 void PostFallbackTick(); | 135 void PostFallbackTick(); |
| 141 void FallbackTickFired(); | 136 void FallbackTickFired(); |
| 142 | 137 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // The draw constraints from the parent compositor. These are only used for | 171 // The draw constraints from the parent compositor. These are only used for |
| 177 // tiling priority. | 172 // tiling priority. |
| 178 ParentCompositorDrawConstraints parent_draw_constraints_; | 173 ParentCompositorDrawConstraints parent_draw_constraints_; |
| 179 | 174 |
| 180 // When true, we should continuously invalidate and keep drawing, for example | 175 // When true, we should continuously invalidate and keep drawing, for example |
| 181 // to drive animation. This value is set by the compositor and should always | 176 // to drive animation. This value is set by the compositor and should always |
| 182 // reflect the expectation of the compositor and not be reused for other | 177 // reflect the expectation of the compositor and not be reused for other |
| 183 // states. | 178 // states. |
| 184 bool compositor_needs_continuous_invalidate_; | 179 bool compositor_needs_continuous_invalidate_; |
| 185 | 180 |
| 186 bool invalidate_after_composite_; | |
| 187 | |
| 188 // Used to block additional invalidates while one is already pending. | 181 // Used to block additional invalidates while one is already pending. |
| 189 bool block_invalidates_; | 182 bool block_invalidates_; |
| 190 | 183 |
| 191 base::CancelableClosure post_fallback_tick_; | 184 base::CancelableClosure post_fallback_tick_; |
| 192 base::CancelableClosure fallback_tick_fired_; | 185 base::CancelableClosure fallback_tick_fired_; |
| 193 bool fallback_tick_pending_; | 186 bool fallback_tick_pending_; |
| 194 | 187 |
| 195 gfx::Size size_; | 188 gfx::Size size_; |
| 196 | 189 |
| 197 // Current scroll offset in CSS pixels. | 190 // Current scroll offset in CSS pixels. |
| 198 gfx::Vector2dF scroll_offset_dip_; | 191 gfx::Vector2dF scroll_offset_dip_; |
| 199 | 192 |
| 200 // Max scroll offset in CSS pixels. | 193 // Max scroll offset in CSS pixels. |
| 201 gfx::Vector2dF max_scroll_offset_dip_; | 194 gfx::Vector2dF max_scroll_offset_dip_; |
| 202 | 195 |
| 203 // Used to prevent rounding errors from accumulating enough to generate | 196 // Used to prevent rounding errors from accumulating enough to generate |
| 204 // visible skew (especially noticeable when scrolling up and down in the same | 197 // visible skew (especially noticeable when scrolling up and down in the same |
| 205 // spot over a period of time). | 198 // spot over a period of time). |
| 206 gfx::Vector2dF overscroll_rounding_error_; | 199 gfx::Vector2dF overscroll_rounding_error_; |
| 207 | 200 |
| 208 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 201 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 209 }; | 202 }; |
| 210 | 203 |
| 211 } // namespace android_webview | 204 } // namespace android_webview |
| 212 | 205 |
| 213 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 206 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |