| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/browser_view_renderer_client.h" | 7 #include "android_webview/browser/browser_view_renderer_client.h" |
| 8 #include "android_webview/browser/shared_renderer_state.h" | 8 #include "android_webview/browser/shared_renderer_state.h" |
| 9 #include "android_webview/public/browser/draw_gl.h" | 9 #include "android_webview/public/browser/draw_gl.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "content/public/browser/android/synchronous_compositor.h" | 15 #include "content/public/browser/android/synchronous_compositor.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "third_party/skia/include/core/SkBitmapDevice.h" | |
| 20 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
| 21 #include "third_party/skia/include/core/SkPicture.h" | 20 #include "third_party/skia/include/core/SkPicture.h" |
| 22 #include "ui/gfx/vector2d_conversions.h" | 21 #include "ui/gfx/vector2d_conversions.h" |
| 23 | 22 |
| 24 using base::android::AttachCurrentThread; | 23 using base::android::AttachCurrentThread; |
| 25 using base::android::JavaRef; | 24 using base::android::JavaRef; |
| 26 using base::android::ScopedJavaLocalRef; | 25 using base::android::ScopedJavaLocalRef; |
| 27 using content::BrowserThread; | 26 using content::BrowserThread; |
| 28 | 27 |
| 29 namespace android_webview { | 28 namespace android_webview { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 433 |
| 435 // This should only be called if OnDraw or DrawGL did not come in time, which | 434 // This should only be called if OnDraw or DrawGL did not come in time, which |
| 436 // means block_invalidates_ must still be true. | 435 // means block_invalidates_ must still be true. |
| 437 DCHECK(block_invalidates_); | 436 DCHECK(block_invalidates_); |
| 438 if (compositor_needs_continuous_invalidate_ && has_compositor_) | 437 if (compositor_needs_continuous_invalidate_ && has_compositor_) |
| 439 ForceFakeCompositeSW(); | 438 ForceFakeCompositeSW(); |
| 440 } | 439 } |
| 441 | 440 |
| 442 void BrowserViewRenderer::ForceFakeCompositeSW() { | 441 void BrowserViewRenderer::ForceFakeCompositeSW() { |
| 443 DCHECK(has_compositor_); | 442 DCHECK(has_compositor_); |
| 444 SkBitmapDevice device(SkBitmap::kARGB_8888_Config, 1, 1); | 443 SkBitmap bitmap; |
| 445 SkCanvas canvas(&device); | 444 bitmap.allocN32Pixels(1, 1); |
| 445 bitmap.eraseColor(0); |
| 446 SkCanvas canvas(bitmap); |
| 446 CompositeSW(&canvas); | 447 CompositeSW(&canvas); |
| 447 } | 448 } |
| 448 | 449 |
| 449 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { | 450 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { |
| 450 DCHECK(has_compositor_); | 451 DCHECK(has_compositor_); |
| 451 bool result = shared_renderer_state_->CompositorDemandDrawSw(canvas); | 452 bool result = shared_renderer_state_->CompositorDemandDrawSw(canvas); |
| 452 DidComposite(false); | 453 DidComposite(false); |
| 453 return result; | 454 return result; |
| 454 } | 455 } |
| 455 | 456 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 base::StringAppendF(&str, | 494 base::StringAppendF(&str, |
| 494 "surface width height: [%d %d] ", | 495 "surface width height: [%d %d] ", |
| 495 draw_info->width, | 496 draw_info->width, |
| 496 draw_info->height); | 497 draw_info->height); |
| 497 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 498 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 498 } | 499 } |
| 499 return str; | 500 return str; |
| 500 } | 501 } |
| 501 | 502 |
| 502 } // namespace android_webview | 503 } // namespace android_webview |
| OLD | NEW |