Commit 60c2cc21 authored by David Dorwin's avatar David Dorwin Committed by Commit Bot

[fuchsia] Move Feedback annotation registration to feedback_registration.h

Also renames both methods in feedback_registration.h to be more accurate.

This is a follow-up to https://crrev.com/c/2315796.

Change-Id: I4960a7b1cc076ee00bd22e043e08e44ec476a57c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422155
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Auto-Submit: David Dorwin <ddorwin@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811866}
parent 5c057861
......@@ -13,8 +13,9 @@
namespace cr_fuchsia {
void RegisterCrashReportingFields(base::StringPiece component_url,
base::StringPiece crash_product_name) {
void RegisterProductDataForCrashReporting(
base::StringPiece component_url,
base::StringPiece crash_product_name) {
fuchsia::feedback::CrashReportingProduct product_data;
product_data.set_name(crash_product_name.as_string());
product_data.set_version(version_info::GetVersionNumber());
......@@ -27,4 +28,16 @@ void RegisterCrashReportingFields(base::StringPiece component_url,
->Upsert(component_url.as_string(), std::move(product_data));
}
void RegisterProductDataForFeedback(base::StringPiece component_namespace) {
fuchsia::feedback::ComponentData component_data;
component_data.set_namespace_(component_namespace.as_string());
// TODO(https://crbug.com/1077428): Add release channel to the annotations.
component_data.mutable_annotations()->push_back(
{"version", version_info::GetVersionNumber()});
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::feedback::ComponentDataRegister>()
->Upsert(std::move(component_data), []() {});
}
} // namespace cr_fuchsia
......@@ -14,8 +14,15 @@ namespace cr_fuchsia {
// the version from version_info, and an appropriate value for the release
// channel. |component_url| must match the current component. The calling
// process must have access to "fuchsia.feedback.CrashReportingProductRegister".
void RegisterCrashReportingFields(base::StringPiece component_url,
base::StringPiece crash_product_name);
void RegisterProductDataForCrashReporting(base::StringPiece component_url,
base::StringPiece crash_product_name);
// Registers basic annotations for the component in |component_namespace|.
// Feedback reports will contain a namespace |component_namespace| that contains
// the version from version_info, and an appropriate value for the release
// channel. The calling process must have access to
// "fuchsia.feedback.ComponentDataRegister".
void RegisterProductDataForFeedback(base::StringPiece component_namespace);
} // namespace cr_fuchsia
......
......@@ -4,7 +4,6 @@
#include "fuchsia/engine/context_provider_main.h"
#include <fuchsia/feedback/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h>
#include <lib/sys/cpp/outgoing_directory.h>
......@@ -38,27 +37,13 @@ std::string GetVersionString() {
return version_string;
}
// TODO(ddorwin): Move to feedback_registration.h.
// TODO(https://crbug.com/1010222): Add annotations at Context startup, once
// Contexts are moved out to run in their own components.
void RegisterFeedbackAnnotations() {
fuchsia::feedback::ComponentData component_data;
component_data.set_namespace_(kFeedbackAnnotationsNamespace);
// TODO(https://crbug.com/1077428): Add release channel to the annotations.
component_data.mutable_annotations()->push_back(
{"version", version_info::GetVersionNumber()});
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::feedback::ComponentDataRegister>()
->Upsert(std::move(component_data), []() {});
}
} // namespace
int ContextProviderMain() {
base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI);
cr_fuchsia::RegisterCrashReportingFields(kComponentUrl, kCrashProductName);
cr_fuchsia::RegisterProductDataForCrashReporting(kComponentUrl,
kCrashProductName);
if (!cr_fuchsia::InitLoggingFromCommandLine(
*base::CommandLine::ForCurrentProcess())) {
......@@ -66,7 +51,9 @@ int ContextProviderMain() {
}
// Populate feedback annotations for this component.
RegisterFeedbackAnnotations();
// TODO(crbug.com/1010222): Add annotations at Context startup, once Contexts
// are moved out to run in their own components.
cr_fuchsia::RegisterProductDataForFeedback(kFeedbackAnnotationsNamespace);
LOG(INFO) << "Starting WebEngine " << GetVersionString();
......
......@@ -54,7 +54,8 @@ int main(int argc, char** argv) {
base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO);
base::RunLoop run_loop;
cr_fuchsia::RegisterCrashReportingFields(kComponentUrl, kCrashProductName);
cr_fuchsia::RegisterProductDataForCrashReporting(kComponentUrl,
kCrashProductName);
base::CommandLine::Init(argc, argv);
CHECK(cr_fuchsia::InitLoggingFromCommandLine(
......
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