Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/payments/core/journey_logger.h" | 5 #include "components/payments/core/journey_logger.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_functions.h" | 9 #include "base/metrics/histogram_functions.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 void JourneyLogger::SetShowCalled() { | 103 void JourneyLogger::SetShowCalled() { |
| 104 was_show_called_ = true; | 104 was_show_called_ = true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void JourneyLogger::SetEventOccurred(Event event) { | 107 void JourneyLogger::SetEventOccurred(Event event) { |
| 108 events_ |= event; | 108 events_ |= event; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void JourneyLogger::RecordJourneyStatsHistograms( | 111 void JourneyLogger::RecordJourneyStatsHistograms( |
| 112 CompletionStatus completion_status) { | 112 CompletionStatus completion_status) { |
| 113 DCHECK(!has_recorded_); | 113 if (has_recorded_) |
|
Mathieu
2017/05/09 18:12:19
We should enforce this better, so I agree with the
sebsg
2017/05/10 14:58:48
My fear is that we'll be missing some logs. With t
Mathieu
2017/05/10 17:04:20
In the destructor we could add a DCHECK(has_record
sebsg
2017/05/10 18:20:26
Sure, I understand that, it's a good point so I ha
| |
| 114 return; | |
| 114 has_recorded_ = true; | 115 has_recorded_ = true; |
| 115 | 116 |
| 116 RecordSectionSpecificStats(completion_status); | 117 RecordSectionSpecificStats(completion_status); |
| 117 | 118 |
| 118 // Record the CanMakePayment metrics based on whether the transaction was | 119 // Record the CanMakePayment metrics based on whether the transaction was |
| 119 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted). | 120 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted). |
| 120 RecordCanMakePaymentStats(completion_status); | 121 RecordCanMakePaymentStats(completion_status); |
| 121 | 122 |
| 122 RecordUrlKeyedMetrics(completion_status); | 123 RecordUrlKeyedMetrics(completion_status); |
| 123 } | 124 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 int32_t source_id = ukm_service_->GetNewSourceID(); | 229 int32_t source_id = ukm_service_->GetNewSourceID(); |
| 229 ukm_service_->UpdateSourceURL(source_id, url_); | 230 ukm_service_->UpdateSourceURL(source_id, url_); |
| 230 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder( | 231 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder( |
| 231 source_id, internal::kUKMCheckoutEventsEntryName); | 232 source_id, internal::kUKMCheckoutEventsEntryName); |
| 232 builder->AddMetric(internal::kUKMCompletionStatusMetricName, | 233 builder->AddMetric(internal::kUKMCompletionStatusMetricName, |
| 233 completion_status); | 234 completion_status); |
| 234 builder->AddMetric(internal::kUKMEventsMetricName, events_); | 235 builder->AddMetric(internal::kUKMEventsMetricName, events_); |
| 235 } | 236 } |
| 236 | 237 |
| 237 } // namespace payments | 238 } // namespace payments |
| OLD | NEW |