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