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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 192743007: Use the default dispatcher where possible for nested message loops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert change in SimpleMessageBoxViews. Created 6 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 | « ui/aura/client/dispatcher_client.h ('k') | ui/views/widget/desktop_aura/desktop_dispatcher_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index ff3a5fe1fc00fe1e307641816d6a9c4552460a07..6269224c79f6f70f145d6de7271ead47616e09eb 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -13,6 +13,7 @@
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
+#include "ui/aura/client/dispatcher_client.h"
#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/l10n/l10n_util.h"
@@ -2302,18 +2303,23 @@ void MenuController::SetExitType(ExitType type) {
// Exit nested message loops as soon as possible. We do this as
// MessagePumpDispatcher is only invoked before native events, which means
// its entirely possible for a Widget::CloseNow() task to be processed before
- // the next native message. By using QuitNow() we ensures the nested message
- // loop returns as soon as possible and avoids having deleted views classes
- // (such as widgets and rootviews) on the stack when the nested message loop
- // stops.
+ // the next native message. We quite the nested message loop as soon as
+ // possible to avoid having deleted views classes (such as widgets and
+ // rootviews) on the stack when the nested message loop stops.
//
- // It's safe to invoke QuitNow multiple times, it only effects the current
- // loop.
+ // It's safe to invoke QuitNestedMessageLoop() multiple times, it only effects
+ // the current loop.
bool quit_now = ShouldQuitNow() && exit_type_ != EXIT_NONE &&
message_loop_depth_;
- if (quit_now)
- base::MessageLoop::current()->QuitNow();
+ if (quit_now) {
+ if (owner_) {
+ aura::Window* root = owner_->GetNativeWindow()->GetRootWindow();
+ aura::client::GetDispatcherClient(root)->QuitNestedMessageLoop();
+ } else {
+ base::MessageLoop::current()->QuitNow();
+ }
+ }
}
void MenuController::HandleMouseLocation(SubmenuView* source,
« no previous file with comments | « ui/aura/client/dispatcher_client.h ('k') | ui/views/widget/desktop_aura/desktop_dispatcher_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698