mirror of
https://github.com/servo/servo.git
synced 2025-08-31 01:58:23 +01:00
Made PipelineId non-zero, so optional ids take no more space.
This commit is contained in:
parent
a0afa66dbe
commit
6754b2834f
11 changed files with 79 additions and 33 deletions
|
@ -8,7 +8,7 @@ use gfx::display_list::{DisplayItem, DisplayList, ImageDisplayItem};
|
|||
use gfx_traits::Epoch;
|
||||
use ipc_channel::ipc;
|
||||
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
|
||||
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId};
|
||||
use msg::constellation_msg::TEST_PIPELINE_ID;
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use profile_traits::time::{ProfilerChan, TimerMetadata};
|
||||
use style::computed_values::image_rendering;
|
||||
|
@ -23,30 +23,22 @@ impl ProfilerMetadataFactory for DummyProfilerMetadataFactory {
|
|||
|
||||
#[test]
|
||||
fn test_paint_metrics_construction() {
|
||||
let pipeline_id = PipelineId {
|
||||
namespace_id: PipelineNamespaceId(1),
|
||||
index: PipelineIndex(1),
|
||||
};
|
||||
let (sender, _) = ipc::channel().unwrap();
|
||||
let profiler_chan = ProfilerChan(sender);
|
||||
let (layout_sender, _) = ipc::channel().unwrap();
|
||||
let (script_sender, _) = ipc::channel().unwrap();
|
||||
let paint_time_metrics = PaintTimeMetrics::new(pipeline_id, profiler_chan, layout_sender, script_sender);
|
||||
let paint_time_metrics = PaintTimeMetrics::new(TEST_PIPELINE_ID, profiler_chan, layout_sender, script_sender);
|
||||
assert_eq!(paint_time_metrics.get_navigation_start(), None, "navigation start is None");
|
||||
assert_eq!(paint_time_metrics.get_first_paint(), None, "first paint is None");
|
||||
assert_eq!(paint_time_metrics.get_first_contentful_paint(), None, "first contentful paint is None");
|
||||
}
|
||||
|
||||
fn test_common(display_list: &DisplayList, epoch: Epoch) -> PaintTimeMetrics {
|
||||
let pipeline_id = PipelineId {
|
||||
namespace_id: PipelineNamespaceId(1),
|
||||
index: PipelineIndex(1),
|
||||
};
|
||||
let (sender, _) = ipc::channel().unwrap();
|
||||
let profiler_chan = ProfilerChan(sender);
|
||||
let (layout_sender, _) = ipc::channel().unwrap();
|
||||
let (script_sender, _) = ipc::channel().unwrap();
|
||||
let mut paint_time_metrics = PaintTimeMetrics::new(pipeline_id, profiler_chan, layout_sender, script_sender);
|
||||
let mut paint_time_metrics = PaintTimeMetrics::new(TEST_PIPELINE_ID, profiler_chan, layout_sender, script_sender);
|
||||
let dummy_profiler_metadata_factory = DummyProfilerMetadataFactory {};
|
||||
|
||||
paint_time_metrics.maybe_observe_paint_time(&dummy_profiler_metadata_factory,
|
||||
|
@ -81,12 +73,8 @@ fn test_first_paint_setter() {
|
|||
|
||||
#[test]
|
||||
fn test_first_contentful_paint_setter() {
|
||||
let pipeline_id = PipelineId {
|
||||
namespace_id: PipelineNamespaceId(1),
|
||||
index: PipelineIndex(1),
|
||||
};
|
||||
let image = DisplayItem::Image(Box::new(ImageDisplayItem {
|
||||
base: BaseDisplayItem::empty(pipeline_id),
|
||||
base: BaseDisplayItem::empty(TEST_PIPELINE_ID),
|
||||
webrender_image: WebRenderImageInfo {
|
||||
width: 1,
|
||||
height: 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue