Bug 23976 - MessageQueue needs a way to wait for a message that satisfies an arbitrary criteria.
Summary: MessageQueue needs a way to wait for a message that satisfies an arbitrary cr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: David Levin
URL:
Keywords:
Depends on: 23974
Blocks: 23980
  Show dependency treegraph
 
Reported: 2009-02-16 11:34 PST by David Levin
Modified: 2009-02-19 11:47 PST (History)
1 user (show)

See Also:


Attachments
Patch for bug. (2.84 KB, patch)
2009-02-16 11:39 PST, David Levin
no flags Details | Formatted Diff | Diff
Part 1: Change MessageQueue to be linked list based. (6.76 KB, patch)
2009-02-18 10:18 PST, David Levin
no flags Details | Formatted Diff | Diff
Proposed fix. (3.79 KB, patch)
2009-02-18 18:46 PST, David Levin
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Levin 2009-02-16 11:34:08 PST
Needs patch.
Comment 1 David Levin 2009-02-16 11:39:52 PST
Created attachment 27703 [details]
Patch for bug.
Comment 2 David Levin 2009-02-17 01:38:24 PST
Comment on attachment 27703 [details]
Patch for bug.

As ap suggested, I should change MessageQueue to be linked list based.
Comment 3 David Levin 2009-02-18 10:18:55 PST
Created attachment 27754 [details]
Part 1: Change MessageQueue to be linked list based.
Comment 4 David Levin 2009-02-18 10:41:29 PST
Comment on attachment 27754 [details]
Part 1: Change MessageQueue to be linked list based.

ok, maybe not a linked list for now.
Comment 5 David Levin 2009-02-18 10:42:13 PST
Comment on attachment 27703 [details]
Patch for bug.

We'll try this one to start with.
Comment 6 David Levin 2009-02-18 11:39:17 PST
Comment on attachment 27703 [details]
Patch for bug.

I'll consider a functor approach instead of a virtual method callback.
Comment 7 David Levin 2009-02-18 18:46:40 PST
Created attachment 27773 [details]
Proposed fix.
Comment 8 Alexey Proskuryakov 2009-02-19 02:45:34 PST
Comment on attachment 27773 [details]
Proposed fix.

r=me

> +    inline DequeIterator<T> Deque<T>::findIf(Predicate predicate)
> +    {
> +        for (iterator it = begin(); it != end(); ++it) {

If may be better to make compiler's life easier, and precompute end().

> +            if ((*predicate)(*it))

Shouldn't this be "predicate(*it)"?

> +                return it;
> +        }
> +        return end();
> +    }

+        MessageQueueWaitResult waitForMessageFiltered(DataType&, Predicate);
         MessageQueueWaitResult waitForMessageTimed(DataType&, double absoluteTime);

Have you verified that timers do not fire in Firefox when waiting for a sync XHR in a worker?
Comment 9 David Levin 2009-02-19 11:47:11 PST
> Have you verified that timers do not fire in Firefox when waiting for a sync XHR in a worker?
Not yet.  But I'll look into adding a method to do that to reduce duplicate code in this class.

Commited as r41081.