Commit 0e15b711 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Fix recording of success in FCMInvalidations.SubscriptionRequestStatus

Before this CL, when we failed to extract a topic name from the response
to a per-user-topic subscription request, we'd record *both* kSuccess
and kParsingFailure in the FCMInvalidations.SubscriptionRequestStatus
histogram.
This CL fixes this by recording kSuccess only on actual success.
This probably makes little or no difference in practice, but let's be
consistent.

Bug: 1023813
Change-Id: I16ea38e4df5783455450e250ee0fd732ed0aa4f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911751Reviewed-by: default avatarTatiana Gornak <melandory@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714878}
parent 602bec12
......@@ -183,11 +183,11 @@ void PerUserTopicRegistrationRequest::OnJsonParse(
return;
}
const std::string* private_topic_name = GetTopicName(*result.value);
RecordRequestStatus(SubscriptionStatus::kSuccess, type_, topic_);
if (private_topic_name) {
const std::string* topic_name = GetTopicName(*result.value);
if (topic_name) {
RecordRequestStatus(SubscriptionStatus::kSuccess, type_, topic_);
std::move(request_completed_callback_)
.Run(Status(StatusCode::SUCCESS, std::string()), *private_topic_name);
.Run(Status(StatusCode::SUCCESS, std::string()), *topic_name);
} else {
RecordRequestStatus(SubscriptionStatus::kParsingFailure, type_, topic_);
std::move(request_completed_callback_)
......
......@@ -26,10 +26,10 @@ namespace syncer {
class PerUserTopicRegistrationRequest {
public:
// The request result consists of the request status and name of the private
// topic. The |private_topic_name| will be empty in the case of error.
// topic. The |topic_name| will be empty in the case of error.
using CompletedCallback =
base::OnceCallback<void(const Status& status,
const std::string& private_topic_name)>;
const std::string& topic_name)>;
enum RequestType { SUBSCRIBE, UNSUBSCRIBE };
// Builds authenticated PerUserTopicRegistrationRequests.
......
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