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

Unified Diff: content/browser/web_contents/aura/overscroll_navigation_overlay.cc

Issue 202183003: Fixing race conditions in ui::content::WindowSlider which could cause the overscroll overlay to nev… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming Delegate's methods Created 6 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: content/browser/web_contents/aura/overscroll_navigation_overlay.cc
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
index 8c47a7b1ff1b50a50540f896722b3aefcf10ca29..ac7b20c3af495bb144a507669e3b605818bfc14f 100644
--- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
+++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
@@ -9,6 +9,7 @@
#include "content/browser/web_contents/aura/image_window_delegate.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
@@ -236,29 +237,18 @@ ui::Layer* OverscrollNavigationOverlay::CreateFrontLayer() {
return CreateSlideLayer(1);
}
-void OverscrollNavigationOverlay::OnWindowSlideComplete() {
- if (slide_direction_ == SLIDE_UNKNOWN) {
- window_slider_.reset();
- StopObservingIfDone();
+void OverscrollNavigationOverlay::OnWindowSlideCompleting() {
+ if (slide_direction_ == SLIDE_UNKNOWN)
return;
- }
-
- // Change the image used for the overlay window.
- image_delegate_->SetImage(layer_delegate_->image());
- window_->layer()->SetTransform(gfx::Transform());
- window_->SchedulePaintInRect(gfx::Rect(window_->bounds().size()));
-
- SlideDirection direction = slide_direction_;
- slide_direction_ = SLIDE_UNKNOWN;
// Reset state and wait for the new navigation page to complete
// loading/painting.
StartObserving();
// Perform the navigation.
- if (direction == SLIDE_BACK)
+ if (slide_direction_ == SLIDE_BACK)
web_contents_->GetController().GoBack();
- else if (direction == SLIDE_FRONT)
+ else if (slide_direction_ == SLIDE_FRONT)
web_contents_->GetController().GoForward();
else
NOTREACHED();
@@ -271,6 +261,34 @@ void OverscrollNavigationOverlay::OnWindowSlideComplete() {
pending_entry_id_ = pending_entry ? pending_entry->GetUniqueID() : 0;
}
+void OverscrollNavigationOverlay::OnWindowSlideCompleted() {
+ if (slide_direction_ == SLIDE_UNKNOWN) {
+ window_slider_.reset();
+ StopObservingIfDone();
+ return;
+ }
+
+ // Change the image used for the overlay window.
+ image_delegate_->SetImage(layer_delegate_->image());
+ window_->layer()->SetTransform(gfx::Transform());
+ window_->SchedulePaintInRect(gfx::Rect(window_->bounds().size()));
+ slide_direction_ = SLIDE_UNKNOWN;
+
+ // Make sure the overlay layer is repainted before we dismiss it, otherwise
+ // OverlayDismissAnimator may end up showing the wrong screenshot during the
+ // fadeout animation.
+ if (received_paint_update_ && need_paint_update_) {
+ received_paint_update_ = false;
+ RenderWidgetHost* host =
+ web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost();
+ RenderViewHostImpl* view_host =
+ static_cast<RenderViewHostImpl*> (RenderViewHost::From(host));
+ view_host->ScheduleComposite();
+ } else if (!need_paint_update_) {
+ StopObservingIfDone();
+ }
+}
+
void OverscrollNavigationOverlay::OnWindowSlideAborted() {
StopObservingIfDone();
}

Powered by Google App Engine
This is Rietveld 408576698