mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Avoid fetching node global from HTMLMediaElement's destructor.
This commit is contained in:
parent
f02e516f32
commit
2e6252f256
1 changed files with 6 additions and 4 deletions
|
@ -74,7 +74,7 @@ use html5ever::{LocalName, Prefix};
|
|||
use http::header::{self, HeaderMap, HeaderValue};
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward};
|
||||
use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward, WindowGLContext};
|
||||
use net_traits::image::base::Image;
|
||||
use net_traits::image_cache::ImageResponse;
|
||||
use net_traits::request::{Destination, Referrer};
|
||||
|
@ -373,6 +373,8 @@ pub struct HTMLMediaElement {
|
|||
/// the access to the "privileged" document.servoGetMediaControls(id) API by
|
||||
/// keeping a whitelist of media controls identifiers.
|
||||
media_controls_id: DomRefCell<Option<String>>,
|
||||
#[ignore_malloc_size_of = "Defined in other crates"]
|
||||
player_context: WindowGLContext,
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
|
||||
|
@ -437,6 +439,7 @@ impl HTMLMediaElement {
|
|||
current_fetch_context: DomRefCell::new(None),
|
||||
id: Cell::new(0),
|
||||
media_controls_id: DomRefCell::new(None),
|
||||
player_context: document.window().get_player_context(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1967,15 +1970,14 @@ impl HTMLMediaElement {
|
|||
|
||||
impl Drop for HTMLMediaElement {
|
||||
fn drop(&mut self) {
|
||||
let window = window_from_node(self);
|
||||
window.get_player_context().glplayer_chan.map(|pipeline| {
|
||||
if let Some(ref pipeline) = self.player_context.glplayer_chan {
|
||||
if let Err(err) = pipeline
|
||||
.channel()
|
||||
.send(GLPlayerMsg::UnregisterPlayer(self.id.get()))
|
||||
{
|
||||
warn!("GLPlayer disappeared!: {:?}", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.remove_controls();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue