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

Side by Side Diff: base/run_loop.cc

Issue 2571473002: Fix cases where RunLoop is created without a MessageLoop. (Closed)
Patch Set: Fix chromeos tests. Created 4 years 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
« no previous file with comments | « no previous file | base/timer/timer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
11 namespace base { 11 namespace base {
12 12
13 RunLoop::RunLoop() 13 RunLoop::RunLoop()
14 : loop_(MessageLoop::current()), 14 : loop_(MessageLoop::current()),
15 previous_run_loop_(NULL), 15 previous_run_loop_(NULL),
16 run_depth_(0), 16 run_depth_(0),
17 run_called_(false), 17 run_called_(false),
18 quit_called_(false), 18 quit_called_(false),
19 running_(false), 19 running_(false),
20 quit_when_idle_received_(false), 20 quit_when_idle_received_(false),
21 weak_factory_(this) { 21 weak_factory_(this) {
22 DCHECK(loop_);
22 } 23 }
23 24
24 RunLoop::~RunLoop() { 25 RunLoop::~RunLoop() {
25 } 26 }
26 27
27 void RunLoop::Run() { 28 void RunLoop::Run() {
28 DCHECK(thread_checker_.CalledOnValidThread()); 29 DCHECK(thread_checker_.CalledOnValidThread());
29 if (!BeforeRun()) 30 if (!BeforeRun())
30 return; 31 return;
31 32
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 92
92 // Pop RunLoop stack: 93 // Pop RunLoop stack:
93 loop_->run_loop_ = previous_run_loop_; 94 loop_->run_loop_ = previous_run_loop_;
94 95
95 // Execute deferred QuitNow, if any: 96 // Execute deferred QuitNow, if any:
96 if (previous_run_loop_ && previous_run_loop_->quit_called_) 97 if (previous_run_loop_ && previous_run_loop_->quit_called_)
97 loop_->QuitNow(); 98 loop_->QuitNow();
98 } 99 }
99 100
100 } // namespace base 101 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/timer/timer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698