Skip to content

Commit

Permalink
Use MallocSizeOf and remove uses of box expression syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Dec 21, 2017
1 parent 850b5c6 commit fc223f9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/mediasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct MediaSource {
impl MediaSource {
fn new(window: &Window) -> DomRoot<Self> {
reflect_dom_object(
box Self::new_inherited(),
Box::new(Self::new_inherited()),
window,
MediaSourceBinding::Wrap,
)
Expand Down
9 changes: 4 additions & 5 deletions components/script/dom/sourcebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use dom_struct::dom_struct;
use js::jsapi::{JSContext, JSObject, Rooted};
use js::typedarray::{ArrayBuffer, ArrayBufferView};
use mime::{Mime, SubLevel, TopLevel};
use std::ascii::AsciiExt;
use std::cell::Cell;
use std::collections::VecDeque;
use std::f64;
Expand Down Expand Up @@ -52,7 +51,7 @@ pub struct SourceBuffer {
/// https://w3c.github.io/media-source/#sourcebuffer-buffer-full-flag
buffer_full: Cell<bool>,
/// The MIME type provided when that `SourceBuffer` was created.
#[ignore_heap_size_of = "defined in mime"]
#[ignore_malloc_size_of = "defined in mime"]
mime: Mime,
/// Whether we are currently running the range removal algorithm.
in_range_removal: Cell<bool>,
Expand All @@ -67,15 +66,15 @@ pub struct SourceBuffer {
}

/// https://w3c.github.io/media-source/#sourcebuffer-append-state
#[derive(Clone, Copy, JSTraceable, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
enum AppendState {
WaitingForSegment,
ParsingInitSegment,
ParsingMediaSegment,
}

/// https://w3c.github.io/media-source/#sourcebuffer-generate-timestamps-flag
#[derive(Clone, Copy, JSTraceable, HeapSizeOf, PartialEq)]
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
enum TimestampMode {
/// Timestamps are extracted from source.
FromSource,
Expand All @@ -90,7 +89,7 @@ impl SourceBuffer {
) -> DomRoot<Self> {

reflect_dom_object(
box Self::new_inherited(parent_media_source, mime),
Box::new(Self::new_inherited(parent_media_source, mime)),
&*parent_media_source.global(),
SourceBufferBinding::Wrap,
)
Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/sourcebufferlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct SourceBufferList {
list_mode: ListMode,
}

#[derive(HeapSizeOf, JSTraceable)]
#[derive(MallocSizeOf, JSTraceable)]
pub enum ListMode {
All,
Active,
Expand All @@ -40,7 +40,7 @@ impl SourceBufferList {

pub fn new(media_source: &MediaSource, list_mode: ListMode) -> DomRoot<Self> {
reflect_dom_object(
box Self::new_inherited(media_source, list_mode),
Box::new(Self::new_inherited(media_source, list_mode)),
&*media_source.global(),
SourceBufferListBinding::Wrap,
)
Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/timeranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::ops::Range;
#[dom_struct]
pub struct TimeRanges {
reflector: Reflector,
#[ignore_heap_size_of = "FIXME(nox): https://github.com/servo/heapsize/pull/89"]
#[ignore_malloc_size_of = "FIXME(nox): https://github.com/servo/heapsize/pull/89"]
ranges: Vec<Range<Finite<f64>>>,
}

Expand All @@ -31,7 +31,7 @@ impl TimeRanges {

pub fn new(window: &Window, ranges: Vec<Range<Finite<f64>>>) -> DomRoot<Self> {
reflect_dom_object(
box Self::new_inherited(ranges),
Box::new(Self::new_inherited(ranges)),
window,
TimeRangesBinding::Wrap,
)
Expand Down

0 comments on commit fc223f9

Please sign in to comment.