Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: android_webview/browser/browser_view_renderer.cc

Issue 271163002: aw: Fix lost invalidate while playing video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | android_webview/native/aw_contents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 // 1) Webview is paused. Also need to check we are not in clear view since 657 // 1) Webview is paused. Also need to check we are not in clear view since
658 // paused, offscreen still expect clear view to recover. 658 // paused, offscreen still expect clear view to recover.
659 // 2) If we are attached to window and the window is not visible (eg when 659 // 2) If we are attached to window and the window is not visible (eg when
660 // app is in the background). We are sure in this case the webview is used 660 // app is in the background). We are sure in this case the webview is used
661 // "on-screen" but that updates are not needed when in the background. 661 // "on-screen" but that updates are not needed when in the background.
662 bool throttle_fallback_tick = 662 bool throttle_fallback_tick =
663 (is_paused_ && !clear_view_) || (attached_to_window_ && !window_visible_); 663 (is_paused_ && !clear_view_) || (attached_to_window_ && !window_visible_);
664 if (throttle_fallback_tick) 664 if (throttle_fallback_tick)
665 return; 665 return;
666 666
667 block_invalidates_ = compositor_needs_continuous_invalidate_; 667 {
668 base::AutoLock lock(render_thread_lock_);
669 block_invalidates_ = compositor_needs_continuous_invalidate_;
670 }
668 671
669 // Unretained here is safe because the callback is cancelled when 672 // Unretained here is safe because the callback is cancelled when
670 // |fallback_tick_| is destroyed. 673 // |fallback_tick_| is destroyed.
671 fallback_tick_.Reset(base::Bind(&BrowserViewRenderer::FallbackTickFired, 674 fallback_tick_.Reset(base::Bind(&BrowserViewRenderer::FallbackTickFired,
672 base::Unretained(this))); 675 base::Unretained(this)));
673 676
674 // No need to reschedule fallback tick if compositor does not need to be 677 // No need to reschedule fallback tick if compositor does not need to be
675 // ticked. This can happen if this is reached because force_invalidate is 678 // ticked. This can happen if this is reached because force_invalidate is
676 // true. 679 // true.
677 if (compositor_needs_continuous_invalidate_) { 680 if (compositor_needs_continuous_invalidate_) {
(...skipping 28 matching lines...) Expand all
706 709
707 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { 710 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) {
708 DCHECK(has_compositor_); 711 DCHECK(has_compositor_);
709 bool result = shared_renderer_state_->GetCompositor()-> 712 bool result = shared_renderer_state_->GetCompositor()->
710 DemandDrawSw(canvas); 713 DemandDrawSw(canvas);
711 DidComposite(false); 714 DidComposite(false);
712 return result; 715 return result;
713 } 716 }
714 717
715 void BrowserViewRenderer::DidComposite(bool force_invalidate) { 718 void BrowserViewRenderer::DidComposite(bool force_invalidate) {
719 {
720 base::AutoLock lock(render_thread_lock_);
721 block_invalidates_ = false;
722 }
723
724 if (!ui_task_runner_->BelongsToCurrentThread()) {
725 ui_task_runner_->PostTask(
726 FROM_HERE,
727 base::Bind(&BrowserViewRenderer::EnsureContinuousInvalidation,
728 ui_thread_weak_ptr_,
729 force_invalidate));
730 return;
731 }
732
716 fallback_tick_.Cancel(); 733 fallback_tick_.Cancel();
717 block_invalidates_ = false;
718 EnsureContinuousInvalidation(force_invalidate); 734 EnsureContinuousInvalidation(force_invalidate);
719 } 735 }
720 736
721 std::string BrowserViewRenderer::ToString(AwDrawGLInfo* draw_info) const { 737 std::string BrowserViewRenderer::ToString(AwDrawGLInfo* draw_info) const {
722 std::string str; 738 std::string str;
723 base::StringAppendF(&str, "is_paused: %d ", is_paused_); 739 base::StringAppendF(&str, "is_paused: %d ", is_paused_);
724 base::StringAppendF(&str, "view_visible: %d ", view_visible_); 740 base::StringAppendF(&str, "view_visible: %d ", view_visible_);
725 base::StringAppendF(&str, "window_visible: %d ", window_visible_); 741 base::StringAppendF(&str, "window_visible: %d ", window_visible_);
726 base::StringAppendF(&str, "dip_scale: %f ", dip_scale_); 742 base::StringAppendF(&str, "dip_scale: %f ", dip_scale_);
727 base::StringAppendF(&str, "page_scale_factor: %f ", page_scale_factor_); 743 base::StringAppendF(&str, "page_scale_factor: %f ", page_scale_factor_);
(...skipping 24 matching lines...) Expand all
752 base::StringAppendF(&str, 768 base::StringAppendF(&str,
753 "surface width height: [%d %d] ", 769 "surface width height: [%d %d] ",
754 draw_info->width, 770 draw_info->width,
755 draw_info->height); 771 draw_info->height);
756 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); 772 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer);
757 } 773 }
758 return str; 774 return str;
759 } 775 }
760 776
761 } // namespace android_webview 777 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/native/aw_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698