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

Unified Diff: ui/aura/desktop_host_linux.cc

Issue 8566037: aura: Fix unit_tests on linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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 | « ui/aura/desktop.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/desktop_host_linux.cc
diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc
index 9934467fcbb2b8b49208f0a45a5fcdf60137d293..48dcf7f9800e1f586d0dfbf372a65bb6a2c0d820 100644
--- a/ui/aura/desktop_host_linux.cc
+++ b/ui/aura/desktop_host_linux.cc
@@ -222,13 +222,14 @@ bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
}
}
-class DesktopHostLinux : public DesktopHost {
+class DesktopHostLinux : public DesktopHost,
+ public MessageLoop::DestructionObserver {
public:
explicit DesktopHostLinux(const gfx::Rect& bounds);
virtual ~DesktopHostLinux();
private:
- // base::MessageLoop::Dispatcher Override.
+ // MessageLoop::Dispatcher Override.
virtual DispatchStatus Dispatch(XEvent* xev) OVERRIDE;
// DesktopHost Overrides.
@@ -243,6 +244,9 @@ class DesktopHostLinux : public DesktopHost {
virtual gfx::Point QueryMouseLocation() OVERRIDE;
virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE;
+ // MessageLoop::DestructionObserver Overrides.
+ virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
+
// Returns true if there's an X window manager present... in most cases. Some
// window managers (notably, ion3) don't implement enough of ICCCM for us to
// detect that they're there.
@@ -292,6 +296,9 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds)
if (base::MessagePumpForUI::HasXInput2())
ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_);
#endif
+
+ base::MessagePumpX::SetDefaultDispatcher(this);
+ MessageLoopForUI::current()->AddDestructionObserver(this);
}
DesktopHostLinux::~DesktopHostLinux() {
@@ -299,6 +306,9 @@ DesktopHostLinux::~DesktopHostLinux() {
// Clears XCursorCache.
ui::GetXCursor(ui::kCursorClearXCursorCache);
+
+ MessageLoopForUI::current()->RemoveDestructionObserver(this);
+ base::MessagePumpX::SetDefaultDispatcher(NULL);
}
base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
@@ -534,6 +544,10 @@ void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) {
DLOG(WARNING) << "PostEvent:" << xevent.type << ", status=" << status;
}
+void DesktopHostLinux::WillDestroyCurrentMessageLoop() {
+ desktop_->DeleteInstance();
+}
+
bool DesktopHostLinux::IsWindowManagerPresent() {
// Per ICCCM 2.8, "Manager Selections", window managers should take ownership
// of WM_Sn selections (where n is a screen number).
« no previous file with comments | « ui/aura/desktop.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698