Chromium Code Reviews| 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/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/debug/profiler.h" | 10 #include "base/debug/profiler.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/threading/thread_id_name_manager.h" | 12 #include "base/threading/thread_id_name_manager.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "base/tracked_objects.h" | 14 #include "base/tracked_objects.h" |
| 15 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
| 16 #include "base/win/windows_version.h" | |
| 17 | 16 |
| 18 namespace base { | 17 namespace base { |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 // The information on how to set the thread name comes from | 21 // The information on how to set the thread name comes from |
| 23 // a MSDN article: http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx | 22 // a MSDN article: http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx |
| 24 const DWORD kVCThreadNameException = 0x406D1388; | 23 const DWORD kVCThreadNameException = 0x406D1388; |
| 25 | 24 |
| 26 typedef struct tagTHREADNAME_INFO { | 25 typedef struct tagTHREADNAME_INFO { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 } | 92 } |
| 94 | 93 |
| 95 // CreateThreadInternal() matches PlatformThread::CreateWithPriority(), except | 94 // CreateThreadInternal() matches PlatformThread::CreateWithPriority(), except |
| 96 // that |out_thread_handle| may be nullptr, in which case a non-joinable thread | 95 // that |out_thread_handle| may be nullptr, in which case a non-joinable thread |
| 97 // is created. | 96 // is created. |
| 98 bool CreateThreadInternal(size_t stack_size, | 97 bool CreateThreadInternal(size_t stack_size, |
| 99 PlatformThread::Delegate* delegate, | 98 PlatformThread::Delegate* delegate, |
| 100 PlatformThreadHandle* out_thread_handle, | 99 PlatformThreadHandle* out_thread_handle, |
| 101 ThreadPriority priority) { | 100 ThreadPriority priority) { |
| 102 unsigned int flags = 0; | 101 unsigned int flags = 0; |
| 103 if (stack_size > 0 && base::win::GetVersion() >= base::win::VERSION_XP) { | 102 if (stack_size > 0) { |
|
grt (UTC plus 2)
2016/06/10 14:20:00
yay!
ananta
2016/06/10 18:29:57
Yeah. Harmless line of code which pulled in user32
| |
| 104 flags = STACK_SIZE_PARAM_IS_A_RESERVATION; | 103 flags = STACK_SIZE_PARAM_IS_A_RESERVATION; |
| 105 } else { | 104 } else { |
| 106 stack_size = 0; | 105 stack_size = 0; |
| 107 } | 106 } |
| 108 | 107 |
| 109 ThreadParams* params = new ThreadParams; | 108 ThreadParams* params = new ThreadParams; |
| 110 params->delegate = delegate; | 109 params->delegate = delegate; |
| 111 params->joinable = out_thread_handle != nullptr; | 110 params->joinable = out_thread_handle != nullptr; |
| 112 params->priority = priority; | 111 params->priority = priority; |
| 113 | 112 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 return ThreadPriority::REALTIME_AUDIO; | 274 return ThreadPriority::REALTIME_AUDIO; |
| 276 case THREAD_PRIORITY_ERROR_RETURN: | 275 case THREAD_PRIORITY_ERROR_RETURN: |
| 277 DPCHECK(false) << "GetThreadPriority error"; // Falls through. | 276 DPCHECK(false) << "GetThreadPriority error"; // Falls through. |
| 278 default: | 277 default: |
| 279 NOTREACHED() << "Unexpected priority: " << priority; | 278 NOTREACHED() << "Unexpected priority: " << priority; |
| 280 return ThreadPriority::NORMAL; | 279 return ThreadPriority::NORMAL; |
| 281 } | 280 } |
| 282 } | 281 } |
| 283 | 282 |
| 284 } // namespace base | 283 } // namespace base |
| OLD | NEW |