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

Unified Diff: ui/wm/core/nested_accelerator_controller.cc

Issue 280483003: wm: Change the DispatcherClient interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self-nit Created 6 years, 7 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 | « ui/wm/core/nested_accelerator_controller.h ('k') | ui/wm/core/nested_accelerator_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/nested_accelerator_controller.cc
diff --git a/ui/wm/core/nested_accelerator_controller.cc b/ui/wm/core/nested_accelerator_controller.cc
index 782ac6d891cedc35fa0b7d6ff9c1ebb825f9d17d..e4ace4f777ad42177cdd89605133622ec5e91f98 100644
--- a/ui/wm/core/nested_accelerator_controller.cc
+++ b/ui/wm/core/nested_accelerator_controller.cc
@@ -5,6 +5,7 @@
#include "ui/wm/core/nested_accelerator_controller.h"
#include "base/auto_reset.h"
+#include "base/bind.h"
#include "base/run_loop.h"
#include "ui/wm/core/nested_accelerator_delegate.h"
#include "ui/wm/core/nested_accelerator_dispatcher.h"
@@ -20,28 +21,36 @@ NestedAcceleratorController::NestedAcceleratorController(
NestedAcceleratorController::~NestedAcceleratorController() {
}
-void NestedAcceleratorController::RunWithDispatcher(
- base::MessagePumpDispatcher* nested_dispatcher) {
- base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
- base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
-
+void NestedAcceleratorController::PrepareNestedLoopClosures(
+ base::MessagePumpDispatcher* nested_dispatcher,
+ base::Closure* run_closure,
+ base::Closure* quit_closure) {
scoped_ptr<NestedAcceleratorDispatcher> old_accelerator_dispatcher =
accelerator_dispatcher_.Pass();
accelerator_dispatcher_ = NestedAcceleratorDispatcher::Create(
dispatcher_delegate_.get(), nested_dispatcher);
- // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
- // use run_loop.QuitClosure().
scoped_ptr<base::RunLoop> run_loop = accelerator_dispatcher_->CreateRunLoop();
- base::AutoReset<base::Closure> reset_closure(&quit_closure_,
- run_loop->QuitClosure());
+ *quit_closure =
+ base::Bind(&NestedAcceleratorController::QuitNestedMessageLoop,
+ base::Unretained(this),
+ run_loop->QuitClosure());
sky 2014/05/28 23:11:12 This is more of what I was thinking, but having to
sadrul 2014/05/29 00:25:39 I think that makes it possible for the wrong dispa
+ *run_closure = base::Bind(&NestedAcceleratorController::RunNestedMessageLoop,
+ base::Unretained(this),
+ base::Passed(&run_loop),
+ base::Passed(&old_accelerator_dispatcher));
+}
+
+void NestedAcceleratorController::RunNestedMessageLoop(
+ scoped_ptr<base::RunLoop> run_loop,
+ scoped_ptr<NestedAcceleratorDispatcher> old_accelerator_dispatcher) {
run_loop->Run();
accelerator_dispatcher_ = old_accelerator_dispatcher.Pass();
}
-void NestedAcceleratorController::QuitNestedMessageLoop() {
- CHECK(!quit_closure_.is_null());
- quit_closure_.Run();
+void NestedAcceleratorController::QuitNestedMessageLoop(
+ const base::Closure& quit_runloop) {
+ quit_runloop.Run();
accelerator_dispatcher_.reset();
}
« no previous file with comments | « ui/wm/core/nested_accelerator_controller.h ('k') | ui/wm/core/nested_accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698