| 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/hardware_renderer.h" | 8 #include "android_webview/browser/hardware_renderer.h" |
| 9 #include "android_webview/browser/shared_renderer_state.h" | 9 #include "android_webview/browser/shared_renderer_state.h" |
| 10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/auto_reset.h" | 12 #include "base/auto_reset.h" |
| 13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "content/public/browser/android/synchronous_compositor.h" | 16 #include "content/public/browser/android/synchronous_compositor.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 20 #include "third_party/skia/include/core/SkBitmapDevice.h" | |
| 21 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
| 22 #include "third_party/skia/include/core/SkPicture.h" | 21 #include "third_party/skia/include/core/SkPicture.h" |
| 23 #include "ui/gfx/vector2d_conversions.h" | 22 #include "ui/gfx/vector2d_conversions.h" |
| 24 | 23 |
| 25 using base::android::AttachCurrentThread; | 24 using base::android::AttachCurrentThread; |
| 26 using base::android::JavaRef; | 25 using base::android::JavaRef; |
| 27 using base::android::ScopedJavaLocalRef; | 26 using base::android::ScopedJavaLocalRef; |
| 28 using content::BrowserThread; | 27 using content::BrowserThread; |
| 29 | 28 |
| 30 namespace android_webview { | 29 namespace android_webview { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 469 |
| 471 // This should only be called if OnDraw or DrawGL did not come in time, which | 470 // This should only be called if OnDraw or DrawGL did not come in time, which |
| 472 // means block_invalidates_ must still be true. | 471 // means block_invalidates_ must still be true. |
| 473 DCHECK(block_invalidates_); | 472 DCHECK(block_invalidates_); |
| 474 if (compositor_needs_continuous_invalidate_ && has_compositor_) | 473 if (compositor_needs_continuous_invalidate_ && has_compositor_) |
| 475 ForceFakeCompositeSW(); | 474 ForceFakeCompositeSW(); |
| 476 } | 475 } |
| 477 | 476 |
| 478 void BrowserViewRenderer::ForceFakeCompositeSW() { | 477 void BrowserViewRenderer::ForceFakeCompositeSW() { |
| 479 DCHECK(has_compositor_); | 478 DCHECK(has_compositor_); |
| 480 SkBitmapDevice device(SkBitmap::kARGB_8888_Config, 1, 1); | 479 SkBitmap bitmap; |
| 481 SkCanvas canvas(&device); | 480 bitmap.allocN32Pixels(1, 1); |
| 481 bitmap.eraseColor(0); |
| 482 SkCanvas canvas(bitmap); |
| 482 CompositeSW(&canvas); | 483 CompositeSW(&canvas); |
| 483 } | 484 } |
| 484 | 485 |
| 485 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { | 486 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { |
| 486 DCHECK(has_compositor_); | 487 DCHECK(has_compositor_); |
| 487 | 488 |
| 488 bool result = shared_renderer_state_->CompositorDemandDrawSw(canvas); | 489 bool result = shared_renderer_state_->CompositorDemandDrawSw(canvas); |
| 489 fallback_tick_.Cancel(); | 490 fallback_tick_.Cancel(); |
| 490 block_invalidates_ = false; | 491 block_invalidates_ = false; |
| 491 EnsureContinuousInvalidation(false); | 492 EnsureContinuousInvalidation(false); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 base::StringAppendF(&str, | 527 base::StringAppendF(&str, |
| 527 "surface width height: [%d %d] ", | 528 "surface width height: [%d %d] ", |
| 528 draw_info->width, | 529 draw_info->width, |
| 529 draw_info->height); | 530 draw_info->height); |
| 530 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 531 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 531 } | 532 } |
| 532 return str; | 533 return str; |
| 533 } | 534 } |
| 534 | 535 |
| 535 } // namespace android_webview | 536 } // namespace android_webview |
| OLD | NEW |