summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/nested_dispatcher_controller.cc6
-rw-r--r--ash/drag_drop/drag_drop_controller.cc9
-rw-r--r--ash/drag_drop/drag_drop_controller.h4
-rw-r--r--ash/test/ash_test_base.cc6
-rw-r--r--ash/wm/toplevel_window_event_filter.cc11
-rw-r--r--ash/wm/toplevel_window_event_filter.h3
6 files changed, 29 insertions, 10 deletions
diff --git a/ash/accelerators/nested_dispatcher_controller.cc b/ash/accelerators/nested_dispatcher_controller.cc
index 5daeca2..45ad0e4 100644
--- a/ash/accelerators/nested_dispatcher_controller.cc
+++ b/ash/accelerators/nested_dispatcher_controller.cc
@@ -6,6 +6,7 @@
#include "ash/accelerators/accelerator_dispatcher.h"
#include "ash/shell.h"
+#include "base/run_loop.h"
namespace ash {
@@ -25,7 +26,10 @@ void NestedDispatcherController::RunWithDispatcher(
AcceleratorDispatcher dispatcher(nested_dispatcher, associated_window);
- loop->RunWithDispatcher(&dispatcher);
+ // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
+ // use run_loop.QuitClosure().
+ base::RunLoop run_loop(&dispatcher);
+ run_loop.Run();
loop->SetNestableTasksAllowed(did_allow_task_nesting);
}
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 51ca88d..dcc1029 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -7,6 +7,7 @@
#include "ash/drag_drop/drag_image_view.h"
#include "ash/shell.h"
#include "base/message_loop.h"
+#include "base/run_loop.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/cursor_manager.h"
@@ -82,9 +83,11 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
#if !defined(OS_MACOSX)
if (should_block_during_drag_drop_) {
+ base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
+ quit_closure_ = run_loop.QuitClosure();
MessageLoopForUI* loop = MessageLoopForUI::current();
MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
- loop->RunWithDispatcher(aura::Env::GetInstance()->GetDispatcher());
+ run_loop.Run();
}
#endif // !defined(OS_MACOSX)
@@ -163,7 +166,7 @@ void DragDropController::Drop(aura::Window* target,
Cleanup();
if (should_block_during_drag_drop_)
- MessageLoop::current()->QuitNow();
+ quit_closure_.Run();
}
void DragDropController::DragCancel() {
@@ -181,7 +184,7 @@ void DragDropController::DragCancel() {
drag_operation_ = 0;
StartCanceledAnimation();
if (should_block_during_drag_drop_)
- MessageLoop::current()->QuitNow();
+ quit_closure_.Run();
}
bool DragDropController::IsDragDropInProgress() {
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index d44ba20..df13d15 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -7,6 +7,7 @@
#pragma once
#include "ash/ash_export.h"
+#include "base/callback.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/event.h"
#include "ui/aura/event_filter.h"
@@ -99,6 +100,9 @@ class ASH_EXPORT DragDropController
// Only be used for tests.
bool should_block_during_drag_drop_;
+ // Closure for quitting nested message loop.
+ base::Closure quit_closure_;
+
DISALLOW_COPY_AND_ASSIGN(DragDropController);
};
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 45996b2..07f93d0 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -9,6 +9,7 @@
#include "ash/shell.h"
#include "ash/test/test_shell_delegate.h"
+#include "base/run_loop.h"
#include "base/string_split.h"
#include "content/public/test/web_contents_tester.h"
#include "ui/aura/env.h"
@@ -90,8 +91,9 @@ void AshTestBase::UpdateDisplay(const std::string& display_specs) {
void AshTestBase::RunAllPendingInMessageLoop() {
#if !defined(OS_MACOSX)
- message_loop_.RunAllPendingWithDispatcher(
- aura::Env::GetInstance()->GetDispatcher());
+ DCHECK(MessageLoopForUI::current() == &message_loop_);
+ base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
+ run_loop.RunUntilIdle();
#endif
}
diff --git a/ash/wm/toplevel_window_event_filter.cc b/ash/wm/toplevel_window_event_filter.cc
index b53f786..43abc80 100644
--- a/ash/wm/toplevel_window_event_filter.cc
+++ b/ash/wm/toplevel_window_event_filter.cc
@@ -12,6 +12,7 @@
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "base/message_loop.h"
+#include "base/run_loop.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/event.h"
@@ -98,7 +99,7 @@ bool ToplevelWindowEventFilter::PreHandleMouseEvent(aura::Window* target,
DRAG_COMPLETE : DRAG_REVERT,
event->flags());
if (in_move_loop_) {
- MessageLoop::current()->Quit();
+ quit_closure_.Run();
in_move_loop_ = false;
}
// Completing the drag may result in hiding the window. If this happens
@@ -154,7 +155,7 @@ ui::GestureStatus ToplevelWindowEventFilter::PreHandleGestureEvent(
return ui::GESTURE_STATUS_UNKNOWN;
CompleteDrag(DRAG_COMPLETE, event->flags());
if (in_move_loop_) {
- MessageLoop::current()->Quit();
+ quit_closure_.Run();
in_move_loop_ = false;
}
in_gesture_resize_ = false;
@@ -220,7 +221,9 @@ void ToplevelWindowEventFilter::RunMoveLoop(aura::Window* source) {
#if !defined(OS_MACOSX)
MessageLoopForUI* loop = MessageLoopForUI::current();
MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
- loop->RunWithDispatcher(aura::Env::GetInstance()->GetDispatcher());
+ base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
+ quit_closure_ = run_loop.QuitClosure();
+ run_loop.Run();
#endif // !defined(OS_MACOSX)
in_gesture_resize_ = in_move_loop_ = false;
}
@@ -234,7 +237,7 @@ void ToplevelWindowEventFilter::EndMoveLoop() {
window_resizer_->RevertDrag();
window_resizer_.reset();
}
- MessageLoopForUI::current()->Quit();
+ quit_closure_.Run();
}
// static
diff --git a/ash/wm/toplevel_window_event_filter.h b/ash/wm/toplevel_window_event_filter.h
index 7f0915e..377ae38 100644
--- a/ash/wm/toplevel_window_event_filter.h
+++ b/ash/wm/toplevel_window_event_filter.h
@@ -8,6 +8,7 @@
#include <set>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/window_move_client.h"
@@ -92,6 +93,8 @@ class ASH_EXPORT ToplevelWindowEventFilter :
scoped_ptr<WindowResizer> window_resizer_;
+ base::Closure quit_closure_;
+
DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventFilter);
};