diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-08-30 03:18:26 +0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-09-04 13:38:37 +0800 |
commit | 6d1136a37dba4ecb691699855cd9548481ac1e22 (patch) | |
tree | 4171cebbf4db102c7168f90b03106932a5582dc4 /components/script/dom/window.rs | |
parent | 39bd45529d6ef3eea8e0eeef77d0294e0db1b02c (diff) | |
download | servo-6d1136a37dba4ecb691699855cd9548481ac1e22.tar.gz servo-6d1136a37dba4ecb691699855cd9548481ac1e22.zip |
performance: clear and disable buffer on pipeline exit
use existing buffer max size
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index ac261879079..a79669d6c2e 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -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(); } |