| 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/platform_thread.h" | 5 #include "base/threading/platform_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/debug/activity_tracker.h" | |
| 10 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 11 #include "base/debug/profiler.h" | 10 #include "base/debug/profiler.h" |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 13 #include "base/threading/thread_id_name_manager.h" | 12 #include "base/threading/thread_id_name_manager.h" |
| 14 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 15 #include "base/tracked_objects.h" | 14 #include "base/tracked_objects.h" |
| 16 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
| 17 | 16 |
| 18 namespace base { | 17 namespace base { |
| 19 | 18 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // static | 203 // static |
| 205 bool PlatformThread::CreateNonJoinableWithPriority(size_t stack_size, | 204 bool PlatformThread::CreateNonJoinableWithPriority(size_t stack_size, |
| 206 Delegate* delegate, | 205 Delegate* delegate, |
| 207 ThreadPriority priority) { | 206 ThreadPriority priority) { |
| 208 return CreateThreadInternal(stack_size, delegate, nullptr /* non-joinable */, | 207 return CreateThreadInternal(stack_size, delegate, nullptr /* non-joinable */, |
| 209 priority); | 208 priority); |
| 210 } | 209 } |
| 211 | 210 |
| 212 // static | 211 // static |
| 213 void PlatformThread::Join(PlatformThreadHandle thread_handle) { | 212 void PlatformThread::Join(PlatformThreadHandle thread_handle) { |
| 214 // Record the event that this thread is blocking upon (for hang diagnosis). | |
| 215 base::debug::ScopedThreadJoinActivity thread_activity(&thread_handle); | |
| 216 | |
| 217 DCHECK(thread_handle.platform_handle()); | 213 DCHECK(thread_handle.platform_handle()); |
| 218 // TODO(willchan): Enable this check once I can get it to work for Windows | 214 // TODO(willchan): Enable this check once I can get it to work for Windows |
| 219 // shutdown. | 215 // shutdown. |
| 220 // Joining another thread may block the current thread for a long time, since | 216 // Joining another thread may block the current thread for a long time, since |
| 221 // the thread referred to by |thread_handle| may still be running long-lived / | 217 // the thread referred to by |thread_handle| may still be running long-lived / |
| 222 // blocking tasks. | 218 // blocking tasks. |
| 223 #if 0 | 219 #if 0 |
| 224 base::ThreadRestrictions::AssertIOAllowed(); | 220 base::ThreadRestrictions::AssertIOAllowed(); |
| 225 #endif | 221 #endif |
| 226 | 222 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 return ThreadPriority::REALTIME_AUDIO; | 283 return ThreadPriority::REALTIME_AUDIO; |
| 288 case THREAD_PRIORITY_ERROR_RETURN: | 284 case THREAD_PRIORITY_ERROR_RETURN: |
| 289 DPCHECK(false) << "GetThreadPriority error"; // Falls through. | 285 DPCHECK(false) << "GetThreadPriority error"; // Falls through. |
| 290 default: | 286 default: |
| 291 NOTREACHED() << "Unexpected priority: " << priority; | 287 NOTREACHED() << "Unexpected priority: " << priority; |
| 292 return ThreadPriority::NORMAL; | 288 return ThreadPriority::NORMAL; |
| 293 } | 289 } |
| 294 } | 290 } |
| 295 | 291 |
| 296 } // namespace base | 292 } // namespace base |
| OLD | NEW |