2009-02-19 David Levin <levin@chromium.org>
authorlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Feb 2009 22:35:40 +0000 (22:35 +0000)
committerlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Feb 2009 22:35:40 +0000 (22:35 +0000)
commit3ee2a2d0ec80c84949a03409af051fb924e38208
tree566d63c45e04fd7e841bea91bef9bf83d0afd439
parentfcf3d7ee4af10250d7d5e61092aa1dde74ae8992
2009-02-19  David Levin  <levin@chromium.org>

        Reviewed by Alexey Proskuryakov.

        Bug 23980: WorkerRunLoop needs a way to run in a given mode similar to CFRunLoopInMode.
        <https://bugs.webkit.org/show_bug.cgi?id=23980>

        WorkerRunLoop has the ability to run in a mode which filters the tasks to be run.
        * When WorkerRunLoop::runInMode is called, only task for that mode will run.
        * When WorkerRunLoop::run is called (or the default mode is used), then all tasks
          will run regardless of their posted mode.

        Here's a demonstration of the api:

            RefPtr<NameResolution> nameResolution = NameResolution::create(workerRunLoop);

            //  Internally nameResolution will do workerRunLoop.postTaskForMode(task, "MyCoolMode")
            //  for any tasks that need to be run during this loop.
            nameResolution->setTaskMode("MyCoolMode");

            nameResolution->start();
            while (!nameResolution->done()) {
                // Only tasks which are posted for "MyCoolMode" will run.
                workerRunLoop.runInMode(context, "MyCoolMode");
            }

        No observable change in behavior, so no test.

        * dom/WorkerRunLoop.cpp:
        (WebCore::ModePredicate::ModePredicate):
        (WebCore::ModePredicate::operator()):
        (WebCore::WorkerRunLoop::WorkerRunLoop):
        (WebCore::WorkerRunLoop::~WorkerRunLoop):
        (WebCore::WorkerRunLoop::setSharedTimer):
        (WebCore::WorkerRunLoop::resetSharedTimer):
        (WebCore::WorkerRunLoop::run):
        (WebCore::WorkerRunLoop::runInMode):
        (WebCore::WorkerRunLoop::postTask):
        (WebCore::WorkerRunLoop::postTaskForMode):
        * dom/WorkerRunLoop.h:
        (WebCore::WorkerRunLoop::Task::create):
        (WebCore::WorkerRunLoop::Task::mode):
        (WebCore::WorkerRunLoop::Task::performTask):
        (WebCore::WorkerRunLoop::Task::Task):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/dom/WorkerRunLoop.cpp
WebCore/dom/WorkerRunLoop.h