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

Unified Diff: ui/views/widget/desktop_aura/desktop_dispatcher_client.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
Index: ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
index 9962eaa0ec15bb7f00587a7db152710f16f6cc83..4b8ca2db08d6e01b821f7999a723fc6f7b591f08 100644
--- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
@@ -5,44 +5,29 @@
#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
#include "base/auto_reset.h"
+#include "base/bind.h"
#include "base/run_loop.h"
namespace views {
-DesktopDispatcherClient::DesktopDispatcherClient()
- : weak_ptr_factory_(this) {}
+DesktopDispatcherClient::DesktopDispatcherClient() {
+}
DesktopDispatcherClient::~DesktopDispatcherClient() {
}
-void DesktopDispatcherClient::RunWithDispatcher(
- base::MessagePumpDispatcher* nested_dispatcher) {
- // TODO(erg): This class has been copypastad from
- // ash/accelerators/nested_dispatcher_controller.cc. I have left my changes
- // commented out because I don't entirely understand the implications of the
- // change.
- base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
- base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
-
- base::Closure old_quit_closure = quit_closure_;
+void DesktopDispatcherClient::PrepareNestedLoopClosures(
+ base::MessagePumpDispatcher* dispatcher,
+ base::Closure* run_closure,
+ base::Closure* quit_closure) {
#if defined(OS_WIN)
- base::RunLoop run_loop(nested_dispatcher);
+ scoped_ptr<base::RunLoop> run_loop(new base::RunLoop(dispatcher));
#else
- base::RunLoop run_loop;
+ scoped_ptr<base::RunLoop> run_loop(new base::RunLoop());
#endif
-
- quit_closure_ = run_loop.QuitClosure();
- base::WeakPtr<DesktopDispatcherClient> alive(weak_ptr_factory_.GetWeakPtr());
- run_loop.Run();
- if (alive) {
- weak_ptr_factory_.InvalidateWeakPtrs();
- quit_closure_ = old_quit_closure;
- }
-}
-
-void DesktopDispatcherClient::QuitNestedMessageLoop() {
- CHECK(!quit_closure_.is_null());
- quit_closure_.Run();
+ *quit_closure = run_loop->QuitClosure();
+ *run_closure =
+ base::Bind(&base::RunLoop::Run, base::Owned(run_loop.release()));
}
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698