| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll, | 113 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll, |
| 114 const gfx::Vector2dF& latest_overscroll_delta, | 114 const gfx::Vector2dF& latest_overscroll_delta, |
| 115 const gfx::Vector2dF& current_fling_velocity) override; | 115 const gfx::Vector2dF& current_fling_velocity) override; |
| 116 | 116 |
| 117 void UpdateParentDrawConstraints(); | 117 void UpdateParentDrawConstraints(); |
| 118 void DetachFunctorFromView(); | 118 void DetachFunctorFromView(); |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 void SetTotalRootLayerScrollOffset(const gfx::Vector2dF& new_value_dip); | 121 void SetTotalRootLayerScrollOffset(const gfx::Vector2dF& new_value_dip); |
| 122 bool CanOnDraw(); | 122 bool CanOnDraw(); |
| 123 // Posts an invalidate with fallback tick. All invalidates posted while an | |
| 124 // invalidate is pending will be posted as a single invalidate after the | |
| 125 // pending invalidate is done. | |
| 126 void PostInvalidateWithFallback(); | |
| 127 void CancelFallbackTick(); | |
| 128 void UpdateCompositorIsActive(); | 123 void UpdateCompositorIsActive(); |
| 129 bool CompositeSW(SkCanvas* canvas); | 124 bool CompositeSW(SkCanvas* canvas); |
| 130 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 125 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 131 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, | 126 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, |
| 132 const gfx::SizeF& scrollable_size_dip); | 127 const gfx::SizeF& scrollable_size_dip); |
| 133 | 128 |
| 134 bool CompositeHw(); | 129 bool CompositeHw(); |
| 135 void ReturnUnusedResource(scoped_ptr<ChildFrame> frame); | 130 void ReturnUnusedResource(scoped_ptr<ChildFrame> frame); |
| 136 void ReturnResourceFromParent(); | 131 void ReturnResourceFromParent(); |
| 137 | 132 |
| 138 // If we call up view invalidate and OnDraw is not called before a deadline, | 133 // If we call up view invalidate and OnDraw is not called before a deadline, |
| 139 // then we keep ticking the SynchronousCompositor so it can make progress. | 134 // then we keep ticking the SynchronousCompositor so it can make progress. |
| 140 // Do this in a two stage tick due to native MessageLoop favors delayed task, | 135 // Do this in a two stage tick due to native MessageLoop favors delayed task, |
| 141 // so ensure delayed task is inserted only after the draw task returns. | 136 // so ensure delayed task is inserted only after the draw task returns. |
| 142 void PostFallbackTick(); | 137 void PostFallbackTick(); |
| 143 void FallbackTickFired(); | 138 void FallbackTickFired(); |
| 144 | 139 |
| 145 // Force invoke the compositor to run produce a 1x1 software frame that is | |
| 146 // immediately discarded. This is a hack to force invoke parts of the | |
| 147 // compositor that are not directly exposed here. | |
| 148 void ForceFakeCompositeSW(); | |
| 149 | |
| 150 gfx::Vector2d max_scroll_offset() const; | 140 gfx::Vector2d max_scroll_offset() const; |
| 151 | 141 |
| 152 void UpdateMemoryPolicy(); | 142 void UpdateMemoryPolicy(); |
| 153 | 143 |
| 154 // For debug tracing or logging. Return the string representation of this | 144 // For debug tracing or logging. Return the string representation of this |
| 155 // view renderer's state. | 145 // view renderer's state. |
| 156 std::string ToString() const; | 146 std::string ToString() const; |
| 157 | 147 |
| 158 BrowserViewRendererClient* client_; | 148 BrowserViewRendererClient* client_; |
| 159 SharedRendererState shared_renderer_state_; | 149 SharedRendererState shared_renderer_state_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 172 float min_page_scale_factor_; | 162 float min_page_scale_factor_; |
| 173 float max_page_scale_factor_; | 163 float max_page_scale_factor_; |
| 174 bool on_new_picture_enable_; | 164 bool on_new_picture_enable_; |
| 175 bool clear_view_; | 165 bool clear_view_; |
| 176 | 166 |
| 177 bool offscreen_pre_raster_; | 167 bool offscreen_pre_raster_; |
| 178 | 168 |
| 179 gfx::Vector2d last_on_draw_scroll_offset_; | 169 gfx::Vector2d last_on_draw_scroll_offset_; |
| 180 gfx::Rect last_on_draw_global_visible_rect_; | 170 gfx::Rect last_on_draw_global_visible_rect_; |
| 181 | 171 |
| 182 base::CancelableClosure post_fallback_tick_; | |
| 183 base::CancelableClosure fallback_tick_fired_; | |
| 184 bool fallback_tick_pending_; | |
| 185 | |
| 186 gfx::Size size_; | 172 gfx::Size size_; |
| 187 | 173 |
| 188 gfx::SizeF scrollable_size_dip_; | 174 gfx::SizeF scrollable_size_dip_; |
| 189 | 175 |
| 190 // Current scroll offset in CSS pixels. | 176 // Current scroll offset in CSS pixels. |
| 191 // TODO(miletus): Make scroll_offset_dip_ a gfx::ScrollOffset. | 177 // TODO(miletus): Make scroll_offset_dip_ a gfx::ScrollOffset. |
| 192 gfx::Vector2dF scroll_offset_dip_; | 178 gfx::Vector2dF scroll_offset_dip_; |
| 193 | 179 |
| 194 // Max scroll offset in CSS pixels. | 180 // Max scroll offset in CSS pixels. |
| 195 // TODO(miletus): Make max_scroll_offset_dip_ a gfx::ScrollOffset. | 181 // TODO(miletus): Make max_scroll_offset_dip_ a gfx::ScrollOffset. |
| 196 gfx::Vector2dF max_scroll_offset_dip_; | 182 gfx::Vector2dF max_scroll_offset_dip_; |
| 197 | 183 |
| 198 // Used to prevent rounding errors from accumulating enough to generate | 184 // Used to prevent rounding errors from accumulating enough to generate |
| 199 // visible skew (especially noticeable when scrolling up and down in the same | 185 // visible skew (especially noticeable when scrolling up and down in the same |
| 200 // spot over a period of time). | 186 // spot over a period of time). |
| 201 // TODO(miletus): Make overscroll_rounding_error_ a gfx::ScrollOffset. | 187 // TODO(miletus): Make overscroll_rounding_error_ a gfx::ScrollOffset. |
| 202 gfx::Vector2dF overscroll_rounding_error_; | 188 gfx::Vector2dF overscroll_rounding_error_; |
| 203 | 189 |
| 204 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 190 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 205 }; | 191 }; |
| 206 | 192 |
| 207 } // namespace android_webview | 193 } // namespace android_webview |
| 208 | 194 |
| 209 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 195 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |