aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-04-22 10:52:49 -0400
committerGitHub <noreply@github.com>2019-04-22 10:52:49 -0400
commit4e12deb7b6b61e2e329e8eaee431eddb473d1252 (patch)
treee81ca857db00b9266a4202b9a72977996049f057 /components/script/script_thread.rs
parent328244684a8b1f98d515d5f40655b9cf7347affd (diff)
parent4fd9fea7a64420265dfe482b577ad0fc74d2a817 (diff)
downloadservo-4e12deb7b6b61e2e329e8eaee431eddb473d1252.tar.gz
servo-4e12deb7b6b61e2e329e8eaee431eddb473d1252.zip
Auto merge of #23115 - pylbrecht:measure.blocked.layout.queries, r=jdm
measure blocked layout queries <!-- 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: --> - [X] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #19797 <!-- Either: --> - [ ] There are tests for these changes <!-- 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/23115) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 2118e3efda1..21a901db4bc 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -144,6 +144,7 @@ use std::option::Option;
use std::ptr;
use std::rc::Rc;
use std::result::Result;
+use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::thread;
use std::time::{Duration, SystemTime};
@@ -202,6 +203,8 @@ struct InProgressLoad {
navigation_start_precise: u64,
/// For cancelling the fetch
canceller: FetchCanceller,
+ /// Flag for sharing with the layout thread that is not yet created.
+ layout_is_busy: Arc<AtomicBool>,
}
impl InProgressLoad {
@@ -216,6 +219,7 @@ impl InProgressLoad {
window_size: WindowSizeData,
url: ServoUrl,
origin: MutableOrigin,
+ layout_is_busy: Arc<AtomicBool>,
) -> InProgressLoad {
let current_time = get_time();
let navigation_start_precise = precise_time_ns();
@@ -237,6 +241,7 @@ impl InProgressLoad {
navigation_start: (current_time.sec * 1000 + current_time.nsec as i64 / 1000000) as u64,
navigation_start_precise: navigation_start_precise,
canceller: Default::default(),
+ layout_is_busy: layout_is_busy,
}
}
}
@@ -702,6 +707,7 @@ impl ScriptThreadFactory for ScriptThread {
let opener = state.opener;
let mem_profiler_chan = state.mem_profiler_chan.clone();
let window_size = state.window_size;
+ let layout_is_busy = state.layout_is_busy.clone();
let script_thread = ScriptThread::new(state, script_port, script_chan.clone());
@@ -722,6 +728,7 @@ impl ScriptThreadFactory for ScriptThread {
window_size,
load_data.url.clone(),
origin,
+ layout_is_busy,
);
script_thread.pre_page_load(new_load, load_data);
@@ -2028,6 +2035,8 @@ impl ScriptThread {
let layout_pair = unbounded();
let layout_chan = layout_pair.0.clone();
+ let layout_is_busy = Arc::new(AtomicBool::new(false));
+
let msg = message::Msg::CreateLayoutThread(LayoutThreadInit {
id: new_pipeline_id,
url: load_data.url.clone(),
@@ -2046,6 +2055,7 @@ impl ScriptThread {
self.control_chan.clone(),
load_data.url.clone(),
),
+ layout_is_busy: layout_is_busy.clone(),
});
// Pick a layout thread, any layout thread
@@ -2079,6 +2089,7 @@ impl ScriptThread {
window_size,
load_data.url.clone(),
origin,
+ layout_is_busy.clone(),
);
if load_data.url.as_str() == "about:blank" {
self.start_page_load_about_blank(new_load, load_data.js_eval_result);
@@ -2875,6 +2886,7 @@ impl ScriptThread {
self.microtask_queue.clone(),
self.webrender_document,
self.webrender_api_sender.clone(),
+ incomplete.layout_is_busy,
);
// Initialize the browsing context for the window.