mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Pass around event types as Atoms instead of Strings
`Event` internally stores the `type` as an `Atom`, and we're `String`s everywhere, which can cause unnecessary allocations to occur since they'll end up as `Atom`s anyways.
This commit is contained in:
parent
996c0a60b8
commit
4accaf50b2
25 changed files with 156 additions and 135 deletions
|
@ -464,7 +464,7 @@ impl Runnable for ConnectionEstablishedTask {
|
|||
|
||||
// Step 6.
|
||||
let global = ws.global.root();
|
||||
let event = Event::new(global.r(), DOMString::from("open"),
|
||||
let event = Event::new(global.r(), atom!("open"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable);
|
||||
event.fire(ws.upcast());
|
||||
|
@ -506,7 +506,7 @@ impl Runnable for CloseTask {
|
|||
//A Bad close
|
||||
ws.clean_close.set(false);
|
||||
let event = Event::new(global.r(),
|
||||
DOMString::from("error"),
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable);
|
||||
event.fire(ws.upcast());
|
||||
|
@ -516,7 +516,7 @@ impl Runnable for CloseTask {
|
|||
https://html.spec.whatwg.org/multipage/#closeWebSocket
|
||||
*/
|
||||
let close_event = CloseEvent::new(global.r(),
|
||||
DOMString::from("close"),
|
||||
atom!("close"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
ws.clean_close.get(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue