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/parent_compositor_draw_constraints.h" |
11 #include "android_webview/browser/shared_renderer_state.h" | 11 #include "android_webview/browser/shared_renderer_state.h" |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
15 #include "base/values.h" | 15 #include "base/debug/trace_event.h" |
16 #include "content/public/browser/android/synchronous_compositor.h" | 16 #include "content/public/browser/android/synchronous_compositor.h" |
17 #include "content/public/browser/android/synchronous_compositor_client.h" | 17 #include "content/public/browser/android/synchronous_compositor_client.h" |
18 #include "skia/ext/refptr.h" | 18 #include "skia/ext/refptr.h" |
19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
20 #include "ui/gfx/vector2d_f.h" | 20 #include "ui/gfx/vector2d_f.h" |
21 | 21 |
22 class SkCanvas; | 22 class SkCanvas; |
23 class SkPicture; | 23 class SkPicture; |
24 struct AwDrawGLInfo; | |
25 struct AwDrawSWFunctionTable; | |
26 | 24 |
27 namespace content { | 25 namespace content { |
28 class ContentViewCore; | |
29 struct SynchronousCompositorMemoryPolicy; | 26 struct SynchronousCompositorMemoryPolicy; |
30 class WebContents; | 27 class WebContents; |
31 } | 28 } |
32 | 29 |
33 namespace android_webview { | 30 namespace android_webview { |
34 | 31 |
35 class BrowserViewRendererClient; | 32 class BrowserViewRendererClient; |
36 | 33 |
37 // Delegate to perform rendering actions involving Java objects. | 34 // Delegate to perform rendering actions involving Java objects. |
38 class BrowserViewRendererJavaHelper { | 35 class BrowserViewRendererJavaHelper { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // invalidates appropriately. If |force_invalidate| is true, then send a view | 148 // invalidates appropriately. If |force_invalidate| is true, then send a view |
152 // invalidate regardless of compositor expectation. If |skip_reschedule_tick| | 149 // invalidate regardless of compositor expectation. If |skip_reschedule_tick| |
153 // is true and if there is already a pending fallback tick, don't reschedule | 150 // is true and if there is already a pending fallback tick, don't reschedule |
154 // them. | 151 // them. |
155 void EnsureContinuousInvalidation(bool force_invalidate, | 152 void EnsureContinuousInvalidation(bool force_invalidate, |
156 bool skip_reschedule_tick); | 153 bool skip_reschedule_tick); |
157 bool OnDrawSoftware(jobject java_canvas); | 154 bool OnDrawSoftware(jobject java_canvas); |
158 bool CompositeSW(SkCanvas* canvas); | 155 bool CompositeSW(SkCanvas* canvas); |
159 void DidComposite(); | 156 void DidComposite(); |
160 void SkippedCompositeInDraw(); | 157 void SkippedCompositeInDraw(); |
161 scoped_ptr<base::Value> RootLayerStateAsValue( | 158 scoped_refptr<base::debug::ConvertableToTraceFormat> RootLayerStateAsValue( |
162 const gfx::Vector2dF& total_scroll_offset_dip, | 159 const gfx::Vector2dF& total_scroll_offset_dip, |
163 const gfx::SizeF& scrollable_size_dip); | 160 const gfx::SizeF& scrollable_size_dip); |
164 | 161 |
165 bool OnDrawHardware(jobject java_canvas); | 162 bool OnDrawHardware(jobject java_canvas); |
166 void ReturnUnusedResource(scoped_ptr<cc::CompositorFrame> frame); | 163 void ReturnUnusedResource(scoped_ptr<cc::CompositorFrame> frame); |
167 void ReturnResourceFromParent(); | 164 void ReturnResourceFromParent(); |
168 | 165 |
169 // If we call up view invalidate and OnDraw is not called before a deadline, | 166 // If we call up view invalidate and OnDraw is not called before a deadline, |
170 // then we keep ticking the SynchronousCompositor so it can make progress. | 167 // then we keep ticking the SynchronousCompositor so it can make progress. |
171 // Do this in a two stage tick due to native MessageLoop favors delayed task, | 168 // Do this in a two stage tick due to native MessageLoop favors delayed task, |
172 // so ensure delayed task is inserted only after the draw task returns. | 169 // so ensure delayed task is inserted only after the draw task returns. |
173 void PostFallbackTick(); | 170 void PostFallbackTick(); |
174 void FallbackTickFired(); | 171 void FallbackTickFired(); |
175 | 172 |
176 // Force invoke the compositor to run produce a 1x1 software frame that is | 173 // Force invoke the compositor to run produce a 1x1 software frame that is |
177 // immediately discarded. This is a hack to force invoke parts of the | 174 // immediately discarded. This is a hack to force invoke parts of the |
178 // compositor that are not directly exposed here. | 175 // compositor that are not directly exposed here. |
179 void ForceFakeCompositeSW(); | 176 void ForceFakeCompositeSW(); |
180 | 177 |
181 void EnforceMemoryPolicyImmediately( | 178 void EnforceMemoryPolicyImmediately( |
182 content::SynchronousCompositorMemoryPolicy policy); | 179 content::SynchronousCompositorMemoryPolicy policy); |
183 | 180 |
184 gfx::Vector2d max_scroll_offset() const; | 181 gfx::Vector2d max_scroll_offset() const; |
185 | 182 |
186 content::SynchronousCompositorMemoryPolicy CalculateDesiredMemoryPolicy(); | 183 content::SynchronousCompositorMemoryPolicy CalculateDesiredMemoryPolicy(); |
187 // For debug tracing or logging. Return the string representation of this | 184 // For debug tracing or logging. Return the string representation of this |
188 // view renderer's state and the |draw_info| if provided. | 185 // view renderer's state. |
189 std::string ToString(AwDrawGLInfo* draw_info) const; | 186 std::string ToString() const; |
190 | 187 |
191 BrowserViewRendererClient* client_; | 188 BrowserViewRendererClient* client_; |
192 SharedRendererState* shared_renderer_state_; | 189 SharedRendererState* shared_renderer_state_; |
193 content::WebContents* web_contents_; | 190 content::WebContents* web_contents_; |
194 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 191 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
195 | 192 |
196 content::SynchronousCompositor* compositor_; | 193 content::SynchronousCompositor* compositor_; |
197 | 194 |
198 bool is_paused_; | 195 bool is_paused_; |
199 bool view_visible_; | 196 bool view_visible_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 238 |
242 GlobalTileManager::Key tile_manager_key_; | 239 GlobalTileManager::Key tile_manager_key_; |
243 content::SynchronousCompositorMemoryPolicy memory_policy_; | 240 content::SynchronousCompositorMemoryPolicy memory_policy_; |
244 | 241 |
245 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 242 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
246 }; | 243 }; |
247 | 244 |
248 } // namespace android_webview | 245 } // namespace android_webview |
249 | 246 |
250 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 247 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
OLD | NEW |