Commit 07f92dac authored by kylechar's avatar kylechar Committed by Commit Bot

Add deserialization error crash key

Add a crash key to figure out what deserialization error is causing the
main viz browser to GPU message pipe to be closed. The GPU process
crashes on reinitialization so the crash key will appear in the crash
dump.

Bug: 1075495
Change-Id: I3661cc3b09330eca8f8418dabad968d13fadba09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225119Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773707}
parent bc9a80d4
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("crash_keys") {
sources = [
"crash_keys.cc",
"crash_keys.h",
]
deps = [
"//base",
"//components/crash/core//common:crash_key",
]
}
include_rules = [
"+components/crash/core/common/crash_key.h",
]
......@@ -4,16 +4,43 @@
#include "services/viz/public/cpp/compositing/compositor_frame_mojom_traits.h"
#include "services/viz/public/cpp/crash_keys.h"
namespace mojo {
// static
bool StructTraits<viz::mojom::CompositorFrameDataView, viz::CompositorFrame>::
Read(viz::mojom::CompositorFrameDataView data, viz::CompositorFrame* out) {
return data.ReadPasses(&out->render_pass_list) &&
!out->render_pass_list.empty() &&
!out->render_pass_list.back()->output_rect.size().IsEmpty() &&
data.ReadMetadata(&out->metadata) &&
data.ReadResources(&out->resource_list);
if (!data.ReadPasses(&out->render_pass_list)) {
viz::SetDeserializationCrashKeyString(
"Failed read CompositorFrame::render_pass_list");
return false;
}
if (out->render_pass_list.empty()) {
viz::SetDeserializationCrashKeyString(
"CompositorFrame::render_pass_list empty");
return false;
}
if (out->render_pass_list.back()->output_rect.size().IsEmpty()) {
viz::SetDeserializationCrashKeyString("CompositorFrame empty");
return false;
}
if (!data.ReadMetadata(&out->metadata)) {
viz::SetDeserializationCrashKeyString(
"Failed read CompositorFrame::metadata");
return false;
}
if (!data.ReadResources(&out->resource_list)) {
viz::SetDeserializationCrashKeyString(
"Failed read CompositorFrame::resource_list");
return false;
}
return true;
}
} // namespace mojo
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/viz/public/cpp/crash_keys.h"
#include "components/crash/core/common/crash_key.h"
namespace viz {
void SetDeserializationCrashKeyString(base::StringPiece str) {
static crash_reporter::CrashKeyString<128> key("viz_deserialization");
key.Set(str);
}
} // namespace viz
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_VIZ_PUBLIC_CPP_CRASH_KEYS_H_
#define SERVICES_VIZ_PUBLIC_CPP_CRASH_KEYS_H_
#include "base/strings/string_piece.h"
namespace viz {
// Sets a crash key to indicate what structure triggered a deserialization error
// in viz mojom code.
void SetDeserializationCrashKeyString(base::StringPiece str);
} // namespace viz
#endif // SERVICES_VIZ_PUBLIC_CPP_CRASH_KEYS_H_
......@@ -4,18 +4,28 @@
#include "services/viz/public/cpp/hit_test/hit_test_region_list_mojom_traits.h"
#include "services/viz/public/cpp/crash_keys.h"
namespace mojo {
// static
bool StructTraits<viz::mojom::HitTestRegionDataView, viz::HitTestRegion>::Read(
viz::mojom::HitTestRegionDataView data,
viz::HitTestRegion* out) {
if (!data.ReadFrameSinkId(&out->frame_sink_id))
if (!data.ReadFrameSinkId(&out->frame_sink_id)) {
viz::SetDeserializationCrashKeyString(
"Failed read HitTestRegion::frame_sink_id");
return false;
if (!data.ReadRect(&out->rect))
}
if (!data.ReadRect(&out->rect)) {
viz::SetDeserializationCrashKeyString("Failed read HitTestRegion::rect");
return false;
if (!data.ReadTransform(&out->transform))
}
if (!data.ReadTransform(&out->transform)) {
viz::SetDeserializationCrashKeyString(
"Failed read HitTestRegion::transform");
return false;
}
out->flags = data.flags();
out->async_hit_test_reasons = data.async_hit_test_reasons();
return true;
......@@ -28,10 +38,16 @@ bool StructTraits<
viz::HitTestRegionList* out) {
if (!data.ReadRegions(&out->regions))
return false;
if (!data.ReadBounds(&out->bounds))
if (!data.ReadBounds(&out->bounds)) {
viz::SetDeserializationCrashKeyString(
"Failed read HitTestRegionList::bounds");
return false;
if (!data.ReadTransform(&out->transform))
}
if (!data.ReadTransform(&out->transform)) {
viz::SetDeserializationCrashKeyString(
"Failed read HitTestRegionList::transform");
return false;
}
out->flags = data.flags();
out->async_hit_test_reasons = data.async_hit_test_reasons();
return true;
......
......@@ -178,7 +178,10 @@ mojom("mojom") {
traits_private_headers = [
"//services/viz/public/cpp/compositing/compositor_frame_mojom_traits.h",
]
traits_public_deps = [ "//components/viz/common" ]
traits_public_deps = [
"//components/viz/common",
"//services/viz/public/cpp:crash_keys",
]
},
{
types = [
......@@ -285,6 +288,7 @@ mojom("mojom") {
traits_sources = [ "//services/viz/public/cpp/hit_test/hit_test_region_list_mojom_traits.cc" ]
traits_public_deps = [
"//components/viz/common",
"//services/viz/public/cpp:crash_keys",
"//ui/gfx/geometry/mojom",
]
},
......
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