| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
| 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 scaled_overscroll_delta - rounded_overscroll_delta; | 879 scaled_overscroll_delta - rounded_overscroll_delta; |
| 880 client_->DidOverscroll(rounded_overscroll_delta); | 880 client_->DidOverscroll(rounded_overscroll_delta); |
| 881 } | 881 } |
| 882 | 882 |
| 883 void InProcessViewRenderer::EnsureContinuousInvalidation( | 883 void InProcessViewRenderer::EnsureContinuousInvalidation( |
| 884 AwDrawGLInfo* draw_info, | 884 AwDrawGLInfo* draw_info, |
| 885 bool invalidate_ignore_compositor) { | 885 bool invalidate_ignore_compositor) { |
| 886 // This method should be called again when any of these conditions change. | 886 // This method should be called again when any of these conditions change. |
| 887 bool need_invalidate = | 887 bool need_invalidate = |
| 888 compositor_needs_continuous_invalidate_ || invalidate_ignore_compositor; | 888 compositor_needs_continuous_invalidate_ || invalidate_ignore_compositor; |
| 889 bool throttle = (is_paused_ && !on_new_picture_enable_) || | 889 if (!need_invalidate || block_invalidates_) |
| 890 (attached_to_window_ && !window_visible_); | |
| 891 if (!need_invalidate || block_invalidates_ || throttle) | |
| 892 return; | 890 return; |
| 893 | 891 |
| 894 if (draw_info) { | 892 if (draw_info) { |
| 895 draw_info->dirty_left = cached_global_visible_rect_.x(); | 893 draw_info->dirty_left = cached_global_visible_rect_.x(); |
| 896 draw_info->dirty_top = cached_global_visible_rect_.y(); | 894 draw_info->dirty_top = cached_global_visible_rect_.y(); |
| 897 draw_info->dirty_right = cached_global_visible_rect_.right(); | 895 draw_info->dirty_right = cached_global_visible_rect_.right(); |
| 898 draw_info->dirty_bottom = cached_global_visible_rect_.bottom(); | 896 draw_info->dirty_bottom = cached_global_visible_rect_.bottom(); |
| 899 draw_info->status_mask |= AwDrawGLInfo::kStatusMaskDraw; | 897 draw_info->status_mask |= AwDrawGLInfo::kStatusMaskDraw; |
| 900 } else { | 898 } else { |
| 901 client_->PostInvalidate(); | 899 client_->PostInvalidate(); |
| 902 } | 900 } |
| 903 | 901 |
| 902 bool throttle_fallback_tick = (is_paused_ && !on_new_picture_enable_) || |
| 903 (attached_to_window_ && !window_visible_); |
| 904 if (throttle_fallback_tick) |
| 905 return; |
| 906 |
| 904 block_invalidates_ = compositor_needs_continuous_invalidate_; | 907 block_invalidates_ = compositor_needs_continuous_invalidate_; |
| 905 | 908 |
| 906 // Unretained here is safe because the callback is cancelled when | 909 // Unretained here is safe because the callback is cancelled when |
| 907 // |fallback_tick_| is destroyed. | 910 // |fallback_tick_| is destroyed. |
| 908 fallback_tick_.Reset(base::Bind(&InProcessViewRenderer::FallbackTickFired, | 911 fallback_tick_.Reset(base::Bind(&InProcessViewRenderer::FallbackTickFired, |
| 909 base::Unretained(this))); | 912 base::Unretained(this))); |
| 910 | 913 |
| 911 // No need to reschedule fallback tick if compositor does not need to be | 914 // No need to reschedule fallback tick if compositor does not need to be |
| 912 // ticked. This can happen if this is reached because | 915 // ticked. This can happen if this is reached because |
| 913 // invalidate_ignore_compositor is true. | 916 // invalidate_ignore_compositor is true. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 base::StringAppendF(&str, | 993 base::StringAppendF(&str, |
| 991 "surface width height: [%d %d] ", | 994 "surface width height: [%d %d] ", |
| 992 draw_info->width, | 995 draw_info->width, |
| 993 draw_info->height); | 996 draw_info->height); |
| 994 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 997 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 995 } | 998 } |
| 996 return str; | 999 return str; |
| 997 } | 1000 } |
| 998 | 1001 |
| 999 } // namespace android_webview | 1002 } // namespace android_webview |
| OLD | NEW |