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

Side by Side Diff: JavaScriptCore/wtf/ThreadingQt.cpp

Issue 28077: WebKit side of merge from r41149 to r41181. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/WebKit/
Patch Set: Created 11 years, 10 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 | « JavaScriptCore/wtf/MessageQueue.h ('k') | JavaScriptCore/wtf/ThreadingWin.cpp » ('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 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime) 237 bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
238 { 238 {
239 double currentTime = WTF::currentTime(); 239 double currentTime = WTF::currentTime();
240 240
241 // Time is in the past - return immediately. 241 // Time is in the past - return immediately.
242 if (absoluteTime < currentTime) 242 if (absoluteTime < currentTime)
243 return false; 243 return false;
244 244
245 // Time is too far in the future (and would overflow unsigned long) - wait f orever.
246 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) {
247 wait(mutex);
248 return true;
249 }
250
245 double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0; 251 double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0;
246 // Qt defines wait for up to ULONG_MAX milliseconds.
247 if (intervalMilliseconds >= ULONG_MAX)
248 intervalMilliseconds = ULONG_MAX;
249
250 return m_condition->wait(mutex.impl(), static_cast<unsigned long>(intervalMi lliseconds)); 252 return m_condition->wait(mutex.impl(), static_cast<unsigned long>(intervalMi lliseconds));
251 } 253 }
252 254
253 void ThreadCondition::signal() 255 void ThreadCondition::signal()
254 { 256 {
255 m_condition->wakeOne(); 257 m_condition->wakeOne();
256 } 258 }
257 259
258 void ThreadCondition::broadcast() 260 void ThreadCondition::broadcast()
259 { 261 {
260 m_condition->wakeAll(); 262 m_condition->wakeAll();
261 } 263 }
262 264
263 } // namespace WebCore 265 } // namespace WebCore
OLDNEW
« no previous file with comments | « JavaScriptCore/wtf/MessageQueue.h ('k') | JavaScriptCore/wtf/ThreadingWin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698