diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-11-20 12:00:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20 12:00:05 -0500 |
commit | 5da10694912fa43b673f74445f4f249eaf46b451 (patch) | |
tree | f1a7ef3496871d67907734dc10c2cc9df31f27cf /components/script/dom/document.rs | |
parent | 3fe83f1d06a50969b2fa731a050b35abdc5520d7 (diff) | |
parent | 26007fddd3f8aabfe026f06de64207d31edf5318 (diff) | |
download | servo-5da10694912fa43b673f74445f4f249eaf46b451.tar.gz servo-5da10694912fa43b673f74445f4f249eaf46b451.zip |
Auto merge of #20459 - avadacatavra:time-origin, r=avadacatavra
Updating performance implementation and putting more measurements in
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20459)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 367ce9e2377..e15d735527b 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -356,6 +356,8 @@ pub struct Document { top_level_dom_complete: Cell<u64>, load_event_start: Cell<u64>, load_event_end: Cell<u64>, + unload_event_start: Cell<u64>, + unload_event_end: Cell<u64>, /// <https://html.spec.whatwg.org/multipage/#concept-document-https-state> https_state: Cell<HttpsState>, /// The document's origin. @@ -406,6 +408,8 @@ pub struct Document { fired_unload: Cell<bool>, /// List of responsive images responsive_images: DomRefCell<Vec<Dom<HTMLImageElement>>>, + /// Number of redirects for the document load + redirect_count: Cell<u16>, } #[derive(JSTraceable, MallocSizeOf)] @@ -2290,6 +2294,14 @@ impl Document { self.load_event_end.get() } + pub fn get_unload_event_start(&self) -> u64 { + self.unload_event_start.get() + } + + pub fn get_unload_event_end(&self) -> u64 { + self.unload_event_end.get() + } + pub fn start_tti(&self) { if self.get_interactive_metrics().needs_tti() { self.tti_window.borrow_mut().start_window(); @@ -2654,6 +2666,8 @@ impl Document { top_level_dom_complete: Cell::new(Default::default()), load_event_start: Cell::new(Default::default()), load_event_end: Cell::new(Default::default()), + unload_event_start: Cell::new(Default::default()), + unload_event_end: Cell::new(Default::default()), https_state: Cell::new(HttpsState::None), origin: origin, referrer: referrer, @@ -2674,6 +2688,7 @@ impl Document { salvageable: Cell::new(true), fired_unload: Cell::new(false), responsive_images: Default::default(), + redirect_count: Cell::new(0), } } @@ -2739,6 +2754,14 @@ impl Document { document } + pub fn get_redirect_count(&self) -> u16 { + self.redirect_count.get() + } + + pub fn set_redirect_count(&self, count: u16) { + self.redirect_count.set(count) + } + fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> { let doc = self.GetDocumentElement(); let maybe_node = doc.r().map(Castable::upcast::<Node>); @@ -4268,6 +4291,9 @@ impl DocumentMethods for Document { return Ok(DomRoot::from_ref(self)); } + // TODO: prompt to unload. + // TODO: set unload_event_start and unload_event_end + window_from_node(self).set_navigation_start(); // Step 7 |