diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 20:18:50 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 20:18:50 +0000 |
commit | f2ac1e60bfd8d469c0bf5d5229fec4467c5d2883 (patch) | |
tree | 475dca8b271f7975673b7aef6e23fad0bbff439a /android_webview | |
parent | 6a7caecdde50da45cc993a7c98eb40066a0f41e9 (diff) | |
download | chromium_src-f2ac1e60bfd8d469c0bf5d5229fec4467c5d2883.zip chromium_src-f2ac1e60bfd8d469c0bf5d5229fec4467c5d2883.tar.gz chromium_src-f2ac1e60bfd8d469c0bf5d5229fec4467c5d2883.tar.bz2 |
[Android WebView] Immediately fail draw if compositor is NULL
This applies to software, hardware, software fallback, and capture
picture. Has the nice benefit that if we are in hardware mode, we will
never create the auxillary bitmap.
An additional change that we will no longer fallback into software draw
if hardware RequestDrawGL fails. In practice this should fail visibily
if it happens, but instrumentation tests may have been relying on this
behavior, so make sure instrumentation tests run in pure software mode.
BUG=
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/18523007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/browser/in_process_view_renderer.cc | 27 | ||||
-rw-r--r-- | android_webview/javatests/AndroidManifest.xml | 2 |
2 files changed, 19 insertions, 10 deletions
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc index c737b65..f4210c3 100644 --- a/android_webview/browser/in_process_view_renderer.cc +++ b/android_webview/browser/in_process_view_renderer.cc @@ -352,10 +352,11 @@ bool InProcessViewRenderer::OnDraw(jobject java_canvas, const gfx::Rect& clip) { fallback_tick_.Cancel(); scroll_at_start_of_frame_ = scroll; - if (is_hardware_canvas && attached_to_window_ && compositor_ && - HardwareEnabled() && client_->RequestDrawGL(java_canvas)) { - // All set: we'll get a call on DrawGL when the time comes. - return true; + if (is_hardware_canvas && attached_to_window_ && HardwareEnabled()) { + // We should be performing a hardware draw here. If we don't have the + // comositor yet or if RequestDrawGL fails, it means we failed this draw and + // thus return false here to clear to background color for this draw. + return compositor_ && client_->RequestDrawGL(java_canvas); } // Perform a software draw block_invalidates_ = true; @@ -403,8 +404,6 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { } last_egl_context_ = current_context; - // TODO(boliu): Make sure this is not called before compositor is initialized - // and GL is ready. Then make this a DCHECK. if (!compositor_) { TRACE_EVENT_INSTANT0( "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); @@ -440,6 +439,12 @@ bool InProcessViewRenderer::DrawSWInternal(jobject java_canvas, return true; } + if (!compositor_) { + TRACE_EVENT_INSTANT0( + "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); + return false; + } + JNIEnv* env = AttachCurrentThread(); AwDrawSWFunctionTable* sw_functions = GetAwDrawSWFunctionTable(); @@ -510,8 +515,11 @@ bool InProcessViewRenderer::DrawSWInternal(jobject java_canvas, base::android::ScopedJavaLocalRef<jobject> InProcessViewRenderer::CapturePicture() { - if (!GetAwDrawSWFunctionTable()) + if (!compositor_ || !GetAwDrawSWFunctionTable()) { + TRACE_EVENT_INSTANT0( + "android_webview", "EarlyOut_CapturePicture", TRACE_EVENT_SCOPE_THREAD); return ScopedJavaLocalRef<jobject>(); + } gfx::Size record_size(width_, height_); @@ -752,7 +760,7 @@ void InProcessViewRenderer::FallbackTickFired() { "InProcessViewRenderer::FallbackTickFired", "continuous_invalidate_", continuous_invalidate_); - if (continuous_invalidate_) { + if (continuous_invalidate_ && compositor_) { SkDevice device(SkBitmap::kARGB_8888_Config, 1, 1); SkCanvas canvas(&device); block_invalidates_ = true; @@ -763,7 +771,8 @@ void InProcessViewRenderer::FallbackTickFired() { } bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) { - return compositor_ && compositor_->DemandDrawSw(canvas); + DCHECK(compositor_); + return compositor_->DemandDrawSw(canvas); } } // namespace android_webview diff --git a/android_webview/javatests/AndroidManifest.xml b/android_webview/javatests/AndroidManifest.xml index e7d3eff..aef384c 100644 --- a/android_webview/javatests/AndroidManifest.xml +++ b/android_webview/javatests/AndroidManifest.xml @@ -7,7 +7,7 @@ <!-- We add an application tag here just so that we can indicate that this package needs to link against the android.test library, which is needed when building test cases. --> - <application> + <application android:hardwareAccelerated="false"> <uses-library android:name="android.test.runner" /> <provider android:name="TestContentProvider" android:authorities="org.chromium.android_webview.test.TestContentProvider" /> |