Ignore:
Timestamp:
Feb 23, 2009, 2:37:17 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2009-02-23 David Levin <[email protected]>

Reviewed by Alexey Proskuryakov.

Bug 24047: Need to simplify nested if's in WorkerRunLoop::runInMode
<https://bugs.webkit.org/show_bug.cgi?id=24047>

  • wtf/MessageQueue.h: (WTF::MessageQueue::infiniteTime): Allows for one to call waitForMessageFilteredWithTimeout and wait forever.

(WTF::MessageQueue::alwaysTruePredicate):
(WTF::MessageQueue::waitForMessage):
Made waitForMessage call waitForMessageFilteredWithTimeout, so that there is less
duplicate code.

(WTF::MessageQueue::waitForMessageFilteredWithTimeout):

  • wtf/ThreadingQt.cpp: (WTF::ThreadCondition::timedWait):
  • wtf/ThreadingWin.cpp: (WTF::ThreadCondition::timedWait): Made these two implementations consistent with the pthread and gtk implementations. Currently, the time calculations would overflow when passed large values.

WebCore:

2009-02-23 David Levin <[email protected]>

Reviewed by Alexey Proskuryakov.

Bug 24047: Need to simplify nested if's in WorkerRunLoop::runInMode
<https://bugs.webkit.org/show_bug.cgi?id=24047>

Made a nested if inside of WorkerRunLoop::runInMode a lot simpler by
using only MessageQueue::waitForMessageFilteredWithTimeout instead
of three different MessageQueue methods.

No observable change in behavior, so no test.

  • dom/WorkerRunLoop.cpp: (WebCore::ModePredicate::operator()): Minor clean-up to able to pass a const ref point for ModePredicate into runInMode. (WebCore::WorkerRunLoop::runInMode):
  • dom/WorkerRunLoop.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/ThreadingWin.cpp

    r40122 r41156  
    458458        return false;
    459459
     460    // Time is too far in the future (and would overflow unsigned long) - wait forever.
     461    if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) {
     462        wait(mutex);
     463        return true;
     464    }
     465
    460466    double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0;
    461     if (intervalMilliseconds >= INT_MAX)
    462         intervalMilliseconds = INT_MAX;
    463 
    464467    return m_condition.timedWait(mutex.impl(), static_cast<unsigned long>(intervalMilliseconds));
    465468}
Note: See TracChangeset for help on using the changeset viewer.