mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
canvas: trace/instrument canvas messages processing (#38600)
Add some tracing/instrumenting for canvas messages processing. Testing: We have not tests for tracing code. Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
3f7f9ba6cd
commit
68ad03c40a
6 changed files with 23 additions and 4 deletions
|
@ -15,6 +15,7 @@ path = "lib.rs"
|
|||
vello = ["dep:vello", "dep:pollster", "dep:futures-intrusive", "dep:peniko"]
|
||||
vello_cpu = ["dep:vello_cpu", "dep:peniko"]
|
||||
raqote = ["dep:raqote", "dep:font-kit"]
|
||||
tracing = ["dep:tracing"]
|
||||
|
||||
[dependencies]
|
||||
app_units = { workspace = true }
|
||||
|
@ -43,3 +44,6 @@ vello = { workspace = true, optional = true }
|
|||
vello_cpu = { workspace = true, optional = true }
|
||||
pollster = { version = "0.4", optional = true }
|
||||
futures-intrusive = { version = "0.5", optional = true }
|
||||
|
||||
tracing = { workspace = true, optional = true }
|
||||
servo-tracing = { workspace = true }
|
||||
|
|
|
@ -641,7 +641,15 @@ impl<DrawTarget: GenericDrawTarget> CanvasData<DrawTarget> {
|
|||
|
||||
/// Update image in WebRender
|
||||
pub(crate) fn update_image_rendering(&mut self) {
|
||||
let (descriptor, data) = self.drawtarget.image_descriptor_and_serializable_data();
|
||||
let (descriptor, data) = {
|
||||
#[cfg(feature = "tracing")]
|
||||
let _span = tracing::trace_span!(
|
||||
"image_descriptor_and_serializable_data",
|
||||
servo_profiling = true,
|
||||
)
|
||||
.entered();
|
||||
self.drawtarget.image_descriptor_and_serializable_data()
|
||||
};
|
||||
|
||||
self.compositor_api
|
||||
.update_image(self.image_key, descriptor, data);
|
||||
|
@ -732,7 +740,7 @@ impl<DrawTarget: GenericDrawTarget> CanvasData<DrawTarget> {
|
|||
/// It reads image data from the canvas
|
||||
/// canvas_size: The size of the canvas we're reading from
|
||||
/// read_rect: The area of the canvas we want to read from
|
||||
#[allow(unsafe_code)]
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
pub(crate) fn read_pixels(&mut self, read_rect: Option<Rect<u32>>) -> Snapshot {
|
||||
let canvas_size = self.drawtarget.get_size().cast();
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ impl CanvasPaintThread {
|
|||
(create_sender, ipc_sender)
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
pub fn create_canvas(&mut self, size: Size2D<u64>) -> Option<(CanvasId, ImageKey)> {
|
||||
let canvas_id = self.next_canvas_id;
|
||||
self.next_canvas_id.0 += 1;
|
||||
|
@ -117,6 +118,10 @@ impl CanvasPaintThread {
|
|||
Some((canvas_id, image_key))
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(
|
||||
skip_all,
|
||||
fields(message = message.to_string())
|
||||
)]
|
||||
fn process_canvas_2d_message(&mut self, message: Canvas2dMsg, canvas_id: CanvasId) {
|
||||
match message {
|
||||
Canvas2dMsg::FillText(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue