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/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 if (compositor_ && !frame_ack.resources.empty()) { | 324 if (compositor_ && !frame_ack.resources.empty()) { |
325 compositor_->ReturnResources(frame_ack); | 325 compositor_->ReturnResources(frame_ack); |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 void BrowserViewRenderer::DidSkipCommitFrame() { | 329 void BrowserViewRenderer::DidSkipCommitFrame() { |
330 // Treat it the same way as skipping onDraw. | 330 // Treat it the same way as skipping onDraw. |
331 DidSkipCompositeInDraw(); | 331 DidSkipCompositeInDraw(); |
332 } | 332 } |
333 | 333 |
| 334 void BrowserViewRenderer::InvalidateOnFunctorDestroy() { |
| 335 client_->InvalidateOnFunctorDestroy(); |
| 336 } |
| 337 |
334 bool BrowserViewRenderer::OnDrawSoftware(jobject java_canvas) { | 338 bool BrowserViewRenderer::OnDrawSoftware(jobject java_canvas) { |
335 if (!compositor_) { | 339 if (!compositor_) { |
336 TRACE_EVENT_INSTANT0( | 340 TRACE_EVENT_INSTANT0( |
337 "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); | 341 "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); |
338 return false; | 342 return false; |
339 } | 343 } |
340 | 344 |
341 // TODO(hush): right now webview size is passed in as the auxiliary bitmap | 345 // TODO(hush): right now webview size is passed in as the auxiliary bitmap |
342 // size, which might hurt performace (only for software draws with auxiliary | 346 // size, which might hurt performace (only for software draws with auxiliary |
343 // bitmap). For better performance, get global visible rect, transform it | 347 // bitmap). For better performance, get global visible rect, transform it |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 450 } |
447 | 451 |
448 void BrowserViewRenderer::OnDetachedFromWindow() { | 452 void BrowserViewRenderer::OnDetachedFromWindow() { |
449 TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnDetachedFromWindow"); | 453 TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnDetachedFromWindow"); |
450 attached_to_window_ = false; | 454 attached_to_window_ = false; |
451 DCHECK(!hardware_enabled_); | 455 DCHECK(!hardware_enabled_); |
452 } | 456 } |
453 | 457 |
454 void BrowserViewRenderer::ReleaseHardware() { | 458 void BrowserViewRenderer::ReleaseHardware() { |
455 DCHECK(hardware_enabled_); | 459 DCHECK(hardware_enabled_); |
456 // TODO(hush): do this in somewhere else. Either in hardware render or in | 460 ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI()); |
457 // shared renderer state. | |
458 ReturnUnusedResource(shared_renderer_state_.PassCompositorFrame()); | |
459 ReturnResourceFromParent(); | 461 ReturnResourceFromParent(); |
460 DCHECK(shared_renderer_state_.ReturnedResourcesEmpty()); | 462 DCHECK(shared_renderer_state_.ReturnedResourcesEmptyOnUI()); |
461 | 463 |
462 if (compositor_) { | 464 if (compositor_) { |
463 compositor_->ReleaseHwDraw(); | 465 compositor_->ReleaseHwDraw(); |
464 SynchronousCompositorMemoryPolicy zero_policy; | 466 SynchronousCompositorMemoryPolicy zero_policy; |
465 RequestMemoryPolicy(zero_policy); | 467 RequestMemoryPolicy(zero_policy); |
466 } | 468 } |
467 | 469 |
468 hardware_enabled_ = false; | 470 hardware_enabled_ = false; |
469 GlobalTileManager::GetInstance()->Remove(tile_manager_key_); | 471 GlobalTileManager::GetInstance()->Remove(tile_manager_key_); |
470 } | 472 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 "compositor_needs_continuous_invalidate_", | 749 "compositor_needs_continuous_invalidate_", |
748 compositor_needs_continuous_invalidate_); | 750 compositor_needs_continuous_invalidate_); |
749 | 751 |
750 // This should only be called if OnDraw or DrawGL did not come in time, which | 752 // This should only be called if OnDraw or DrawGL did not come in time, which |
751 // means block_invalidates_ must still be true. | 753 // means block_invalidates_ must still be true. |
752 DCHECK(block_invalidates_); | 754 DCHECK(block_invalidates_); |
753 fallback_tick_pending_ = false; | 755 fallback_tick_pending_ = false; |
754 if (compositor_needs_continuous_invalidate_ && compositor_) { | 756 if (compositor_needs_continuous_invalidate_ && compositor_) { |
755 if (hardware_enabled_) { | 757 if (hardware_enabled_) { |
756 ReturnResourceFromParent(); | 758 ReturnResourceFromParent(); |
757 ReturnUnusedResource(shared_renderer_state_.PassCompositorFrame()); | 759 ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI()); |
758 scoped_ptr<cc::CompositorFrame> frame = CompositeHw(); | 760 scoped_ptr<cc::CompositorFrame> frame = CompositeHw(); |
759 if (frame.get()) { | 761 if (frame.get()) { |
760 shared_renderer_state_.SetCompositorFrameOnUI(frame.Pass(), true); | 762 shared_renderer_state_.SetCompositorFrameOnUI(frame.Pass(), true); |
761 } | 763 } |
762 } else { | 764 } else { |
763 ForceFakeCompositeSW(); | 765 ForceFakeCompositeSW(); |
764 } | 766 } |
765 } else { | 767 } else { |
766 // Pretend we just composited to unblock further invalidates. | 768 // Pretend we just composited to unblock further invalidates. |
767 DidComposite(); | 769 DidComposite(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 base::StringAppendF(&str, | 821 base::StringAppendF(&str, |
820 "overscroll_rounding_error_: %s ", | 822 "overscroll_rounding_error_: %s ", |
821 overscroll_rounding_error_.ToString().c_str()); | 823 overscroll_rounding_error_.ToString().c_str()); |
822 base::StringAppendF( | 824 base::StringAppendF( |
823 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 825 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
824 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 826 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
825 return str; | 827 return str; |
826 } | 828 } |
827 | 829 |
828 } // namespace android_webview | 830 } // namespace android_webview |
OLD | NEW |