OLD | NEW |
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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 | 8 |
9 #if defined(USE_AURA) | |
10 #include "base/message_loop/message_pump_dispatcher.h" | |
11 #endif | |
12 | |
13 namespace base { | 9 namespace base { |
14 | 10 |
15 RunLoop::RunLoop() | 11 RunLoop::RunLoop() |
16 : loop_(MessageLoop::current()), | 12 : loop_(MessageLoop::current()), |
17 previous_run_loop_(NULL), | 13 previous_run_loop_(NULL), |
18 run_depth_(0), | 14 run_depth_(0), |
19 run_called_(false), | 15 run_called_(false), |
20 quit_called_(false), | 16 quit_called_(false), |
21 running_(false), | 17 running_(false), |
22 quit_when_idle_received_(false), | 18 quit_when_idle_received_(false), |
23 weak_factory_(this) { | 19 weak_factory_(this) { |
24 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
25 dispatcher_ = NULL; | 21 dispatcher_ = NULL; |
26 #endif | 22 #endif |
27 } | 23 } |
28 | 24 |
29 #if defined(USE_AURA) | 25 #if defined(USE_AURA) |
30 RunLoop::RunLoop(MessagePumpDispatcher* dispatcher) | 26 RunLoop::RunLoop(MessageLoop::Dispatcher* dispatcher) |
31 : loop_(MessageLoop::current()), | 27 : loop_(MessageLoop::current()), |
32 previous_run_loop_(NULL), | 28 previous_run_loop_(NULL), |
33 dispatcher_(dispatcher), | 29 dispatcher_(dispatcher), |
34 run_depth_(0), | 30 run_depth_(0), |
35 run_called_(false), | 31 run_called_(false), |
36 quit_called_(false), | 32 quit_called_(false), |
37 running_(false), | 33 running_(false), |
38 quit_when_idle_received_(false), | 34 quit_when_idle_received_(false), |
39 weak_factory_(this) { | 35 weak_factory_(this) { |
40 } | 36 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 85 |
90 // Pop RunLoop stack: | 86 // Pop RunLoop stack: |
91 loop_->run_loop_ = previous_run_loop_; | 87 loop_->run_loop_ = previous_run_loop_; |
92 | 88 |
93 // Execute deferred QuitNow, if any: | 89 // Execute deferred QuitNow, if any: |
94 if (previous_run_loop_ && previous_run_loop_->quit_called_) | 90 if (previous_run_loop_ && previous_run_loop_->quit_called_) |
95 loop_->QuitNow(); | 91 loop_->QuitNow(); |
96 } | 92 } |
97 | 93 |
98 } // namespace base | 94 } // namespace base |
OLD | NEW |