performance: clear and disable buffer on pipeline exit

use existing buffer max size
This commit is contained in:
Gregory Terzian 2019-08-30 03:18:26 +08:00
parent 39bd45529d
commit 6d1136a37d
2 changed files with 34 additions and 27 deletions

View file

@ -872,19 +872,10 @@ impl WindowMethods for Window {
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/
// NavigationTiming/Overview.html#sec-window.performance-attribute
fn Performance(&self) -> DomRoot<Performance> {
match self.current_state.get() {
WindowState::Alive => self.performance.or_init(|| {
let global_scope = self.upcast::<GlobalScope>();
Performance::new(global_scope, self.navigation_start_precise.get())
}),
WindowState::Zombie => {
// Don't store in Zombie state,
// as clear_js_runtime has already been called,
// and we won't have another opportunity to drop it.
let global_scope = self.upcast::<GlobalScope>();
Performance::new(global_scope, self.navigation_start_precise.get())
},
}
self.performance.or_init(|| {
let global_scope = self.upcast::<GlobalScope>();
Performance::new(global_scope, self.navigation_start_precise.get())
})
}
// https://html.spec.whatwg.org/multipage/#globaleventhandlers
@ -1308,7 +1299,9 @@ impl Window {
self.current_state.set(WindowState::Zombie);
*self.js_runtime.borrow_mut() = None;
self.window_proxy.set(None);
self.performance.set(None);
if let Some(performance) = self.performance.get() {
performance.clear_and_disable_performance_entry_buffer();
}
self.ignore_all_events();
}