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 "base/debug/alias.h" | 7 #include "base/debug/alias.h" |
8 #include "base/debug/profiler.h" | 8 #include "base/debug/profiler.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_id_name_manager.h" | 10 #include "base/threading/thread_id_name_manager.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // http://www.microsoft.com/msj/1099/win32/win321099.aspx | 116 // http://www.microsoft.com/msj/1099/win32/win321099.aspx |
117 PlatformThreadId thread_id; | 117 PlatformThreadId thread_id; |
118 void* thread_handle = CreateThread( | 118 void* thread_handle = CreateThread( |
119 NULL, stack_size, ThreadFunc, params, flags, &thread_id); | 119 NULL, stack_size, ThreadFunc, params, flags, &thread_id); |
120 if (!thread_handle) { | 120 if (!thread_handle) { |
121 delete params; | 121 delete params; |
122 return false; | 122 return false; |
123 } | 123 } |
124 | 124 |
125 if (out_thread_handle) | 125 if (out_thread_handle) |
126 *out_thread_handle = PlatformThreadHandle(thread_handle, thread_id); | 126 *out_thread_handle = PlatformThreadHandle(thread_handle); |
127 else | 127 else |
128 CloseHandle(thread_handle); | 128 CloseHandle(thread_handle); |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
132 } // namespace | 132 } // namespace |
133 | 133 |
134 // static | 134 // static |
135 PlatformThreadId PlatformThread::CurrentId() { | 135 PlatformThreadId PlatformThread::CurrentId() { |
136 return ::GetCurrentThreadId(); | 136 return ::GetCurrentThreadId(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return ThreadPriority::REALTIME_AUDIO; | 281 return ThreadPriority::REALTIME_AUDIO; |
282 case THREAD_PRIORITY_ERROR_RETURN: | 282 case THREAD_PRIORITY_ERROR_RETURN: |
283 DPCHECK(false) << "GetThreadPriority error"; // Falls through. | 283 DPCHECK(false) << "GetThreadPriority error"; // Falls through. |
284 default: | 284 default: |
285 NOTREACHED() << "Unexpected priority: " << priority; | 285 NOTREACHED() << "Unexpected priority: " << priority; |
286 return ThreadPriority::NORMAL; | 286 return ThreadPriority::NORMAL; |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 } // namespace base | 290 } // namespace base |
OLD | NEW |