mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove unnecessary Option.
This commit is contained in:
parent
6aacc9001b
commit
f02e516f32
6 changed files with 10 additions and 18 deletions
|
@ -75,9 +75,7 @@ impl AudioContext {
|
|||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(window: &Window, options: &AudioContextOptions) -> DomRoot<AudioContext> {
|
||||
let pipeline_id = window
|
||||
.pipeline_id()
|
||||
.expect("Cannot create AudioContext outside of a pipeline");
|
||||
let pipeline_id = window.pipeline_id();
|
||||
let context = AudioContext::new_inherited(options, pipeline_id);
|
||||
let context = reflect_dom_object(Box::new(context), window, AudioContextBinding::Wrap);
|
||||
context.resume();
|
||||
|
|
|
@ -519,7 +519,7 @@ impl Document {
|
|||
// Set the document's activity level, reflow if necessary, and suspend or resume timers.
|
||||
self.activity.set(activity);
|
||||
let media = ServoMedia::get().unwrap();
|
||||
let pipeline_id = self.window().pipeline_id().expect("doc with no pipeline");
|
||||
let pipeline_id = self.window().pipeline_id();
|
||||
let client_context_id =
|
||||
ClientContextId::build(pipeline_id.namespace_id.0, pipeline_id.index.0.get());
|
||||
|
||||
|
@ -3318,7 +3318,7 @@ impl Document {
|
|||
let script_msg = CommonScriptMsg::Task(
|
||||
ScriptThreadEventCategory::EnterFullscreen,
|
||||
handler,
|
||||
pipeline_id,
|
||||
Some(pipeline_id),
|
||||
TaskSourceName::DOMManipulation,
|
||||
);
|
||||
let msg = MainThreadScriptMsg::Common(script_msg);
|
||||
|
|
|
@ -1340,9 +1340,7 @@ impl HTMLMediaElement {
|
|||
|
||||
let audio_renderer = self.audio_renderer.borrow().as_ref().map(|r| r.clone());
|
||||
|
||||
let pipeline_id = window
|
||||
.pipeline_id()
|
||||
.expect("Cannot create player outside of a pipeline");
|
||||
let pipeline_id = window.pipeline_id();
|
||||
let client_context_id =
|
||||
ClientContextId::build(pipeline_id.namespace_id.0, pipeline_id.index.0.get());
|
||||
let player = ServoMedia::get().unwrap().create_player(
|
||||
|
|
|
@ -105,9 +105,7 @@ impl MediaSession {
|
|||
pub fn send_event(&self, event: MediaSessionEvent) {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
let pipeline_id = window
|
||||
.pipeline_id()
|
||||
.expect("Cannot send media session event outside of a pipeline");
|
||||
let pipeline_id = window.pipeline_id();
|
||||
window.send_to_constellation(ScriptMsg::MediaSessionEvent(pipeline_id, event));
|
||||
}
|
||||
|
||||
|
|
|
@ -83,9 +83,7 @@ impl OfflineAudioContext {
|
|||
{
|
||||
return Err(Error::NotSupported);
|
||||
}
|
||||
let pipeline_id = window
|
||||
.pipeline_id()
|
||||
.expect("Cannot create audio context outside of a pipeline");
|
||||
let pipeline_id = window.pipeline_id();
|
||||
let context =
|
||||
OfflineAudioContext::new_inherited(channel_count, length, sample_rate, pipeline_id);
|
||||
Ok(reflect_dom_object(
|
||||
|
|
|
@ -1987,7 +1987,7 @@ impl Window {
|
|||
.task_canceller(TaskSourceName::DOMManipulation)
|
||||
.wrap_task(task),
|
||||
),
|
||||
self.pipeline_id(),
|
||||
Some(self.pipeline_id()),
|
||||
TaskSourceName::DOMManipulation,
|
||||
));
|
||||
doc.set_url(load_data.url.clone());
|
||||
|
@ -2353,8 +2353,8 @@ impl Window {
|
|||
unsafe { WindowBinding::Wrap(JSContext::from_ptr(runtime.cx()), win) }
|
||||
}
|
||||
|
||||
pub fn pipeline_id(&self) -> Option<PipelineId> {
|
||||
Some(self.upcast::<GlobalScope>().pipeline_id())
|
||||
pub fn pipeline_id(&self) -> PipelineId {
|
||||
self.upcast::<GlobalScope>().pipeline_id()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2485,7 +2485,7 @@ impl Window {
|
|||
.task_canceller(TaskSourceName::DOMManipulation)
|
||||
.wrap_task(task),
|
||||
),
|
||||
self.pipeline_id(),
|
||||
Some(self.pipeline_id()),
|
||||
TaskSourceName::DOMManipulation,
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue