Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: base/threading/platform_thread_win.cc

Issue 1356743003: Revert of Check for CloseHandle failures even when not debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/sync_socket_win.cc ('k') | base/time/time_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 ThreadParams* params = new ThreadParams; 107 ThreadParams* params = new ThreadParams;
108 params->delegate = delegate; 108 params->delegate = delegate;
109 params->joinable = out_thread_handle != nullptr; 109 params->joinable = out_thread_handle != nullptr;
110 params->priority = priority; 110 params->priority = priority;
111 111
112 // Using CreateThread here vs _beginthreadex makes thread creation a bit 112 // Using CreateThread here vs _beginthreadex makes thread creation a bit
113 // faster and doesn't require the loader lock to be available. Our code will 113 // faster and doesn't require the loader lock to be available. Our code will
114 // have to work running on CreateThread() threads anyway, since we run code 114 // have to work running on CreateThread() threads anyway, since we run code
115 // on the Windows thread pool, etc. For some background on the difference: 115 // on the Windows thread pool, etc. For some background on the difference:
116 // http://www.microsoft.com/msj/1099/win32/win321099.aspx 116 // http://www.microsoft.com/msj/1099/win32/win321099.aspx
117 base::win::ScopedHandle thread_handle( 117 void* thread_handle =
118 ::CreateThread(nullptr, stack_size, ThreadFunc, params, flags, nullptr)); 118 ::CreateThread(nullptr, stack_size, ThreadFunc, params, flags, nullptr);
119 if (!thread_handle.IsValid()) { 119 if (!thread_handle) {
120 delete params; 120 delete params;
121 return false; 121 return false;
122 } 122 }
123 123
124 if (out_thread_handle) 124 if (out_thread_handle)
125 *out_thread_handle = PlatformThreadHandle(thread_handle.Take()); 125 *out_thread_handle = PlatformThreadHandle(thread_handle);
126 else
127 CloseHandle(thread_handle);
126 return true; 128 return true;
127 } 129 }
128 130
129 } // namespace 131 } // namespace
130 132
131 // static 133 // static
132 PlatformThreadId PlatformThread::CurrentId() { 134 PlatformThreadId PlatformThread::CurrentId() {
133 return ::GetCurrentThreadId(); 135 return ::GetCurrentThreadId();
134 } 136 }
135 137
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 return ThreadPriority::REALTIME_AUDIO; 273 return ThreadPriority::REALTIME_AUDIO;
272 case THREAD_PRIORITY_ERROR_RETURN: 274 case THREAD_PRIORITY_ERROR_RETURN:
273 DPCHECK(false) << "GetThreadPriority error"; // Falls through. 275 DPCHECK(false) << "GetThreadPriority error"; // Falls through.
274 default: 276 default:
275 NOTREACHED() << "Unexpected priority: " << priority; 277 NOTREACHED() << "Unexpected priority: " << priority;
276 return ThreadPriority::NORMAL; 278 return ThreadPriority::NORMAL;
277 } 279 }
278 } 280 }
279 281
280 } // namespace base 282 } // namespace base
OLDNEW
« no previous file with comments | « base/sync_socket_win.cc ('k') | base/time/time_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698