Repository navigation
Added a TopLevelBrowsingContextId type. - #16916
bors-servo merged 1 commit into
Conversation
|
Heads up! This PR modifies the following files:
|
|
This is the next step in the effort to allow more than one root browsing context. cc @cbrewster @paulrouget |
|
r? @cbrewster |
cbrewster
left a comment
There was a problem hiding this comment.
Looking good! +1 for more type safety
| @@ -700,8 +685,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> | |||
| /// Get an iterator for browsing contexts. Specify self.root_browsing context_id to | |||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. | |||
There was a problem hiding this comment.
Update to state that this can only iterate a sub-tree
| } | ||
|
|
||
| /// Get an iterator for browsing contexts. Specify self.root_browsing context_id to | ||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. |
There was a problem hiding this comment.
This can only iterate an entire tree.
| } | ||
|
|
||
| /// Get an iterator for browsing contexts. Specify self.root_browsing_context_id to | ||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. |
| } | ||
|
|
||
| /// Get an iterator for browsing contexts. Specify self.root_browsing_context_id to | ||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. |
| // If the pipeline lookup fails, it is because we have torn down the pipeline, | ||
| // so it is reasonable to silently ignore the event. | ||
| let browsing_context_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.browsing_context_id); | ||
| let top_level_browsing_context_id = self.pipelines.get(&pipeline_id) |
There was a problem hiding this comment.
Yes, this is one of those odd cases that the extra typechecking helped with. Yay types!
|
|
||
| /// Spawns a new layout thread. | ||
| fn create(id: PipelineId, | ||
| top_level_browsing_context_id: Option<BrowsingContextId>, |
There was a problem hiding this comment.
I remembered why we wanted this, which is for crash reporting, so that if a layout panic happens we know which top-level browsing context to blame.
|
|
||
| /// The ID of the top-level browsing context that contains this Pipeline. | ||
| pub top_level_browsing_context_id: BrowsingContextId, | ||
| pub top_level_browsing_context_id: TopLevelBrowsingContextId, |
There was a problem hiding this comment.
Is this still needed since the layout thread no longer needs it?
| } | ||
|
|
||
| /// Get an iterator for browsing contexts. Specify self.root_browsing context_id to | ||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. |
| } | ||
|
|
||
| /// Get an iterator for browsing contexts. Specify self.root_browsing_context_id to | ||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. |
| } | ||
|
|
||
| /// Get an iterator for browsing contexts. Specify self.root_browsing_context_id to | ||
| /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree. |
| // If the pipeline lookup fails, it is because we have torn down the pipeline, | ||
| // so it is reasonable to silently ignore the event. | ||
| let browsing_context_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.browsing_context_id); | ||
| let top_level_browsing_context_id = self.pipelines.get(&pipeline_id) |
There was a problem hiding this comment.
Yes, this is one of those odd cases that the extra typechecking helped with. Yay types!
|
|
||
| /// Spawns a new layout thread. | ||
| fn create(id: PipelineId, | ||
| top_level_browsing_context_id: Option<BrowsingContextId>, |
There was a problem hiding this comment.
I remembered why we wanted this, which is for crash reporting, so that if a layout panic happens we know which top-level browsing context to blame.
| // the compositor below. | ||
| let root_pipeline_id = self.browsing_contexts.get(&self.root_browsing_context_id) | ||
| let root_browsing_context_id = BrowsingContextId::from(self.root_browsing_context_id); | ||
| let root_pipeline_id = self.browsing_contexts.get(&root_browsing_context_id) |
There was a problem hiding this comment.
I wonder if we could replace these occurrences with:
self.browsing_contexts.get(&self.root_browsing_context_id.into())
since From<T> for U implies Into<U> for T
There was a problem hiding this comment.
I prefer T::from(x) over x.into() just because I find it easier to read. x.into() is rather mysterious, it converts from one unnamed type to another unnamed type. YMMV.
|
You can decide whether to switch to |
53174cb to
273c474
Compare
|
Squashed. @bors-servo r=cbrewster |
|
📌 Commit 273c474 has been approved by |
…ntexts, r=cbrewster Added a TopLevelBrowsingContextId type. <!-- Please describe your changes on the following line: --> Added a `TopLevelBrowsingContextId` type, which is a subtype of `BrowsingContextId` that only refers to top-level browsing contexts. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because refactoring <!-- 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/16916) <!-- Reviewable:end -->
|
💔 Test failed - mac-rel-wpt1 |
Details |
|
Well the good news is that I can replicate this locally. Not entirely sure how I broke synchronous iframe discarding, off to do some digging... |
|
Figured it out... When we were synchronously discarding a browsing context, we were calling |
273c474 to
4257736
Compare
|
@bors-servo r=cbrewster |
|
📌 Commit 4257736 has been approved by |
…ntexts, r=cbrewster Added a TopLevelBrowsingContextId type. <!-- Please describe your changes on the following line: --> Added a `TopLevelBrowsingContextId` type, which is a subtype of `BrowsingContextId` that only refers to top-level browsing contexts. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because refactoring <!-- 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/16916) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev |
Added a
TopLevelBrowsingContextIdtype, which is a subtype ofBrowsingContextIdthat only refers to top-level browsing contexts../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is