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

Side by Side Diff: ash/accelerators/nested_dispatcher_controller.cc

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 Created 6 years, 8 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 "ash/accelerators/nested_dispatcher_controller.h" 5 #include "ash/accelerators/nested_dispatcher_controller.h"
6 6
7 #include "ash/accelerators/accelerator_dispatcher.h" 7 #include "ash/accelerators/accelerator_dispatcher.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 11
12 namespace ash { 12 namespace ash {
13 13
14 NestedDispatcherController::NestedDispatcherController() { 14 NestedDispatcherController::NestedDispatcherController() {
15 } 15 }
16 16
17 NestedDispatcherController::~NestedDispatcherController() { 17 NestedDispatcherController::~NestedDispatcherController() {
18 } 18 }
19 19
20 void NestedDispatcherController::RunWithDispatcher( 20 void NestedDispatcherController::RunWithDispatcher(
21 base::MessagePumpDispatcher* nested_dispatcher) { 21 base::MessagePumpDispatcher* nested_dispatcher) {
22 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); 22 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
23 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); 23 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
24 24
25 AcceleratorDispatcher dispatcher(nested_dispatcher); 25 scoped_ptr<AcceleratorDispatcher> old_accelerator_dispatcher =
26 accelerator_dispatcher_.Pass();
27 accelerator_dispatcher_ = AcceleratorDispatcher::Create(nested_dispatcher);
26 28
27 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 29 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
28 // use run_loop.QuitClosure(). 30 // use run_loop.QuitClosure().
29 base::RunLoop run_loop(&dispatcher); 31 scoped_ptr<base::RunLoop> run_loop = accelerator_dispatcher_->CreateRunLoop();
30 base::AutoReset<base::Closure> reset_closure(&quit_closure_, 32 base::AutoReset<base::Closure> reset_closure(&quit_closure_,
31 run_loop.QuitClosure()); 33 run_loop->QuitClosure());
32 run_loop.Run(); 34 run_loop->Run();
35 accelerator_dispatcher_ = old_accelerator_dispatcher.Pass();
33 } 36 }
34 37
35 void NestedDispatcherController::QuitNestedMessageLoop() { 38 void NestedDispatcherController::QuitNestedMessageLoop() {
36 CHECK(!quit_closure_.is_null()); 39 CHECK(!quit_closure_.is_null());
37 quit_closure_.Run(); 40 quit_closure_.Run();
41 accelerator_dispatcher_.reset();
38 } 42 }
39 43
40 } // namespace ash 44 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/nested_dispatcher_controller.h ('k') | ash/accelerators/nested_dispatcher_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698