| 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 ac9bf2f8fb161ccc8b225d26737a6b9b1006143f..b58721d127a47470d19fe3b67bd16d492f4dd95a 100644
|
| --- a/android_webview/browser/browser_view_renderer.cc
|
| +++ b/android_webview/browser/browser_view_renderer.cc
|
| @@ -68,7 +68,6 @@ BrowserViewRenderer::BrowserViewRenderer(
|
| page_scale_factor_(1.0),
|
| on_new_picture_enable_(false),
|
| clear_view_(false),
|
| - invalidate_after_composite_(false),
|
| block_invalidates_(false),
|
| fallback_tick_pending_(false) {
|
| }
|
| @@ -177,36 +176,12 @@ bool BrowserViewRenderer::OnDrawHardware() {
|
| return false;
|
| }
|
|
|
| - if (last_on_draw_global_visible_rect_.IsEmpty() &&
|
| - parent_draw_constraints_.surface_rect.IsEmpty()) {
|
| - TRACE_EVENT_INSTANT0("android_webview",
|
| - "EarlyOut_EmptyVisibleRect",
|
| - TRACE_EVENT_SCOPE_THREAD);
|
| - shared_renderer_state_.SetForceInvalidateOnNextDrawGLOnUI(true);
|
| - return true;
|
| - }
|
| + return CompositeHw();
|
| +}
|
|
|
| +bool BrowserViewRenderer::CompositeHw() {
|
| 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;
|
| -}
|
|
|
| -scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
|
| compositor_->SetMemoryPolicy(CalculateDesiredMemoryPolicy());
|
|
|
| parent_draw_constraints_ =
|
| @@ -221,8 +196,7 @@ scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
|
| // applied onto the layer so global visible rect does not make sense here.
|
| // In this case, just use the surface rect for tiling.
|
| gfx::Rect viewport_rect_for_tile_priority;
|
| - 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_;
|
| @@ -235,30 +209,23 @@ scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
|
| clip,
|
| viewport_rect_for_tile_priority,
|
| transform_for_tile_priority);
|
| - if (frame.get())
|
| - DidComposite();
|
| - return frame.Pass();
|
| -}
|
|
|
| -void BrowserViewRenderer::ForceCompositeHw() {
|
| - ReturnResourceFromParent();
|
| - ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI());
|
| - scoped_ptr<cc::CompositorFrame> frame = CompositeHw();
|
| - if (frame.get()) {
|
| - shared_renderer_state_.SetCompositorFrameOnUI(frame.Pass(), true);
|
| + if (!frame.get()) {
|
| + TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame",
|
| + TRACE_EVENT_SCOPE_THREAD);
|
| + return false;
|
| }
|
| +
|
| + DidComposite();
|
| + ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI());
|
| + 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);
|
| - PostInvalidateWithFallback(needs_force_invalidate);
|
| + PostInvalidateWithFallback();
|
| }
|
| }
|
|
|
| @@ -282,11 +249,6 @@ void BrowserViewRenderer::ReturnResourceFromParent() {
|
| }
|
| }
|
|
|
| -void BrowserViewRenderer::DidSkipCommitFrame() {
|
| - // Treat it the same way as skipping onDraw.
|
| - DidSkipCompositeInDraw();
|
| -}
|
| -
|
| void BrowserViewRenderer::InvalidateOnFunctorDestroy() {
|
| client_->InvalidateOnFunctorDestroy();
|
| }
|
| @@ -331,7 +293,7 @@ void BrowserViewRenderer::ClearView() {
|
|
|
| clear_view_ = true;
|
| // Always invalidate ignoring the compositor to actually clear the webview.
|
| - PostInvalidateWithFallback(false);
|
| + PostInvalidateWithFallback();
|
| }
|
|
|
| void BrowserViewRenderer::SetIsPaused(bool paused) {
|
| @@ -603,13 +565,11 @@ void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll,
|
| void BrowserViewRenderer::PostInvalidate() {
|
| TRACE_EVENT_INSTANT0("android_webview", "BrowserViewRenderer::PostInvalidate",
|
| TRACE_EVENT_SCOPE_THREAD);
|
| - PostInvalidateWithFallback(false);
|
| + PostInvalidateWithFallback();
|
| }
|
|
|
| -void BrowserViewRenderer::PostInvalidateWithFallback(
|
| - bool skip_reschedule_tick) {
|
| +void BrowserViewRenderer::PostInvalidateWithFallback() {
|
| if (block_invalidates_) {
|
| - invalidate_after_composite_ = true;
|
| return;
|
| }
|
|
|
| @@ -617,9 +577,6 @@ void BrowserViewRenderer::PostInvalidateWithFallback(
|
| // invalidate when it's not needed such as when view is not visible.
|
| client_->PostInvalidate();
|
|
|
| - // Always clear any queued invalidates when posting a new one.
|
| - invalidate_after_composite_ = false;
|
| -
|
| // Stop fallback ticks when one of these is true.
|
| // 1) Webview is paused. Also need to check we are not in clear view since
|
| // paused, offscreen still expect clear view to recover.
|
| @@ -637,7 +594,7 @@ void BrowserViewRenderer::PostInvalidateWithFallback(
|
| // tick and invalidates will be unblocked.
|
| block_invalidates_ = true;
|
|
|
| - if (skip_reschedule_tick && fallback_tick_pending_)
|
| + if (fallback_tick_pending_)
|
| return;
|
|
|
| post_fallback_tick_.Reset(base::Bind(&BrowserViewRenderer::PostFallbackTick,
|
| @@ -670,7 +627,7 @@ void BrowserViewRenderer::FallbackTickFired() {
|
| fallback_tick_pending_ = false;
|
| if (compositor_) {
|
| if (hardware_enabled_) {
|
| - ForceCompositeHw();
|
| + CompositeHw();
|
| } else {
|
| ForceFakeCompositeSW();
|
| }
|
| @@ -702,14 +659,6 @@ void BrowserViewRenderer::DidComposite() {
|
| post_fallback_tick_.Cancel();
|
| fallback_tick_fired_.Cancel();
|
| fallback_tick_pending_ = false;
|
| -
|
| - if (invalidate_after_composite_)
|
| - PostInvalidateWithFallback(false);
|
| -}
|
| -
|
| -void BrowserViewRenderer::DidSkipCompositeInDraw() {
|
| - block_invalidates_ = false;
|
| - PostInvalidateWithFallback(true);
|
| }
|
|
|
| void BrowserViewRenderer::UpdateCompositorIsActive() {
|
| @@ -725,8 +674,6 @@ std::string BrowserViewRenderer::ToString() const {
|
| base::StringAppendF(&str, "window_visible: %d ", window_visible_);
|
| base::StringAppendF(&str, "dip_scale: %f ", dip_scale_);
|
| base::StringAppendF(&str, "page_scale_factor: %f ", page_scale_factor_);
|
| - base::StringAppendF(&str, "invalidate_after_composite: %d ",
|
| - invalidate_after_composite_);
|
| base::StringAppendF(&str, "block_invalidates: %d ", block_invalidates_);
|
| base::StringAppendF(&str, "fallback_tick_pending: %d ",
|
| fallback_tick_pending_);
|
|
|