aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-22 16:41:46 -0600
committerGitHub <noreply@github.com>2016-11-22 16:41:46 -0600
commit1535f84bf19790c96c9f79b3f55264927b989b7c (patch)
treeaac5134c268e463321a96a0f12a7f1ccda15e5fc /components/script
parentbcf41844833e1818768f9d8ca73a931996617868 (diff)
parent7ae19c07f00d46662222fa21658a216ec49f3839 (diff)
downloadservo-1535f84bf19790c96c9f79b3f55264927b989b7c.tar.gz
servo-1535f84bf19790c96c9f79b3f55264927b989b7c.zip
Auto merge of #14211 - asajeffrey:constellation-share-more-script-threads, r=jdm
Share script threads by tab and by eTLD+1 <!-- Please describe your changes on the following line: --> This PR shares script threads among all similar-origin documents in the same tab. This allows DOM object to be shared among same-origin same-tab documents. --- <!-- 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 fix #633. - [X] These changes do not require tests because refactoring. <!-- 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/14211) <!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/script_thread.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 8a5fd03c479..135fccf58c3 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1173,11 +1173,11 @@ impl ScriptThread {
fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) {
let NewLayoutInfo {
- parent_pipeline_id,
+ parent_info,
new_pipeline_id,
frame_id,
- frame_type,
load_data,
+ window_size,
pipeline_port,
layout_to_constellation_chan,
content_process_shutdown_chan,
@@ -1187,7 +1187,7 @@ impl ScriptThread {
let layout_pair = channel();
let layout_chan = layout_pair.0.clone();
- let layout_creation_info = NewLayoutThreadInfo {
+ let msg = message::Msg::CreateLayoutThread(NewLayoutThreadInfo {
id: new_pipeline_id,
url: load_data.url.clone(),
is_parent: false,
@@ -1198,19 +1198,18 @@ impl ScriptThread {
image_cache_thread: self.image_cache_thread.clone(),
content_process_shutdown_chan: content_process_shutdown_chan,
layout_threads: layout_threads,
- };
-
- let parent_window = self.documents.borrow().find_window(parent_pipeline_id)
- .expect("ScriptThread: received a layout for a parent pipeline not in this script thread. This is a bug.");
+ });
- // Tell layout to actually spawn the thread.
- parent_window.layout_chan()
- .send(message::Msg::CreateLayoutThread(layout_creation_info))
- .unwrap();
+ // Pick a layout thread, any layout thread
+ match self.documents.borrow().iter().next() {
+ None => panic!("Layout attached to empty script thread."),
+ // Tell the layout thread factory to actually spawn the thread.
+ Some((_, document)) => document.window().layout_chan().send(msg).unwrap(),
+ };
// Kick off the fetch for the new resource.
- let new_load = InProgressLoad::new(new_pipeline_id, frame_id, Some((parent_pipeline_id, frame_type)),
- layout_chan, parent_window.window_size(),
+ let new_load = InProgressLoad::new(new_pipeline_id, frame_id, parent_info,
+ layout_chan, window_size,
load_data.url.clone());
self.start_page_load(new_load, load_data);
}