OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "android_webview/browser/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 9 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 void InProcessViewRenderer::WebContentsGone() { | 191 void InProcessViewRenderer::WebContentsGone() { |
192 web_contents_ = NULL; | 192 web_contents_ = NULL; |
193 compositor_ = NULL; | 193 compositor_ = NULL; |
194 } | 194 } |
195 | 195 |
196 bool InProcessViewRenderer::OnDraw(jobject java_canvas, | 196 bool InProcessViewRenderer::OnDraw(jobject java_canvas, |
197 bool is_hardware_canvas, | 197 bool is_hardware_canvas, |
198 const gfx::Vector2d& scroll, | 198 const gfx::Vector2d& scroll, |
199 const gfx::Rect& clip) { | 199 const gfx::Rect& clip) { |
200 fallback_tick_.Cancel(); | |
201 scroll_at_start_of_frame_ = scroll; | 200 scroll_at_start_of_frame_ = scroll; |
202 if (is_hardware_canvas && attached_to_window_ && HardwareEnabled()) { | 201 if (is_hardware_canvas && attached_to_window_ && HardwareEnabled()) { |
203 // We should be performing a hardware draw here. If we don't have the | 202 // We should be performing a hardware draw here. If we don't have the |
204 // comositor yet or if RequestDrawGL fails, it means we failed this draw and | 203 // comositor yet or if RequestDrawGL fails, it means we failed this draw and |
205 // thus return false here to clear to background color for this draw. | 204 // thus return false here to clear to background color for this draw. |
206 return compositor_ && client_->RequestDrawGL(java_canvas); | 205 return compositor_ && client_->RequestDrawGL(java_canvas); |
207 } | 206 } |
208 // Perform a software draw | 207 // Perform a software draw |
209 block_invalidates_ = true; | 208 block_invalidates_ = true; |
210 bool result = DrawSWInternal(java_canvas, clip); | 209 bool result = DrawSWInternal(java_canvas, clip); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 draw_info->clip_right - draw_info->clip_left, | 271 draw_info->clip_right - draw_info->clip_left, |
273 draw_info->clip_bottom - draw_info->clip_top)); | 272 draw_info->clip_bottom - draw_info->clip_top)); |
274 block_invalidates_ = false; | 273 block_invalidates_ = false; |
275 | 274 |
276 EnsureContinuousInvalidation(draw_info); | 275 EnsureContinuousInvalidation(draw_info); |
277 } | 276 } |
278 | 277 |
279 bool InProcessViewRenderer::DrawSWInternal(jobject java_canvas, | 278 bool InProcessViewRenderer::DrawSWInternal(jobject java_canvas, |
280 const gfx::Rect& clip) { | 279 const gfx::Rect& clip) { |
281 TRACE_EVENT0("android_webview", "InProcessViewRenderer::DrawSW"); | 280 TRACE_EVENT0("android_webview", "InProcessViewRenderer::DrawSW"); |
| 281 fallback_tick_.Cancel(); |
282 | 282 |
283 if (clip.IsEmpty()) { | 283 if (clip.IsEmpty()) { |
284 TRACE_EVENT_INSTANT0( | 284 TRACE_EVENT_INSTANT0( |
285 "android_webview", "EarlyOut_EmptyClip", TRACE_EVENT_SCOPE_THREAD); | 285 "android_webview", "EarlyOut_EmptyClip", TRACE_EVENT_SCOPE_THREAD); |
286 return true; | 286 return true; |
287 } | 287 } |
288 | 288 |
289 if (!compositor_) { | 289 if (!compositor_) { |
290 TRACE_EVENT_INSTANT0( | 290 TRACE_EVENT_INSTANT0( |
291 "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); | 291 "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 base::StringAppendF(&str, | 665 base::StringAppendF(&str, |
666 "surface width height: [%d %d] ", | 666 "surface width height: [%d %d] ", |
667 draw_info->width, | 667 draw_info->width, |
668 draw_info->height); | 668 draw_info->height); |
669 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 669 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
670 } | 670 } |
671 return str; | 671 return str; |
672 } | 672 } |
673 | 673 |
674 } // namespace android_webview | 674 } // namespace android_webview |
OLD | NEW |