Commit 2a631a89 authored by Edwin Joe's avatar Edwin Joe Committed by Commit Bot

Fix viz.surface_id_flow trace category crashes

Added if guard before using submission_trace_id() and embed_trace_id() method of LocalSurfaceId in trace events to ensure that the LocalSurfaceId is valid when they are called.

Bug: 931792
Change-Id: I6cd64feb7b94d84dcd2b4df2d558cf5c8fc904a1
Reviewed-on: https://chromium-review.googlesource.com/c/1478931Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Commit-Queue: Edwin Joe <ejoe@google.com>
Cr-Commit-Position: refs/heads/master@{#633832}
parent c006633d
...@@ -40,13 +40,14 @@ void SurfaceLayer::SetSurfaceId(const viz::SurfaceId& surface_id, ...@@ -40,13 +40,14 @@ void SurfaceLayer::SetSurfaceId(const viz::SurfaceId& surface_id,
deadline_policy.use_existing_deadline()) { deadline_policy.use_existing_deadline()) {
return; return;
} }
if (surface_id.local_surface_id().is_valid()) {
TRACE_EVENT_WITH_FLOW2( TRACE_EVENT_WITH_FLOW2(
TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow"), TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow"),
"LocalSurfaceId.Embed.Flow", "LocalSurfaceId.Embed.Flow",
TRACE_ID_GLOBAL(surface_id.local_surface_id().embed_trace_id()), TRACE_ID_GLOBAL(surface_id.local_surface_id().embed_trace_id()),
TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "step", TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "step",
"SetSurfaceId", "surface_id", surface_id.ToString()); "SetSurfaceId", "surface_id", surface_id.ToString());
}
if (layer_tree_host() && surface_range_.IsValid()) if (layer_tree_host() && surface_range_.IsValid())
layer_tree_host()->RemoveSurfaceRange(surface_range_); layer_tree_host()->RemoveSurfaceRange(surface_range_);
......
...@@ -43,7 +43,8 @@ void SurfaceLayerImpl::SetRange(const viz::SurfaceRange& surface_range, ...@@ -43,7 +43,8 @@ void SurfaceLayerImpl::SetRange(const viz::SurfaceRange& surface_range,
return; return;
} }
if (surface_range_.end() != surface_range.end()) { if (surface_range_.end() != surface_range.end() &&
surface_range.end().local_surface_id().is_valid()) {
TRACE_EVENT_WITH_FLOW2( TRACE_EVENT_WITH_FLOW2(
TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow"), TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow"),
"LocalSurfaceId.Embed.Flow", "LocalSurfaceId.Embed.Flow",
...@@ -54,7 +55,8 @@ void SurfaceLayerImpl::SetRange(const viz::SurfaceRange& surface_range, ...@@ -54,7 +55,8 @@ void SurfaceLayerImpl::SetRange(const viz::SurfaceRange& surface_range,
} }
if (surface_range.start() && if (surface_range.start() &&
surface_range_.start() != surface_range.start()) { surface_range_.start() != surface_range.start() &&
surface_range.start()->local_surface_id().is_valid()) {
TRACE_EVENT_WITH_FLOW2( TRACE_EVENT_WITH_FLOW2(
TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow"), TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow"),
"LocalSurfaceId.Submission.Flow", "LocalSurfaceId.Submission.Flow",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment