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/global_tile_manager.h" | 8 #include "android_webview/browser/global_tile_manager.h" |
9 #include "android_webview/browser/global_tile_manager_client.h" | 9 #include "android_webview/browser/global_tile_manager_client.h" |
10 #include "android_webview/browser/shared_renderer_state.h" | 10 #include "android_webview/browser/shared_renderer_state.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // returns true. A false return value indicates nothing was or will be drawn. | 74 // returns true. A false return value indicates nothing was or will be drawn. |
75 // |java_canvas| is the target of the draw. |is_hardware_canvas| indicates | 75 // |java_canvas| is the target of the draw. |is_hardware_canvas| indicates |
76 // a GL Draw maybe possible on this canvas. |scroll| if the view's current | 76 // a GL Draw maybe possible on this canvas. |scroll| if the view's current |
77 // scroll offset. |clip| is the canvas's clip bounds. |global_visible_rect| | 77 // scroll offset. |clip| is the canvas's clip bounds. |global_visible_rect| |
78 // is the intersection of the view size and the window in window coordinates. | 78 // is the intersection of the view size and the window in window coordinates. |
79 bool OnDraw(jobject java_canvas, | 79 bool OnDraw(jobject java_canvas, |
80 bool is_hardware_canvas, | 80 bool is_hardware_canvas, |
81 const gfx::Vector2d& scroll, | 81 const gfx::Vector2d& scroll, |
82 const gfx::Rect& global_visible_rect, | 82 const gfx::Rect& global_visible_rect, |
83 const gfx::Rect& clip); | 83 const gfx::Rect& clip); |
84 void DidDrawGL(const DrawGLResult& result); | 84 void DidDrawGL(scoped_ptr<DrawGLResult> result); |
| 85 void DidDrawDelegated(scoped_ptr<DrawGLResult> result); |
85 | 86 |
86 // CapturePicture API methods. | 87 // CapturePicture API methods. |
87 skia::RefPtr<SkPicture> CapturePicture(int width, int height); | 88 skia::RefPtr<SkPicture> CapturePicture(int width, int height); |
88 void EnableOnNewPicture(bool enabled); | 89 void EnableOnNewPicture(bool enabled); |
89 | 90 |
90 void ClearView(); | 91 void ClearView(); |
91 | 92 |
92 // View update notifications. | 93 // View update notifications. |
93 void SetIsPaused(bool paused); | 94 void SetIsPaused(bool paused); |
94 void SetViewVisibility(bool visible); | 95 void SetViewVisibility(bool visible); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // invalidates appropriately. If |force_invalidate| is true, then send a view | 147 // invalidates appropriately. If |force_invalidate| is true, then send a view |
147 // invalidate regardless of compositor expectation. | 148 // invalidate regardless of compositor expectation. |
148 void EnsureContinuousInvalidation(bool force_invalidate); | 149 void EnsureContinuousInvalidation(bool force_invalidate); |
149 bool DrawSWInternal(jobject java_canvas, const gfx::Rect& clip_bounds); | 150 bool DrawSWInternal(jobject java_canvas, const gfx::Rect& clip_bounds); |
150 bool CompositeSW(SkCanvas* canvas); | 151 bool CompositeSW(SkCanvas* canvas); |
151 void DidComposite(bool force_invalidate); | 152 void DidComposite(bool force_invalidate); |
152 scoped_ptr<base::Value> RootLayerStateAsValue( | 153 scoped_ptr<base::Value> RootLayerStateAsValue( |
153 const gfx::Vector2dF& total_scroll_offset_dip, | 154 const gfx::Vector2dF& total_scroll_offset_dip, |
154 const gfx::SizeF& scrollable_size_dip); | 155 const gfx::SizeF& scrollable_size_dip); |
155 | 156 |
| 157 bool OnDrawHardwareLegacy(jobject java_canvas); |
| 158 bool OnDrawHardware(jobject java_canvas); |
| 159 void ReturnResources(); |
| 160 |
156 // If we call up view invalidate and OnDraw is not called before a deadline, | 161 // If we call up view invalidate and OnDraw is not called before a deadline, |
157 // then we keep ticking the SynchronousCompositor so it can make progress. | 162 // then we keep ticking the SynchronousCompositor so it can make progress. |
158 void FallbackTickFired(); | 163 void FallbackTickFired(); |
159 | 164 |
160 // Force invoke the compositor to run produce a 1x1 software frame that is | 165 // Force invoke the compositor to run produce a 1x1 software frame that is |
161 // immediately discarded. This is a hack to force invoke parts of the | 166 // immediately discarded. This is a hack to force invoke parts of the |
162 // compositor that are not directly exposed here. | 167 // compositor that are not directly exposed here. |
163 void ForceFakeCompositeSW(); | 168 void ForceFakeCompositeSW(); |
164 | 169 |
165 void EnforceMemoryPolicyImmediately( | 170 void EnforceMemoryPolicyImmediately( |
(...skipping 16 matching lines...) Expand all Loading... |
182 base::WeakPtrFactory<BrowserViewRenderer> weak_factory_on_ui_thread_; | 187 base::WeakPtrFactory<BrowserViewRenderer> weak_factory_on_ui_thread_; |
183 base::WeakPtr<BrowserViewRenderer> ui_thread_weak_ptr_; | 188 base::WeakPtr<BrowserViewRenderer> ui_thread_weak_ptr_; |
184 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 189 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
185 | 190 |
186 bool has_compositor_; | 191 bool has_compositor_; |
187 | 192 |
188 bool is_paused_; | 193 bool is_paused_; |
189 bool view_visible_; | 194 bool view_visible_; |
190 bool window_visible_; // Only applicable if |attached_to_window_| is true. | 195 bool window_visible_; // Only applicable if |attached_to_window_| is true. |
191 bool attached_to_window_; | 196 bool attached_to_window_; |
| 197 bool hardware_enabled_; |
192 float dip_scale_; | 198 float dip_scale_; |
193 float page_scale_factor_; | 199 float page_scale_factor_; |
194 bool on_new_picture_enable_; | 200 bool on_new_picture_enable_; |
195 bool clear_view_; | 201 bool clear_view_; |
196 | 202 |
| 203 gfx::Vector2d last_on_draw_scroll_offset_; |
| 204 gfx::Rect last_on_draw_global_visible_rect_; |
| 205 |
197 // When true, we should continuously invalidate and keep drawing, for example | 206 // When true, we should continuously invalidate and keep drawing, for example |
198 // to drive animation. This value is set by the compositor and should always | 207 // to drive animation. This value is set by the compositor and should always |
199 // reflect the expectation of the compositor and not be reused for other | 208 // reflect the expectation of the compositor and not be reused for other |
200 // states. | 209 // states. |
201 bool compositor_needs_continuous_invalidate_; | 210 bool compositor_needs_continuous_invalidate_; |
202 | 211 |
203 // Used to block additional invalidates while one is already pending. | 212 // Used to block additional invalidates while one is already pending. |
204 bool block_invalidates_; | 213 bool block_invalidates_; |
205 | 214 |
206 // Holds a callback to FallbackTickFired while it is pending. | 215 // Holds a callback to FallbackTickFired while it is pending. |
207 base::CancelableClosure fallback_tick_; | 216 base::CancelableClosure fallback_tick_; |
208 | 217 |
209 int width_; | 218 int width_; |
210 int height_; | 219 int height_; |
211 | 220 |
212 DrawGLInput draw_gl_input_; | |
213 | |
214 // Current scroll offset in CSS pixels. | 221 // Current scroll offset in CSS pixels. |
215 gfx::Vector2dF scroll_offset_dip_; | 222 gfx::Vector2dF scroll_offset_dip_; |
216 | 223 |
217 // Max scroll offset in CSS pixels. | 224 // Max scroll offset in CSS pixels. |
218 gfx::Vector2dF max_scroll_offset_dip_; | 225 gfx::Vector2dF max_scroll_offset_dip_; |
219 | 226 |
220 // Used to prevent rounding errors from accumulating enough to generate | 227 // Used to prevent rounding errors from accumulating enough to generate |
221 // visible skew (especially noticeable when scrolling up and down in the same | 228 // visible skew (especially noticeable when scrolling up and down in the same |
222 // spot over a period of time). | 229 // spot over a period of time). |
223 gfx::Vector2dF overscroll_rounding_error_; | 230 gfx::Vector2dF overscroll_rounding_error_; |
(...skipping 10 matching lines...) Expand all Loading... |
234 // used on data that must be modified immediately instead of being posted | 241 // used on data that must be modified immediately instead of being posted |
235 // back to UI. | 242 // back to UI. |
236 base::Lock render_thread_lock_; | 243 base::Lock render_thread_lock_; |
237 | 244 |
238 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 245 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
239 }; | 246 }; |
240 | 247 |
241 } // namespace android_webview | 248 } // namespace android_webview |
242 | 249 |
243 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 250 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
OLD | NEW |