Commit b7c35726 authored by Xi Cheng's avatar Xi Cheng Committed by Commit Bot

Introduce notification_helper_constants.* to improve code consistency

Bug: 734095
Change-Id: Idf5637bb57a7cbfb0b5831cf99e45806d8a9abc6
Reviewed-on: https://chromium-review.googlesource.com/1026972Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Xi Cheng <chengx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553451}
parent 708062c2
......@@ -2925,6 +2925,7 @@ jumbo_split_static_library("browser") {
"//chrome/common:metrics_constants_util_win",
"//chrome/common:version_header",
"//chrome/install_static:install_static_util",
"//chrome/notification_helper:constants",
"//chrome/services/util_win/public/mojom",
"//chrome_elf:blacklist",
"//chrome_elf:constants",
......
......@@ -6,6 +6,7 @@ include_rules = [
"+chrome/grit",
"+chrome/install_static",
"+chrome/installer/util",
"+chrome/notification_helper/notification_helper_constants.h",
"+chrome/services/file_util/public",
"+chrome/services/media_gallery_util/public",
"+chrome/services/printing/public",
......
......@@ -134,6 +134,7 @@
#include "chrome/browser/metrics/google_update_metrics_provider_win.h"
#include "chrome/common/metrics_constants_util_win.h"
#include "chrome/install_static/install_util.h"
#include "chrome/notification_helper/notification_helper_constants.h"
#include "components/browser_watcher/watcher_metrics_provider_win.h"
#endif
......@@ -166,13 +167,6 @@ const int kMaxHistogramGatheringWaitDuration = 60000; // 60 seconds.
// third_party/crashpad/crashpad/handler/handler_main.cc.
const char kCrashpadHistogramAllocatorName[] = "CrashpadMetrics";
#if defined(OS_WIN)
// Must be kept in sync with the allocator name in
// notification_helper/notification_helper.cc.
constexpr char kNotificationHelperHistogramAllocatorName[] =
"NotificationHelperMetrics";
#endif
#if defined(OS_WIN) || defined(OS_MACOSX)
// The stream type assigned to the minidump stream that holds the serialized
// system profile proto.
......@@ -198,7 +192,7 @@ void RegisterFileMetricsPreferences(PrefRegistrySimple* registry) {
registry, installer::kSetupHistogramAllocatorName);
metrics::FileMetricsProvider::RegisterPrefs(
registry, kNotificationHelperHistogramAllocatorName);
registry, notification_helper::kNotificationHelperHistogramAllocatorName);
#endif
}
......@@ -306,7 +300,8 @@ std::unique_ptr<metrics::FileMetricsProvider> CreateFileMetricsProvider(
// potential duplicate code.
if (!user_data_dir.empty()) {
base::FilePath notification_helper_metrics_upload_dir =
user_data_dir.AppendASCII(kNotificationHelperHistogramAllocatorName);
user_data_dir.AppendASCII(
notification_helper::kNotificationHelperHistogramAllocatorName);
if (metrics_reporting_enabled) {
file_metrics_provider->RegisterSource(
......@@ -314,7 +309,7 @@ std::unique_ptr<metrics::FileMetricsProvider> CreateFileMetricsProvider(
notification_helper_metrics_upload_dir,
metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_DIR,
metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN,
kNotificationHelperHistogramAllocatorName));
notification_helper::kNotificationHelperHistogramAllocatorName));
} else {
base::PostTaskWithTraits(
FROM_HERE,
......
......@@ -18,6 +18,7 @@ executable("notification_helper") {
configs += [ "//build/config/win:windowed" ]
deps = [
":constants",
":lib",
":version_resources",
"//base",
......@@ -52,6 +53,13 @@ source_set("lib") {
]
}
source_set("constants") {
sources = [
"notification_helper_constants.cc",
"notification_helper_constants.h",
]
}
process_version_rc_template("version_resources") {
sources = [
"notification_helper_exe.ver",
......
......@@ -16,6 +16,7 @@
#include "chrome/install_static/product_install_details.h"
#include "chrome/install_static/user_data_dir.h"
#include "chrome/notification_helper/com_server_module.h"
#include "chrome/notification_helper/notification_helper_constants.h"
#include "chrome/notification_helper/notification_helper_crash_reporter_client.h"
#include "chrome/notification_helper/notification_helper_util.h"
#include "chrome/notification_helper/trace_util.h"
......@@ -25,10 +26,8 @@ extern "C" int WINAPI wWinMain(HINSTANCE instance,
wchar_t* command_line,
int show_command) {
// Persist histograms so they can be uploaded later.
// The allocator name must be kept in sync with the writer in
// chrome/browser/metrics/chrome_metrics_service_client.cc.
base::PersistentHistogramStorage persistent_histogram_storage(
"NotificationHelperMetrics",
notification_helper::kNotificationHelperHistogramAllocatorName,
base::PersistentHistogramStorage::StorageDirManagement::kCreate);
// Initialize the CommandLine singleton from the environment.
......
// Copyright 2018 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 "chrome/notification_helper/notification_helper_constants.h"
namespace notification_helper {
const char kNotificationHelperHistogramAllocatorName[] =
"NotificationHelperMetrics";
} // namespace notification_helper
// Copyright 2018 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 CHROME_NOTIFICATION_HELPER_NOTIFICATION_HELPER_CONSTANTS_H_
#define CHROME_NOTIFICATION_HELPER_NOTIFICATION_HELPER_CONSTANTS_H_
namespace notification_helper {
extern const char kNotificationHelperHistogramAllocatorName[];
} // namespace notification_helper
#endif // CHROME_NOTIFICATION_HELPER_NOTIFICATION_HELPER_CONSTANTS_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