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

Side by Side Diff: Source/wtf/ThreadingWin.cpp

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/ThreadingPthreads.cpp ('k') | Source/wtf/TriState.h » ('j') | 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. 4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
16 * its contributors may be used to endorse or promote products derived 16 * its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission. 17 * from this software without specific prior written permission.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 threadID = static_cast<ThreadIdentifier>(threadIdentifier); 238 threadID = static_cast<ThreadIdentifier>(threadIdentifier);
239 storeThreadHandleByIdentifier(threadIdentifier, threadHandle); 239 storeThreadHandleByIdentifier(threadIdentifier, threadHandle);
240 240
241 return threadID; 241 return threadID;
242 } 242 }
243 243
244 int waitForThreadCompletion(ThreadIdentifier threadID) 244 int waitForThreadCompletion(ThreadIdentifier threadID)
245 { 245 {
246 ASSERT(threadID); 246 ASSERT(threadID);
247 247
248 HANDLE threadHandle = threadHandleForIdentifier(threadID); 248 HANDLE threadHandle = threadHandleForIdentifier(threadID);
249 if (!threadHandle) 249 if (!threadHandle)
250 LOG_ERROR("ThreadIdentifier %u did not correspond to an active thread wh en trying to quit", threadID); 250 LOG_ERROR("ThreadIdentifier %u did not correspond to an active thread wh en trying to quit", threadID);
251 251
252 DWORD joinResult = WaitForSingleObject(threadHandle, INFINITE); 252 DWORD joinResult = WaitForSingleObject(threadHandle, INFINITE);
253 if (joinResult == WAIT_FAILED) 253 if (joinResult == WAIT_FAILED)
254 LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit ", threadID); 254 LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit ", threadID);
255 255
256 CloseHandle(threadHandle); 256 CloseHandle(threadHandle);
257 clearThreadHandleForIdentifier(threadID); 257 clearThreadHandleForIdentifier(threadID);
258 258
259 return joinResult; 259 return joinResult;
260 } 260 }
261 261
(...skipping 26 matching lines...) Expand all
288 Mutex::~Mutex() 288 Mutex::~Mutex()
289 { 289 {
290 DeleteCriticalSection(&m_mutex.m_internalMutex); 290 DeleteCriticalSection(&m_mutex.m_internalMutex);
291 } 291 }
292 292
293 void Mutex::lock() 293 void Mutex::lock()
294 { 294 {
295 EnterCriticalSection(&m_mutex.m_internalMutex); 295 EnterCriticalSection(&m_mutex.m_internalMutex);
296 ++m_mutex.m_recursionCount; 296 ++m_mutex.m_recursionCount;
297 } 297 }
298 298
299 bool Mutex::tryLock() 299 bool Mutex::tryLock()
300 { 300 {
301 // This method is modeled after the behavior of pthread_mutex_trylock, 301 // This method is modeled after the behavior of pthread_mutex_trylock,
302 // which will return an error if the lock is already owned by the 302 // which will return an error if the lock is already owned by the
303 // current thread. Since the primitive Win32 'TryEnterCriticalSection' 303 // current thread. Since the primitive Win32 'TryEnterCriticalSection'
304 // treats this as a successful case, it changes the behavior of several 304 // treats this as a successful case, it changes the behavior of several
305 // tests in WebKit that check to see if the current thread already 305 // tests in WebKit that check to see if the current thread already
306 // owned this mutex (see e.g., IconDatabase::getOrCreateIconRecord) 306 // owned this mutex (see e.g., IconDatabase::getOrCreateIconRecord)
307 DWORD result = TryEnterCriticalSection(&m_mutex.m_internalMutex); 307 DWORD result = TryEnterCriticalSection(&m_mutex.m_internalMutex);
308 308
309 if (result != 0) { // We got the lock 309 if (result != 0) { // We got the lock
310 // If this thread already had the lock, we must unlock and 310 // If this thread already had the lock, we must unlock and
311 // return false so that we mimic the behavior of POSIX's 311 // return false so that we mimic the behavior of POSIX's
312 // pthread_mutex_trylock: 312 // pthread_mutex_trylock:
313 if (m_mutex.m_recursionCount > 0) { 313 if (m_mutex.m_recursionCount > 0) {
314 LeaveCriticalSection(&m_mutex.m_internalMutex); 314 LeaveCriticalSection(&m_mutex.m_internalMutex);
315 return false; 315 return false;
316 } 316 }
317 317
318 ++m_mutex.m_recursionCount; 318 ++m_mutex.m_recursionCount;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // Time is too far in the future (and would overflow unsigned long) - wait f orever. 498 // Time is too far in the future (and would overflow unsigned long) - wait f orever.
499 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) 499 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0)
500 return INFINITE; 500 return INFINITE;
501 501
502 return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0); 502 return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0);
503 } 503 }
504 504
505 } // namespace WTF 505 } // namespace WTF
506 506
507 #endif // OS(WINDOWS) 507 #endif // OS(WINDOWS)
OLDNEW
« no previous file with comments | « Source/wtf/ThreadingPthreads.cpp ('k') | Source/wtf/TriState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698