OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <stdbool.h> |
| 6 #include <stddef.h> |
| 7 #include <string> |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" |
| 13 #include "base/message_loop_proxy.h" |
| 14 #include "base/ref_counted.h" |
| 15 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/task.h" |
| 17 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 18 #include "base/threading/platform_thread.h" |
5 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
6 | |
7 #include "base/lazy_instance.h" | |
8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | |
9 #include "base/threading/thread_local.h" | 20 #include "base/threading/thread_local.h" |
10 #include "base/synchronization/waitable_event.h" | 21 #include "base/tracked.h" |
11 | 22 |
12 namespace base { | 23 namespace base { |
13 | 24 |
14 namespace { | 25 namespace { |
15 | 26 |
16 // We use this thread-local variable to record whether or not a thread exited | 27 // We use this thread-local variable to record whether or not a thread exited |
17 // because its Stop method was called. This allows us to catch cases where | 28 // because its Stop method was called. This allows us to catch cases where |
18 // MessageLoop::Quit() is called directly, which is unexpected when using a | 29 // MessageLoop::Quit() is called directly, which is unexpected when using a |
19 // Thread to setup and run a MessageLoop. | 30 // Thread to setup and run a MessageLoop. |
20 base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool( | 31 base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool( |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 182 |
172 // We can't receive messages anymore. | 183 // We can't receive messages anymore. |
173 message_loop_ = NULL; | 184 message_loop_ = NULL; |
174 message_loop_proxy_ = NULL; | 185 message_loop_proxy_ = NULL; |
175 } | 186 } |
176 CleanUpAfterMessageLoopDestruction(); | 187 CleanUpAfterMessageLoopDestruction(); |
177 thread_id_ = kInvalidThreadId; | 188 thread_id_ = kInvalidThreadId; |
178 } | 189 } |
179 | 190 |
180 } // namespace base | 191 } // namespace base |
OLD | NEW |