mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Move ResourceFetchTiming into Arc
The purpose of this commit is to ensure that the Response object has access to Timing updates as previously the Response object simply stored a ResourceFetchTiming struct so updates on ResourceFetchTiming that were not explicitly done on the Response would not be passed down. The references to ServoArc are added because Response uses servo_arc::Arc rather than std::sync::Arc as is used elsewhere. So, we've switched those other places to servo_arc::Arc instead of switching Response to std::sync::Arc.
This commit is contained in:
parent
bb8166bb97
commit
7596c36959
5 changed files with 16 additions and 9 deletions
|
@ -114,7 +114,8 @@ pub struct Response {
|
|||
#[ignore_malloc_size_of = "AtomicBool heap size undefined"]
|
||||
pub aborted: Arc<AtomicBool>,
|
||||
/// track network metrics
|
||||
pub resource_timing: ResourceFetchTiming,
|
||||
#[ignore_malloc_size_of = "Mutex heap size undefined"]
|
||||
pub resource_timing: Arc<Mutex<ResourceFetchTiming>>,
|
||||
}
|
||||
|
||||
impl Response {
|
||||
|
@ -137,7 +138,7 @@ impl Response {
|
|||
internal_response: None,
|
||||
return_internal: true,
|
||||
aborted: Arc::new(AtomicBool::new(false)),
|
||||
resource_timing: resource_timing,
|
||||
resource_timing: Arc::new(Mutex::new(resource_timing)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +172,9 @@ impl Response {
|
|||
internal_response: None,
|
||||
return_internal: true,
|
||||
aborted: Arc::new(AtomicBool::new(false)),
|
||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Error),
|
||||
resource_timing: Arc::new(Mutex::new(ResourceFetchTiming::new(
|
||||
ResourceTimingType::Error,
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,8 +220,8 @@ impl Response {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_resource_timing(&self) -> &ResourceFetchTiming {
|
||||
&self.resource_timing
|
||||
pub fn get_resource_timing(&self) -> Arc<Mutex<ResourceFetchTiming>> {
|
||||
Arc::clone(&self.resource_timing)
|
||||
}
|
||||
|
||||
/// Convert to a filtered response, of type `filter_type`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue