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

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

Issue 528953003: aw: Ensure fallback tick unsets |block_invalidates_| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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/common/aw_switches.h" 9 #include "android_webview/common/aw_switches.h"
10 #include "android_webview/public/browser/draw_gl.h" 10 #include "android_webview/public/browser/draw_gl.h"
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 710
711 void BrowserViewRenderer::PostFallbackTick() { 711 void BrowserViewRenderer::PostFallbackTick() {
712 DCHECK(fallback_tick_fired_.IsCancelled()); 712 DCHECK(fallback_tick_fired_.IsCancelled());
713 fallback_tick_fired_.Reset(base::Bind(&BrowserViewRenderer::FallbackTickFired, 713 fallback_tick_fired_.Reset(base::Bind(&BrowserViewRenderer::FallbackTickFired,
714 base::Unretained(this))); 714 base::Unretained(this)));
715 if (compositor_needs_continuous_invalidate_) { 715 if (compositor_needs_continuous_invalidate_) {
716 ui_task_runner_->PostDelayedTask( 716 ui_task_runner_->PostDelayedTask(
717 FROM_HERE, 717 FROM_HERE,
718 fallback_tick_fired_.callback(), 718 fallback_tick_fired_.callback(),
719 base::TimeDelta::FromMilliseconds(kFallbackTickTimeoutInMilliseconds)); 719 base::TimeDelta::FromMilliseconds(kFallbackTickTimeoutInMilliseconds));
720 } else {
721 // Pretend we just composited to unblock further invalidates.
722 DidComposite();
720 } 723 }
721 } 724 }
722 725
723 void BrowserViewRenderer::FallbackTickFired() { 726 void BrowserViewRenderer::FallbackTickFired() {
724 TRACE_EVENT1("android_webview", 727 TRACE_EVENT1("android_webview",
725 "BrowserViewRenderer::FallbackTickFired", 728 "BrowserViewRenderer::FallbackTickFired",
726 "compositor_needs_continuous_invalidate_", 729 "compositor_needs_continuous_invalidate_",
727 compositor_needs_continuous_invalidate_); 730 compositor_needs_continuous_invalidate_);
728 731
729 // This should only be called if OnDraw or DrawGL did not come in time, which 732 // This should only be called if OnDraw or DrawGL did not come in time, which
730 // means block_invalidates_ must still be true. 733 // means block_invalidates_ must still be true.
731 DCHECK(block_invalidates_); 734 DCHECK(block_invalidates_);
732 if (compositor_needs_continuous_invalidate_ && compositor_) 735 if (compositor_needs_continuous_invalidate_ && compositor_) {
733 ForceFakeCompositeSW(); 736 ForceFakeCompositeSW();
737 } else {
738 // Pretend we just composited to unblock further invalidates.
739 DidComposite();
740 }
734 } 741 }
735 742
736 void BrowserViewRenderer::ForceFakeCompositeSW() { 743 void BrowserViewRenderer::ForceFakeCompositeSW() {
737 DCHECK(compositor_); 744 DCHECK(compositor_);
738 SkBitmap bitmap; 745 SkBitmap bitmap;
739 bitmap.allocN32Pixels(1, 1); 746 bitmap.allocN32Pixels(1, 1);
740 bitmap.eraseColor(0); 747 bitmap.eraseColor(0);
741 SkCanvas canvas(bitmap); 748 SkCanvas canvas(bitmap);
742 CompositeSW(&canvas); 749 CompositeSW(&canvas);
743 } 750 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 base::StringAppendF(&str, 798 base::StringAppendF(&str,
792 "surface width height: [%d %d] ", 799 "surface width height: [%d %d] ",
793 draw_info->width, 800 draw_info->width,
794 draw_info->height); 801 draw_info->height);
795 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); 802 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer);
796 } 803 }
797 return str; 804 return str;
798 } 805 }
799 806
800 } // namespace android_webview 807 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698