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

Unified Diff: android_webview/browser/browser_view_renderer.cc

Issue 1001643004: Remove android webview rendering cruft (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/browser_view_renderer.cc
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc
index ea9d60312836a4a3c45dc9dd20850bf05028defd..3d843e934e65498e9ae8358a2cd7e7e927f834cd 100644
--- a/android_webview/browser/browser_view_renderer.cc
+++ b/android_webview/browser/browser_view_renderer.cc
@@ -98,7 +98,6 @@ BrowserViewRenderer::BrowserViewRenderer(
clear_view_(false),
offscreen_pre_raster_(false),
compositor_needs_continuous_invalidate_(false),
- invalidate_after_composite_(false),
block_invalidates_(false),
fallback_tick_pending_(false) {
}
@@ -216,27 +215,11 @@ bool BrowserViewRenderer::OnDrawHardware() {
return false;
}
- ReturnResourceFromParent();
- if (shared_renderer_state_.HasCompositorFrameOnUI()) {
- TRACE_EVENT_INSTANT0("android_webview",
- "EarlyOut_PreviousFrameUnconsumed",
- TRACE_EVENT_SCOPE_THREAD);
- DidSkipCompositeInDraw();
- return true;
- }
-
- scoped_ptr<cc::CompositorFrame> frame = CompositeHw();
- if (!frame.get()) {
- TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame",
- TRACE_EVENT_SCOPE_THREAD);
- return false;
- }
-
- shared_renderer_state_.SetCompositorFrameOnUI(frame.Pass(), false);
- return true;
+ return CompositeHw();
}
-scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
+bool BrowserViewRenderer::CompositeHw() {
+ ReturnResourceFromParent();
compositor_->SetMemoryPolicy(CalculateDesiredMemoryPolicy());
parent_draw_constraints_ =
@@ -254,8 +237,7 @@ scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
// Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on.
if (!offscreen_pre_raster_) {
- if (parent_draw_constraints_.is_layer ||
- last_on_draw_global_visible_rect_.IsEmpty()) {
+ if (parent_draw_constraints_.is_layer) {
viewport_rect_for_tile_priority = parent_draw_constraints_.surface_rect;
} else {
viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_;
@@ -269,21 +251,22 @@ scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
clip,
viewport_rect_for_tile_priority,
transform_for_tile_priority);
- if (frame.get())
- DidComposite();
- return frame.Pass();
+ if (!frame.get()) {
+ TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame",
+ TRACE_EVENT_SCOPE_THREAD);
+ return false;
+ }
+
+ DidComposite();
+ ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI());
hush (inactive) 2015/03/13 18:45:17 so this is the case where the kModeDraw does not c
boliu 2015/03/18 02:02:22 This is copied from fallback tick run. So if there
+ shared_renderer_state_.SetCompositorFrameOnUI(frame.Pass());
+ return true;
}
void BrowserViewRenderer::UpdateParentDrawConstraints() {
- // Post an invalidate if the parent draw constraints are stale and there is
- // no pending invalidate.
- bool needs_force_invalidate =
- shared_renderer_state_.NeedsForceInvalidateOnNextDrawGLOnUI();
- if (needs_force_invalidate ||
- !parent_draw_constraints_.Equals(
+ if (!parent_draw_constraints_.Equals(
shared_renderer_state_.GetParentDrawConstraintsOnUI())) {
- shared_renderer_state_.SetForceInvalidateOnNextDrawGLOnUI(false);
- EnsureContinuousInvalidation(true, needs_force_invalidate);
+ EnsureContinuousInvalidation(true);
}
}
@@ -307,11 +290,6 @@ void BrowserViewRenderer::ReturnResourceFromParent() {
}
}
-void BrowserViewRenderer::DidSkipCommitFrame() {
- // Treat it the same way as skipping onDraw.
- DidSkipCompositeInDraw();
-}
-
void BrowserViewRenderer::DetachFunctorFromView() {
client_->DetachFunctorFromView();
}
@@ -356,7 +334,7 @@ void BrowserViewRenderer::ClearView() {
clear_view_ = true;
// Always invalidate ignoring the compositor to actually clear the webview.
- EnsureContinuousInvalidation(true, false);
+ EnsureContinuousInvalidation(true);
}
void BrowserViewRenderer::SetOffscreenPreRaster(bool enable) {
@@ -371,7 +349,7 @@ void BrowserViewRenderer::SetIsPaused(bool paused) {
"paused",
paused);
is_paused_ = paused;
- EnsureContinuousInvalidation(false, false);
+ EnsureContinuousInvalidation(false);
}
void BrowserViewRenderer::SetViewVisibility(bool view_visible) {
@@ -390,7 +368,7 @@ void BrowserViewRenderer::SetWindowVisibility(bool window_visible) {
"window_visible",
window_visible);
window_visible_ = window_visible;
- EnsureContinuousInvalidation(false, false);
+ EnsureContinuousInvalidation(false);
}
void BrowserViewRenderer::OnSizeChanged(int width, int height) {
@@ -471,7 +449,7 @@ void BrowserViewRenderer::SetContinuousInvalidate(bool invalidate) {
invalidate);
compositor_needs_continuous_invalidate_ = invalidate;
- EnsureContinuousInvalidation(false, false);
+ EnsureContinuousInvalidation(false);
}
void BrowserViewRenderer::SetDipScale(float dip_scale) {
@@ -642,20 +620,13 @@ void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll,
}
void BrowserViewRenderer::EnsureContinuousInvalidation(
- bool force_invalidate,
- bool skip_reschedule_tick) {
- if (force_invalidate)
- invalidate_after_composite_ = true;
-
+ bool force_invalidate) {
// This method should be called again when any of these conditions change.
bool need_invalidate =
- compositor_needs_continuous_invalidate_ || invalidate_after_composite_;
+ compositor_needs_continuous_invalidate_ || force_invalidate;
if (!need_invalidate || block_invalidates_)
return;
- if (!compositor_needs_continuous_invalidate_ && invalidate_after_composite_)
- invalidate_after_composite_ = false;
-
// Always call view invalidate. We rely the Android framework to ignore the
// invalidate when it's not needed such as when view is not visible.
client_->PostInvalidate();
@@ -672,7 +643,7 @@ void BrowserViewRenderer::EnsureContinuousInvalidation(
return;
block_invalidates_ = compositor_needs_continuous_invalidate_;
- if (skip_reschedule_tick && fallback_tick_pending_)
+ if (fallback_tick_pending_)
return;
// Unretained here is safe because the callbacks are cancelled when
@@ -718,12 +689,7 @@ void BrowserViewRenderer::FallbackTickFired() {
fallback_tick_pending_ = false;
if (compositor_needs_continuous_invalidate_ && compositor_) {
if (hardware_enabled_) {
- ReturnResourceFromParent();
- ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI());
- scoped_ptr<cc::CompositorFrame> frame = CompositeHw();
- if (frame.get()) {
- shared_renderer_state_.SetCompositorFrameOnUI(frame.Pass(), true);
- }
+ CompositeHw();
} else {
ForceFakeCompositeSW();
}
@@ -755,12 +721,7 @@ void BrowserViewRenderer::DidComposite() {
post_fallback_tick_.Cancel();
fallback_tick_fired_.Cancel();
fallback_tick_pending_ = false;
- EnsureContinuousInvalidation(false, false);
-}
-
-void BrowserViewRenderer::DidSkipCompositeInDraw() {
- block_invalidates_ = false;
- EnsureContinuousInvalidation(true, true);
+ EnsureContinuousInvalidation(false);
}
std::string BrowserViewRenderer::ToString() const {

Powered by Google App Engine
This is Rietveld 408576698