Commit 4bc3b9b2 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Crash keys for resource type and load flags in ResourceRequest.

This CL adds extra crash keys logged when a DumpWithoutCrashing happens
while handling a network::ResourceRequest: one for |resource_type| and
one for |load_flags|.  This extra crash keys should help ensure that the
expected values are seen in the most common cases of DwoC seen in
https://crbug.com/1056949.  See also the "Callstack and request
properties corresponding to the most frequent DwoC" section in a (Google
internal) doc here:

https://docs.google.com/document/d/1Q8UxpBLyv0SorQKLvY8M5npvyMroMlo9i6ZpUMol9aY/edit#heading=h.hquty15bu38n

Bug: 1056949
Change-Id: I765a1baac9e756747a54cf5b60cab54c63b520fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2386417
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803353}
parent 73d91f13
......@@ -5,6 +5,7 @@
#include "services/network/crash_keys.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "services/network/public/cpp/resource_request.h"
#include "url/gurl.h"
......@@ -25,6 +26,18 @@ base::debug::CrashKeyString* GetRequestInitiatorCrashKey() {
return crash_key;
}
base::debug::CrashKeyString* GetRequestResourceTypeCrashKey() {
static auto* crash_key = base::debug::AllocateCrashKeyString(
"request_resource_type", base::debug::CrashKeySize::Size32);
return crash_key;
}
base::debug::CrashKeyString* GetRequestLoadFlagsCrashKey() {
static auto* crash_key = base::debug::AllocateCrashKeyString(
"request_load_flags", base::debug::CrashKeySize::Size32);
return crash_key;
}
} // namespace
base::debug::CrashKeyString* GetRequestInitiatorOriginLockCrashKey() {
......@@ -37,7 +50,11 @@ ScopedRequestCrashKeys::ScopedRequestCrashKeys(
const network::ResourceRequest& request)
: url_(GetRequestUrlCrashKey(), request.url.possibly_invalid_spec()),
request_initiator_(GetRequestInitiatorCrashKey(),
base::OptionalOrNullptr(request.request_initiator)) {}
base::OptionalOrNullptr(request.request_initiator)),
resource_type_(GetRequestResourceTypeCrashKey(),
base::NumberToString(request.resource_type)),
load_flags_(GetRequestLoadFlagsCrashKey(),
base::NumberToString(request.load_flags)) {}
ScopedRequestCrashKeys::~ScopedRequestCrashKeys() = default;
......
......@@ -28,6 +28,14 @@ class ScopedRequestCrashKeys {
private:
base::debug::ScopedCrashKeyString url_;
url::debug::ScopedOriginCrashKey request_initiator_;
// TODO(lukasza): https://crbug.com/1056949: Remove this diagnostic aid once
// the bug is understood.
base::debug::ScopedCrashKeyString resource_type_;
// TODO(lukasza): https://crbug.com/1056949: Remove this diagnostic aid once
// the bug is understood.
base::debug::ScopedCrashKeyString load_flags_;
};
} // namespace debug
......
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