Auto merge of #18670 - avadacatavra:interactive-metrics, r=jdm

added time to interactive metrics

<!-- Please describe your changes on the following line: -->

Added time to interactive metrics and refactored metrics/lib

I need to write tests, but wanted to submit the PR for review

---
<!-- 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/18670)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-25 15:53:57 -05:00 committed by GitHub
commit e438b094f6
28 changed files with 738 additions and 182 deletions

View file

@ -195,7 +195,8 @@ impl DedicatedWorkerGlobalScope {
println!("error loading script {}", serialized_worker_url);
parent_sender.send(CommonScriptMsg::Task(
WorkerEvent,
Box::new(SimpleWorkerErrorHandler::new(worker))
Box::new(SimpleWorkerErrorHandler::new(worker)),
pipeline_id
)).unwrap();
return;
}
@ -357,6 +358,7 @@ impl DedicatedWorkerGlobalScope {
#[allow(unsafe_code)]
pub fn forward_error_to_worker_object(&self, error_info: ErrorInfo) {
let worker = self.worker.borrow().as_ref().unwrap().clone();
let pipeline_id = self.upcast::<GlobalScope>().pipeline_id();
let task = Box::new(task!(forward_error_to_worker_object: move || {
let worker = worker.root();
let global = worker.global();
@ -382,7 +384,7 @@ impl DedicatedWorkerGlobalScope {
}
}));
// TODO: Should use the DOM manipulation task source.
self.parent_sender.send(CommonScriptMsg::Task(WorkerEvent, task)).unwrap();
self.parent_sender.send(CommonScriptMsg::Task(WorkerEvent, task, Some(pipeline_id))).unwrap();
}
}
@ -403,10 +405,11 @@ impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope {
unsafe fn PostMessage(&self, cx: *mut JSContext, message: HandleValue) -> ErrorResult {
let data = StructuredCloneData::write(cx, message)?;
let worker = self.worker.borrow().as_ref().unwrap().clone();
let pipeline_id = self.upcast::<GlobalScope>().pipeline_id();
let task = Box::new(task!(post_worker_message: move || {
Worker::handle_message(worker, data);
}));
self.parent_sender.send(CommonScriptMsg::Task(WorkerEvent, task)).unwrap();
self.parent_sender.send(CommonScriptMsg::Task(WorkerEvent, task, Some(pipeline_id))).unwrap();
Ok(())
}