aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglcontextevent.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-12-10 22:06:05 -0500
committerCorey Farwell <coreyf@rwell.org>2015-12-10 23:47:25 -0500
commit4accaf50b21a6344e9ee7518f7ab07c1dde7c36c (patch)
tree36d486ba0e57440a7a69e14829814e7ad5006712 /components/script/dom/webglcontextevent.rs
parent996c0a60b81e7d7e0fbfea81a546771ea9327df6 (diff)
downloadservo-4accaf50b21a6344e9ee7518f7ab07c1dde7c36c.tar.gz
servo-4accaf50b21a6344e9ee7518f7ab07c1dde7c36c.zip
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.
Diffstat (limited to 'components/script/dom/webglcontextevent.rs')
-rw-r--r--components/script/dom/webglcontextevent.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/script/dom/webglcontextevent.rs b/components/script/dom/webglcontextevent.rs
index 0e236ad634f..34bba6edf84 100644
--- a/components/script/dom/webglcontextevent.rs
+++ b/components/script/dom/webglcontextevent.rs
@@ -12,6 +12,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::event::{Event, EventBubbles, EventCancelable};
+use string_cache::Atom;
use util::str::DOMString;
#[dom_struct]
@@ -36,7 +37,7 @@ impl WebGLContextEvent {
}
pub fn new(global: GlobalRef,
- type_: DOMString,
+ type_: Atom,
bubbles: EventBubbles,
cancelable: EventCancelable,
status_message: DOMString) -> Root<WebGLContextEvent> {
@@ -47,7 +48,7 @@ impl WebGLContextEvent {
{
let parent = event.upcast::<Event>();
- parent.InitEvent(type_, bubbles == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable);
+ parent.init_event(type_, bubbles == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable);
}
event
@@ -73,7 +74,7 @@ impl WebGLContextEvent {
EventCancelable::NotCancelable
};
- Ok(WebGLContextEvent::new(global, type_,
+ Ok(WebGLContextEvent::new(global, Atom::from(&*type_),
bubbles,
cancelable,
status_message))