| 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 #include "base/tracked_objects.h" | 8 #include "base/tracked_objects.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // Allow Quit to be called before Run. | 62 // Allow Quit to be called before Run. |
| 63 if (quit_called_) | 63 if (quit_called_) |
| 64 return false; | 64 return false; |
| 65 | 65 |
| 66 // Push RunLoop stack: | 66 // Push RunLoop stack: |
| 67 previous_run_loop_ = loop_->run_loop_; | 67 previous_run_loop_ = loop_->run_loop_; |
| 68 run_depth_ = previous_run_loop_? previous_run_loop_->run_depth_ + 1 : 1; | 68 run_depth_ = previous_run_loop_? previous_run_loop_->run_depth_ + 1 : 1; |
| 69 loop_->run_loop_ = this; | 69 loop_->run_loop_ = this; |
| 70 | 70 |
| 71 if (run_depth_ > 1) |
| 72 loop_->NotifyBeginNestedLoop(); |
| 73 |
| 71 running_ = true; | 74 running_ = true; |
| 72 return true; | 75 return true; |
| 73 } | 76 } |
| 74 | 77 |
| 75 void RunLoop::AfterRun() { | 78 void RunLoop::AfterRun() { |
| 76 running_ = false; | 79 running_ = false; |
| 77 | 80 |
| 78 // Pop RunLoop stack: | 81 // Pop RunLoop stack: |
| 79 loop_->run_loop_ = previous_run_loop_; | 82 loop_->run_loop_ = previous_run_loop_; |
| 80 | 83 |
| 81 // Execute deferred QuitNow, if any: | 84 // Execute deferred QuitNow, if any: |
| 82 if (previous_run_loop_ && previous_run_loop_->quit_called_) | 85 if (previous_run_loop_ && previous_run_loop_->quit_called_) |
| 83 loop_->QuitNow(); | 86 loop_->QuitNow(); |
| 84 } | 87 } |
| 85 | 88 |
| 86 } // namespace base | 89 } // namespace base |
| OLD | NEW |