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

Side by Side Diff: webrtc/base/platform_thread.cc

Issue 2541003002: Make sure GetLastError on a PlatformThread return an error that is relevant to the thread. (Closed)
Patch Set: Add comment. Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 PlatformThread::~PlatformThread() { 112 PlatformThread::~PlatformThread() {
113 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 113 RTC_DCHECK(thread_checker_.CalledOnValidThread());
114 #if defined(WEBRTC_WIN) 114 #if defined(WEBRTC_WIN)
115 RTC_DCHECK(!thread_); 115 RTC_DCHECK(!thread_);
116 RTC_DCHECK(!thread_id_); 116 RTC_DCHECK(!thread_id_);
117 #endif // defined(WEBRTC_WIN) 117 #endif // defined(WEBRTC_WIN)
118 } 118 }
119 119
120 #if defined(WEBRTC_WIN) 120 #if defined(WEBRTC_WIN)
121 DWORD WINAPI PlatformThread::StartThread(void* param) { 121 DWORD WINAPI PlatformThread::StartThread(void* param) {
122 // The GetLastError() function only returns valid results when it is called
123 // after a Win32 API function that returns a "failed" result. A crash dump
124 // contains the result from GetLastError() and to make sure it does not
125 // falsely report a Windows error we call SetLastError here.
126 ::SetLastError(ERROR_SUCCESS);
122 static_cast<PlatformThread*>(param)->Run(); 127 static_cast<PlatformThread*>(param)->Run();
123 return 0; 128 return 0;
124 } 129 }
125 #else 130 #else
126 void* PlatformThread::StartThread(void* param) { 131 void* PlatformThread::StartThread(void* param) {
127 static_cast<PlatformThread*>(param)->Run(); 132 static_cast<PlatformThread*>(param)->Run();
128 return 0; 133 return 0;
129 } 134 }
130 #endif // defined(WEBRTC_WIN) 135 #endif // defined(WEBRTC_WIN)
131 136
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 #if defined(WEBRTC_WIN) 268 #if defined(WEBRTC_WIN)
264 bool PlatformThread::QueueAPC(PAPCFUNC function, ULONG_PTR data) { 269 bool PlatformThread::QueueAPC(PAPCFUNC function, ULONG_PTR data) {
265 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 270 RTC_DCHECK(thread_checker_.CalledOnValidThread());
266 RTC_DCHECK(IsRunning()); 271 RTC_DCHECK(IsRunning());
267 272
268 return QueueUserAPC(function, thread_, data) != FALSE; 273 return QueueUserAPC(function, thread_, data) != FALSE;
269 } 274 }
270 #endif 275 #endif
271 276
272 } // namespace rtc 277 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698