Commit 939390e6 authored by Tobias Sargeant's avatar Tobias Sargeant Committed by Commit Bot

[weblayer] Add crash keys for package info and SDK version

Also rearrange directory structure slightly to group crash-related
source files.

Change-Id: Iae6bb34c9cb708ac4297cbbeb99be38f1481220a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916826Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarAlex Clarke <alexclarke@chromium.org>
Commit-Queue: Tobias Sargeant <tobiasjs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715673}
parent fa7c9c1e
......@@ -269,8 +269,10 @@ jumbo_static_library("weblayer_lib") {
if (is_android) {
sources += [
"common/crash_reporter_client.cc",
"common/crash_reporter_client.h",
"common/crash_reporter/crash_keys.cc",
"common/crash_reporter/crash_keys.h",
"common/crash_reporter/crash_reporter_client.cc",
"common/crash_reporter/crash_reporter_client.h",
]
deps += [
"//android_webview:generate_aw_resources",
......
......@@ -35,7 +35,8 @@
#include "ui/base/resource/resource_bundle_android.h"
#include "ui/base/ui_base_switches.h"
#include "weblayer/browser/android_descriptors.h"
#include "weblayer/common/crash_reporter_client.h"
#include "weblayer/common/crash_reporter/crash_keys.h"
#include "weblayer/common/crash_reporter/crash_reporter_client.h"
#endif
#if defined(OS_WIN)
......@@ -153,6 +154,7 @@ void ContentMainDelegateImpl::PreSandboxStartup() {
EnableCrashReporter(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessType));
SetWebLayerCrashKeys();
#endif
}
......
include_rules = [
"+components/crash",
"+components/version_info",
"+content/app/resources",
"+content/public/common",
"+third_party/blink/public/strings/grit/blink_strings.h",
......
include_rules = [
"+components/crash",
"+components/version_info",
]
// Copyright 2019 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 "weblayer/common/crash_reporter/crash_keys.h"
#include "base/android/build_info.h"
#include "base/strings/string_number_conversions.h"
#include "components/crash/core/common/crash_key.h"
namespace weblayer {
namespace crash_keys {
const char kAppPackageName[] = "app-package-name";
const char kAppPackageVersionCode[] = "app-package-version-code";
const char kAndroidSdkInt[] = "android-sdk-int";
} // namespace crash_keys
void SetWebLayerCrashKeys() {
base::android::BuildInfo* android_build_info =
base::android::BuildInfo::GetInstance();
static ::crash_reporter::CrashKeyString<64> app_name_key(
crash_keys::kAppPackageName);
app_name_key.Set(android_build_info->host_package_name());
static ::crash_reporter::CrashKeyString<64> app_version_key(
crash_keys::kAppPackageVersionCode);
app_version_key.Set(android_build_info->host_version_code());
static ::crash_reporter::CrashKeyString<8> sdk_int_key(
crash_keys::kAndroidSdkInt);
sdk_int_key.Set(base::NumberToString(android_build_info->sdk_int()));
}
} // namespace weblayer
// Copyright 2019 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 WEBLAYER_COMMON_CRASH_REPORTER_CRASH_KEYS_H_
#define WEBLAYER_COMMON_CRASH_REPORTER_CRASH_KEYS_H_
namespace weblayer {
namespace crash_keys {
// Crash Key Name Constants ////////////////////////////////////////////////////
// Application information.
extern const char kAppPackageName[];
extern const char kAppPackageVersionCode[];
extern const char kAndroidSdkInt[];
} // namespace crash_keys
void SetWebLayerCrashKeys();
} // namespace weblayer
#endif // WEBLAYER_COMMON_CRASH_REPORTER_CRASH_KEYS_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "weblayer/common/crash_reporter_client.h"
#include "weblayer/common/crash_reporter/crash_reporter_client.h"
#include <stdint.h>
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBLAYER_COMMON_CRASH_REPORTER_CLIENT_H_
#define WEBLAYER_COMMON_CRASH_REPORTER_CLIENT_H_
#ifndef WEBLAYER_COMMON_CRASH_REPORTER_CRASH_REPORTER_CLIENT_H_
#define WEBLAYER_COMMON_CRASH_REPORTER_CRASH_REPORTER_CLIENT_H_
#include <string>
......@@ -16,4 +16,4 @@ void EnableCrashReporter(const std::string& process_type);
} // namespace weblayer
#endif // WEBLAYER_COMMON_CRASH_REPORTER_CLIENT_H_
#endif // WEBLAYER_COMMON_CRASH_REPORTER_CRASH_REPORTER_CLIENT_H_
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