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/parent_compositor_draw_constraints.h" |
10 #include "android_webview/browser/shared_renderer_state.h" | 11 #include "android_webview/browser/shared_renderer_state.h" |
11 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "content/public/browser/android/synchronous_compositor.h" | 16 #include "content/public/browser/android/synchronous_compositor.h" |
16 #include "content/public/browser/android/synchronous_compositor_client.h" | 17 #include "content/public/browser/android/synchronous_compositor_client.h" |
17 #include "skia/ext/refptr.h" | 18 #include "skia/ext/refptr.h" |
18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
19 #include "ui/gfx/vector2d_f.h" | 20 #include "ui/gfx/vector2d_f.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 virtual bool IsExternalFlingActive() const OVERRIDE; | 134 virtual bool IsExternalFlingActive() const OVERRIDE; |
134 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 135 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
135 gfx::Vector2dF latest_overscroll_delta, | 136 gfx::Vector2dF latest_overscroll_delta, |
136 gfx::Vector2dF current_fling_velocity) OVERRIDE; | 137 gfx::Vector2dF current_fling_velocity) OVERRIDE; |
137 | 138 |
138 // GlobalTileManagerClient overrides. | 139 // GlobalTileManagerClient overrides. |
139 virtual size_t GetNumTiles() const OVERRIDE; | 140 virtual size_t GetNumTiles() const OVERRIDE; |
140 virtual void SetNumTiles(size_t num_tiles, | 141 virtual void SetNumTiles(size_t num_tiles, |
141 bool effective_immediately) OVERRIDE; | 142 bool effective_immediately) OVERRIDE; |
142 | 143 |
143 private: | |
144 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); | |
145 // Checks the continuous invalidate and block invalidate state, and schedule | 144 // Checks the continuous invalidate and block invalidate state, and schedule |
146 // invalidates appropriately. If |force_invalidate| is true, then send a view | 145 // invalidates appropriately. If |force_invalidate| is true, then send a view |
147 // invalidate regardless of compositor expectation. | 146 // invalidate regardless of compositor expectation. |
148 void EnsureContinuousInvalidation(bool force_invalidate); | 147 void EnsureContinuousInvalidation(bool force_invalidate); |
| 148 |
| 149 // Post an invalidate if the parent draw constraints are stale and there is |
| 150 // no pending invalidate. |
| 151 void InvalidateOnceIfNeeded(); |
| 152 |
| 153 private: |
| 154 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); |
149 bool OnDrawSoftware(jobject java_canvas); | 155 bool OnDrawSoftware(jobject java_canvas); |
150 bool CompositeSW(SkCanvas* canvas); | 156 bool CompositeSW(SkCanvas* canvas); |
151 void DidComposite(); | 157 void DidComposite(); |
152 scoped_ptr<base::Value> RootLayerStateAsValue( | 158 scoped_ptr<base::Value> RootLayerStateAsValue( |
153 const gfx::Vector2dF& total_scroll_offset_dip, | 159 const gfx::Vector2dF& total_scroll_offset_dip, |
154 const gfx::SizeF& scrollable_size_dip); | 160 const gfx::SizeF& scrollable_size_dip); |
155 | 161 |
156 bool OnDrawHardware(jobject java_canvas); | 162 bool OnDrawHardware(jobject java_canvas); |
157 void ReturnUnusedResource(scoped_ptr<DrawGLInput> input); | 163 void ReturnUnusedResource(scoped_ptr<DrawGLInput> input); |
158 void ReturnResourceFromParent(); | 164 void ReturnResourceFromParent(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 bool attached_to_window_; | 198 bool attached_to_window_; |
193 bool hardware_enabled_; | 199 bool hardware_enabled_; |
194 float dip_scale_; | 200 float dip_scale_; |
195 float page_scale_factor_; | 201 float page_scale_factor_; |
196 bool on_new_picture_enable_; | 202 bool on_new_picture_enable_; |
197 bool clear_view_; | 203 bool clear_view_; |
198 | 204 |
199 gfx::Vector2d last_on_draw_scroll_offset_; | 205 gfx::Vector2d last_on_draw_scroll_offset_; |
200 gfx::Rect last_on_draw_global_visible_rect_; | 206 gfx::Rect last_on_draw_global_visible_rect_; |
201 | 207 |
| 208 // The draw constraints from the parent compositor. These are only used for |
| 209 // tiling priority. |
| 210 ParentCompositorDrawConstraints parent_draw_constraints_; |
| 211 |
202 // When true, we should continuously invalidate and keep drawing, for example | 212 // When true, we should continuously invalidate and keep drawing, for example |
203 // to drive animation. This value is set by the compositor and should always | 213 // to drive animation. This value is set by the compositor and should always |
204 // reflect the expectation of the compositor and not be reused for other | 214 // reflect the expectation of the compositor and not be reused for other |
205 // states. | 215 // states. |
206 bool compositor_needs_continuous_invalidate_; | 216 bool compositor_needs_continuous_invalidate_; |
207 | 217 |
208 // Used to block additional invalidates while one is already pending. | 218 // Used to block additional invalidates while one is already pending. |
209 bool block_invalidates_; | 219 bool block_invalidates_; |
210 | 220 |
211 base::CancelableClosure post_fallback_tick_; | 221 base::CancelableClosure post_fallback_tick_; |
(...skipping 20 matching lines...) Expand all Loading... |
232 // policy on the shared_renderer_state_ atomically. | 242 // policy on the shared_renderer_state_ atomically. |
233 size_t num_tiles_; | 243 size_t num_tiles_; |
234 size_t num_bytes_; | 244 size_t num_bytes_; |
235 | 245 |
236 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 246 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
237 }; | 247 }; |
238 | 248 |
239 } // namespace android_webview | 249 } // namespace android_webview |
240 | 250 |
241 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 251 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
OLD | NEW |