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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 9703044: aura: fix hang when the content window is removed from the tree while a swap is pending (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 71ed801b5540e414c61967f395035ef04c7109a9..44887a75a2101bb6e0d38614de2105e17c47abed 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -112,10 +112,7 @@ class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver {
// Overridden from aura::WindowObserver:
virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE {
- // TODO: It would be better to not use aura::RootWindow here
- ui::Compositor* compositor = view_->GetCompositor();
- if (compositor && compositor->HasObserver(view_))
- compositor->RemoveObserver(view_);
+ view_->RemovingFromRootWindow();
}
private:
@@ -1006,12 +1003,7 @@ void RenderWidgetHostViewAura::OnLostActive() {
// RenderWidgetHostViewAura, ui::CompositorDelegate implementation:
void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) {
- for (std::vector< base::Callback<void(void)> >::const_iterator
- it = on_compositing_ended_callbacks_.begin();
- it != on_compositing_ended_callbacks_.end(); ++it) {
- it->Run();
- }
- on_compositing_ended_callbacks_.clear();
+ RunCompositingCallbacks();
compositor->RemoveObserver(this);
}
@@ -1124,6 +1116,22 @@ bool RenderWidgetHostViewAura::ShouldMoveToCenter() {
global_mouse_position_.y() > rect.bottom() - border_y;
}
+void RenderWidgetHostViewAura::RunCompositingCallbacks() {
+ for (std::vector< base::Callback<void(void)> >::const_iterator
+ it = on_compositing_ended_callbacks_.begin();
+ it != on_compositing_ended_callbacks_.end(); ++it) {
+ it->Run();
+ }
+ on_compositing_ended_callbacks_.clear();
+}
+
+void RenderWidgetHostViewAura::RemovingFromRootWindow() {
+ RunCompositingCallbacks();
sky 2012/03/15 00:30:41 Can you add a comment as to why we need to do this
piman 2012/03/15 00:38:16 Done.
+ ui::Compositor* compositor = GetCompositor();
+ if (compositor && compositor->HasObserver(this))
+ compositor->RemoveObserver(this);
+}
+
ui::Compositor* RenderWidgetHostViewAura::GetCompositor() {
aura::RootWindow* root_window = window_->GetRootWindow();
return root_window ? root_window->compositor() : NULL;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698