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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 135563004: Nukes MessageLoop::Dispatcher (2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windowsx.h> 8 #include <windowsx.h>
9 #endif 9 #endif
10 10
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 ViewStorage::GetInstance()->RemoveView(active_mouse_view_id_); 2288 ViewStorage::GetInstance()->RemoveView(active_mouse_view_id_);
2289 } 2289 }
2290 2290
2291 View* MenuController::GetActiveMouseView() { 2291 View* MenuController::GetActiveMouseView() {
2292 return ViewStorage::GetInstance()->RetrieveView(active_mouse_view_id_); 2292 return ViewStorage::GetInstance()->RetrieveView(active_mouse_view_id_);
2293 } 2293 }
2294 2294
2295 void MenuController::SetExitType(ExitType type) { 2295 void MenuController::SetExitType(ExitType type) {
2296 exit_type_ = type; 2296 exit_type_ = type;
2297 // Exit nested message loops as soon as possible. We do this as 2297 // Exit nested message loops as soon as possible. We do this as
2298 // MessageLoop::Dispatcher is only invoked before native events, which means 2298 // MessagePumpDispatcher is only invoked before native events, which means
2299 // its entirely possible for a Widget::CloseNow() task to be processed before 2299 // its entirely possible for a Widget::CloseNow() task to be processed before
2300 // the next native message. By using QuitNow() we ensures the nested message 2300 // the next native message. By using QuitNow() we ensures the nested message
2301 // loop returns as soon as possible and avoids having deleted views classes 2301 // loop returns as soon as possible and avoids having deleted views classes
2302 // (such as widgets and rootviews) on the stack when the nested message loop 2302 // (such as widgets and rootviews) on the stack when the nested message loop
2303 // stops. 2303 // stops.
2304 // 2304 //
2305 // It's safe to invoke QuitNow multiple times, it only effects the current 2305 // It's safe to invoke QuitNow multiple times, it only effects the current
2306 // loop. 2306 // loop.
2307 bool quit_now = ShouldQuitNow() && exit_type_ != EXIT_NONE && 2307 bool quit_now = ShouldQuitNow() && exit_type_ != EXIT_NONE &&
2308 message_loop_depth_; 2308 message_loop_depth_;
(...skipping 28 matching lines...) Expand all
2337 (!pending_state_.item->HasSubmenu() || 2337 (!pending_state_.item->HasSubmenu() ||
2338 !pending_state_.item->GetSubmenu()->IsShowing())) { 2338 !pending_state_.item->GetSubmenu()->IsShowing())) {
2339 // On exit if the user hasn't selected an item with a submenu, move the 2339 // On exit if the user hasn't selected an item with a submenu, move the
2340 // selection back to the parent menu item. 2340 // selection back to the parent menu item.
2341 SetSelection(pending_state_.item->GetParentMenuItem(), 2341 SetSelection(pending_state_.item->GetParentMenuItem(),
2342 SELECTION_OPEN_SUBMENU); 2342 SELECTION_OPEN_SUBMENU);
2343 } 2343 }
2344 } 2344 }
2345 2345
2346 } // namespace views 2346 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698