| 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 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 RunLoop::~RunLoop() { | 44 RunLoop::~RunLoop() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 void RunLoop::Run() { | 47 void RunLoop::Run() { |
| 48 if (!BeforeRun()) | 48 if (!BeforeRun()) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 // Use task stopwatch to exclude the loop run time from the current task, if | 51 // Use task stopwatch to exclude the loop run time from the current task, if |
| 52 // any. | 52 // any. |
| 53 tracked_objects::TaskStopwatch stopwatch; | 53 tracked_objects::TaskStopwatch stopwatch; |
| 54 stopwatch.Start(); |
| 54 loop_->RunHandler(); | 55 loop_->RunHandler(); |
| 55 stopwatch.Stop(); | 56 stopwatch.Stop(); |
| 56 | 57 |
| 57 AfterRun(); | 58 AfterRun(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void RunLoop::RunUntilIdle() { | 61 void RunLoop::RunUntilIdle() { |
| 61 quit_when_idle_received_ = true; | 62 quit_when_idle_received_ = true; |
| 62 Run(); | 63 Run(); |
| 63 } | 64 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 97 |
| 97 // Pop RunLoop stack: | 98 // Pop RunLoop stack: |
| 98 loop_->run_loop_ = previous_run_loop_; | 99 loop_->run_loop_ = previous_run_loop_; |
| 99 | 100 |
| 100 // Execute deferred QuitNow, if any: | 101 // Execute deferred QuitNow, if any: |
| 101 if (previous_run_loop_ && previous_run_loop_->quit_called_) | 102 if (previous_run_loop_ && previous_run_loop_->quit_called_) |
| 102 loop_->QuitNow(); | 103 loop_->QuitNow(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace base | 106 } // namespace base |
| OLD | NEW |