Bug 18785 - Event dispatch should avoid malloc by using EventPromise
Summary: Event dispatch should avoid malloc by using EventPromise
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 16447
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-28 09:30 PDT by Eric Seidel (no email)
Modified: 2008-04-28 09:36 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-04-28 09:30:56 PDT
Event dispatch should avoid malloc by using EventPromise

Darin had this idea a long while back.  SVG would benefit from this, see bug 16447.

Basically there would be an EventPromise object which was used during EventDispatch (passed "const EventPromise&" up the dispatch chain), which knew how to create an Event subclass with the right information if a listener was found, but otherwise would avoid malloc.
Comment 1 Darin Adler 2008-04-28 09:36:12 PDT
Once version of the idea here is that the EventPromise has enough functions in it to do everything in the dispatching process except for dispatching to JavaScript. So as long as there are no JavaScript event handlers, you can just use the stack-based one.

Another version, probably better, is that EventPromise simply has enough in it for simpler events; ones that are dispatched in response to engine events and that have very little data in them. For more complex events like keyboard events the EventPromise would simply wrap an already-created Event object of the appropriate subclass.