Commit 6a5da7ce authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

gpu: hook up oopr read failure dump without crash

This will help diagnose high rates of webview read failures.

Bug: 977231
Change-Id: I2fd23593e62291c71c01583e3db6cd8a2ee5e8d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1707983Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680320}
parent 5f8be281
......@@ -299,6 +299,7 @@ target(link_target_type, "gles2_sources") {
":service",
"//base",
"//base/third_party/dynamic_annotations",
"//components/crash/core/common",
"//components/viz/common:resource_format_utils",
"//gpu/command_buffer/client",
"//gpu/command_buffer/common:gles2_utils",
......
include_rules = [
"+cc/paint",
"+third_party/skia",
"+components/crash/core/common/crash_key.h",
"+components/viz/common/gpu/metal_context_provider.h",
"+components/viz/common/gpu/vulkan_context_provider.h",
"+components/viz/common/resources/resource_format.h",
......
......@@ -4,9 +4,13 @@
#include "gpu/command_buffer/service/service_font_manager.h"
#include <inttypes.h>
#include "base/debug/dump_without_crashing.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "components/crash/core/common/crash_key.h"
#include "gpu/command_buffer/common/buffer.h"
#include "gpu/command_buffer/common/discardable_handle.h"
......@@ -86,6 +90,8 @@ class ServiceFontManager::SkiaDiscardableManager
: font_manager_(std::move(font_manager)) {}
~SkiaDiscardableManager() override = default;
static constexpr int kMaxDumps = 5;
bool deleteHandle(SkDiscardableHandleId handle_id) override {
if (!font_manager_)
return true;
......@@ -104,13 +110,29 @@ class ServiceFontManager::SkiaDiscardableManager
type == SkStrikeClient::kGlyphPath ||
type == SkStrikeClient::kGlyphImage);
constexpr int kMaxDumps = 5;
if (no_fallback && dump_count_ < kMaxDumps && base::RandInt(1, 100) == 1) {
++dump_count_;
base::debug::DumpWithoutCrashing();
}
}
void notifyReadFailure(
const DiscardableHandleManager::ReadFailureData& data) override {
if (dump_count_ >= kMaxDumps)
return;
std::string str = base::StringPrintf(
"ms: %zd, br: %zd, ts: %" PRIu64 ", sc: %" PRIu64 ", gic: %" PRIu64
", gpc: %" PRIu64,
data.memorySize, data.bytesRead, data.typefaceSize, data.strikeCount,
data.glyphImagesCount, data.glyphPathsCount);
static crash_reporter::CrashKeyString<128> crash_key("oop_read_failure");
crash_reporter::ScopedCrashKeyString auto_clear(&crash_key, str);
++dump_count_;
base::debug::DumpWithoutCrashing();
}
private:
int dump_count_ = 0;
scoped_refptr<ServiceFontManager> font_manager_;
......
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