| 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/threading/thread.h" | 5 #include "base/threading/thread.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 bool Thread::GetThreadWasQuitProperly() { | 254 bool Thread::GetThreadWasQuitProperly() { |
| 255 bool quit_properly = true; | 255 bool quit_properly = true; |
| 256 #ifndef NDEBUG | 256 #ifndef NDEBUG |
| 257 quit_properly = lazy_tls_bool.Pointer()->Get(); | 257 quit_properly = lazy_tls_bool.Pointer()->Get(); |
| 258 #endif | 258 #endif |
| 259 return quit_properly; | 259 return quit_properly; |
| 260 } | 260 } |
| 261 | 261 |
| 262 void Thread::SetMessageLoop(MessageLoop* message_loop) { | 262 void Thread::SetMessageLoop(MessageLoop* message_loop) { |
| 263 DCHECK(owning_sequence_checker_.CalledOnValidSequence()); | 263 DCHECK(owning_sequence_checker_.CalledOnValidSequence()); |
| 264 | 264 DCHECK(message_loop); |
| 265 // TODO(gab): Figure out why some callers pass in a null |message_loop|... | |
| 266 // https://crbug.com/629139#c15 | |
| 267 // DCHECK(message_loop); | |
| 268 if (!message_loop) | |
| 269 return; | |
| 270 | 265 |
| 271 // Setting |message_loop_| should suffice for this thread to be considered | 266 // Setting |message_loop_| should suffice for this thread to be considered |
| 272 // as "running", until Stop() is invoked. | 267 // as "running", until Stop() is invoked. |
| 273 DCHECK(!IsRunning()); | 268 DCHECK(!IsRunning()); |
| 274 message_loop_ = message_loop; | 269 message_loop_ = message_loop; |
| 275 DCHECK(IsRunning()); | 270 DCHECK(IsRunning()); |
| 276 | 271 |
| 277 using_external_message_loop_ = true; | 272 using_external_message_loop_ = true; |
| 278 } | 273 } |
| 279 | 274 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 run_loop_ = nullptr; | 352 run_loop_ = nullptr; |
| 358 } | 353 } |
| 359 | 354 |
| 360 void Thread::ThreadQuitHelper() { | 355 void Thread::ThreadQuitHelper() { |
| 361 DCHECK(run_loop_); | 356 DCHECK(run_loop_); |
| 362 run_loop_->QuitWhenIdle(); | 357 run_loop_->QuitWhenIdle(); |
| 363 SetThreadWasQuitProperly(true); | 358 SetThreadWasQuitProperly(true); |
| 364 } | 359 } |
| 365 | 360 |
| 366 } // namespace base | 361 } // namespace base |
| OLD | NEW |