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(); | |
135 void ReturnUnusedResource(scoped_ptr<ChildFrame> frame); | 129 void ReturnUnusedResource(scoped_ptr<ChildFrame> frame); |
136 void ReturnResourceFromParent(); | 130 void ReturnResourceFromParent(); |
137 | 131 |
138 // If we call up view invalidate and OnDraw is not called before a deadline, | 132 // 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. | 133 // 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, | 134 // 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. | 135 // so ensure delayed task is inserted only after the draw task returns. |
142 void PostFallbackTick(); | 136 void PostFallbackTick(); |
143 void FallbackTickFired(); | 137 void FallbackTickFired(); |
144 | 138 |
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; | 139 gfx::Vector2d max_scroll_offset() const; |
151 | 140 |
152 void UpdateMemoryPolicy(); | 141 void UpdateMemoryPolicy(); |
153 | 142 |
154 // For debug tracing or logging. Return the string representation of this | 143 // For debug tracing or logging. Return the string representation of this |
155 // view renderer's state. | 144 // view renderer's state. |
156 std::string ToString() const; | 145 std::string ToString() const; |
157 | 146 |
158 BrowserViewRendererClient* client_; | 147 BrowserViewRendererClient* client_; |
159 SharedRendererState shared_renderer_state_; | 148 SharedRendererState shared_renderer_state_; |
(...skipping 12 matching lines...) Expand all Loading... |
172 float min_page_scale_factor_; | 161 float min_page_scale_factor_; |
173 float max_page_scale_factor_; | 162 float max_page_scale_factor_; |
174 bool on_new_picture_enable_; | 163 bool on_new_picture_enable_; |
175 bool clear_view_; | 164 bool clear_view_; |
176 | 165 |
177 bool offscreen_pre_raster_; | 166 bool offscreen_pre_raster_; |
178 | 167 |
179 gfx::Vector2d last_on_draw_scroll_offset_; | 168 gfx::Vector2d last_on_draw_scroll_offset_; |
180 gfx::Rect last_on_draw_global_visible_rect_; | 169 gfx::Rect last_on_draw_global_visible_rect_; |
181 | 170 |
182 base::CancelableClosure post_fallback_tick_; | |
183 base::CancelableClosure fallback_tick_fired_; | |
184 bool fallback_tick_pending_; | |
185 | |
186 gfx::Size size_; | 171 gfx::Size size_; |
187 | 172 |
188 gfx::SizeF scrollable_size_dip_; | 173 gfx::SizeF scrollable_size_dip_; |
189 | 174 |
190 // Current scroll offset in CSS pixels. | 175 // Current scroll offset in CSS pixels. |
191 // TODO(miletus): Make scroll_offset_dip_ a gfx::ScrollOffset. | 176 // TODO(miletus): Make scroll_offset_dip_ a gfx::ScrollOffset. |
192 gfx::Vector2dF scroll_offset_dip_; | 177 gfx::Vector2dF scroll_offset_dip_; |
193 | 178 |
194 // Max scroll offset in CSS pixels. | 179 // Max scroll offset in CSS pixels. |
195 // TODO(miletus): Make max_scroll_offset_dip_ a gfx::ScrollOffset. | 180 // TODO(miletus): Make max_scroll_offset_dip_ a gfx::ScrollOffset. |
196 gfx::Vector2dF max_scroll_offset_dip_; | 181 gfx::Vector2dF max_scroll_offset_dip_; |
197 | 182 |
198 // Used to prevent rounding errors from accumulating enough to generate | 183 // Used to prevent rounding errors from accumulating enough to generate |
199 // visible skew (especially noticeable when scrolling up and down in the same | 184 // visible skew (especially noticeable when scrolling up and down in the same |
200 // spot over a period of time). | 185 // spot over a period of time). |
201 // TODO(miletus): Make overscroll_rounding_error_ a gfx::ScrollOffset. | 186 // TODO(miletus): Make overscroll_rounding_error_ a gfx::ScrollOffset. |
202 gfx::Vector2dF overscroll_rounding_error_; | 187 gfx::Vector2dF overscroll_rounding_error_; |
203 | 188 |
204 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 189 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
205 }; | 190 }; |
206 | 191 |
207 } // namespace android_webview | 192 } // namespace android_webview |
208 | 193 |
209 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 194 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
OLD | NEW |