summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 07:47:06 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 07:47:06 +0000
commitde679e42fd50c76c222f7af40d7217eb895e97cf (patch)
treee72595f92c37a875408d5c3c6ab7f55d3047fc25 /ui
parentfef74fd43661ab2837970d255141b6308aac18bc (diff)
downloadchromium_src-de679e42fd50c76c222f7af40d7217eb895e97cf.zip
chromium_src-de679e42fd50c76c222f7af40d7217eb895e97cf.tar.gz
chromium_src-de679e42fd50c76c222f7af40d7217eb895e97cf.tar.bz2
Revert of Use the default dispatcher where possible for nested message loops. (https://codereview.chromium.org/182143002/)
Reason for revert: win debug interactive_ui_tests: BookmarkBarViewTest12.CloseWithModalDialog (run #1): [ RUN ] BookmarkBarViewTest12.CloseWithModalDialog [3940:2156:0226/224958:2493504:FATAL:desktop_dispatcher_client.cc(33)] Check failed: !quit_closure_.is_null(). Original issue's description: > Use the default dispatcher where possible for nested message loops. > > Notable changes: > * Add QuitNestedMessageLoop() to client::DispatcherClient, which can be used to > terminate a nested loop started by RunWithDispatcher(). > * FirstRunDialog and SimpleMessageBoxViews are no longer > MessagePumpDispatchers. The default dispatcher is used instead, and > QuitNestedMessageLoop() is called to terminate the loop instead of returning > POST_DISPATCH_QUIT_LOOP from the Dispatch() override. > > BUG=none > R=sky@chromium.org > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=253723 TBR=sky@chromium.org,sadrul@chromium.org NOTREECHECKS=true NOTRY=true BUG=none Review URL: https://codereview.chromium.org/182753002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/client/dispatcher_client.h2
-rw-r--r--ui/views/controls/menu/menu_controller.cc22
-rw-r--r--ui/views/widget/desktop_aura/desktop_dispatcher_client.cc8
-rw-r--r--ui/views/widget/desktop_aura/desktop_dispatcher_client.h4
4 files changed, 8 insertions, 28 deletions
diff --git a/ui/aura/client/dispatcher_client.h b/ui/aura/client/dispatcher_client.h
index 769c266..ae8c84c 100644
--- a/ui/aura/client/dispatcher_client.h
+++ b/ui/aura/client/dispatcher_client.h
@@ -18,8 +18,6 @@ class AURA_EXPORT DispatcherClient {
public:
virtual void RunWithDispatcher(base::MessagePumpDispatcher* dispatcher,
aura::Window* associated_window) = 0;
-
- virtual void QuitNestedMessageLoop() = 0;
};
AURA_EXPORT void SetDispatcherClient(Window* root_window,
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index d288623..00cedd9 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -13,7 +13,6 @@
#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"
@@ -2304,23 +2303,18 @@ 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. 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.
+ // 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.
//
- // It's safe to invoke QuitNestedMessageLoop() multiple times, it only effects
- // the current loop.
+ // It's safe to invoke QuitNow multiple times, it only effects the current
+ // loop.
bool quit_now = ShouldQuitNow() && exit_type_ != EXIT_NONE &&
message_loop_depth_;
- if (quit_now) {
- if (owner_) {
- aura::Window* root = owner_->GetNativeWindow()->GetRootWindow();
- aura::client::GetDispatcherClient(root)->QuitNestedMessageLoop();
- } else {
- base::MessageLoop::current()->QuitNow();
- }
- }
+ if (quit_now)
+ base::MessageLoop::current()->QuitNow();
}
void MenuController::HandleMouseLocation(SubmenuView* source,
diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
index 977d0de..be251da 100644
--- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
@@ -4,7 +4,6 @@
#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
-#include "base/auto_reset.h"
#include "base/run_loop.h"
namespace views {
@@ -24,14 +23,7 @@ void DesktopDispatcherClient::RunWithDispatcher(
base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
base::RunLoop run_loop(nested_dispatcher);
- base::AutoReset<base::Closure> reset_closure(&quit_closure_,
- run_loop.QuitClosure());
run_loop.Run();
}
-void DesktopDispatcherClient::QuitNestedMessageLoop() {
- CHECK(!quit_closure_.is_null());
- quit_closure_.Run();
-}
-
} // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
index 1af8f94..b59f4da 100644
--- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
+++ b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
@@ -6,7 +6,6 @@
#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_H_
#include "base/basictypes.h"
-#include "base/callback.h"
#include "ui/aura/client/dispatcher_client.h"
#include "ui/views/views_export.h"
@@ -21,11 +20,8 @@ class VIEWS_EXPORT DesktopDispatcherClient
virtual void RunWithDispatcher(base::MessagePumpDispatcher* dispatcher,
aura::Window* associated_window) OVERRIDE;
- virtual void QuitNestedMessageLoop() OVERRIDE;
private:
- base::Closure quit_closure_;
-
DISALLOW_COPY_AND_ASSIGN(DesktopDispatcherClient);
};