Commit 1fb611e5 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Only call RecordMetricsReportingDefaultState once.

Even behind a dispatch_once, WelcomeToChromeViewController can be
displayed multiple times -- such as if the app is quit before accepting
the tos, or by test when using experiment settings.

Bug: 741003
Change-Id: I54c7ff333ba8c8b48ecb55dfc7fab649ed667243
Reviewed-on: https://chromium-review.googlesource.com/c/1489099
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Auto-Submit: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636334}
parent 4c5f1cdd
...@@ -88,6 +88,14 @@ const BOOL kDefaultStatsCheckboxValue = YES; ...@@ -88,6 +88,14 @@ const BOOL kDefaultStatsCheckboxValue = YES;
// Record metrics reporting as opt-in/opt-out only once. // Record metrics reporting as opt-in/opt-out only once.
static dispatch_once_t once; static dispatch_once_t once;
dispatch_once(&once, ^{ dispatch_once(&once, ^{
// Don't call RecordMetricsReportingDefaultState twice. This can happen
// if the app is quit before accepting the TOS, or via experiment settings.
if (metrics::GetMetricsReportingDefaultState(
GetApplicationContext()->GetLocalState()) !=
metrics::EnableMetricsDefault::DEFAULT_UNKNOWN) {
return;
}
metrics::RecordMetricsReportingDefaultState( metrics::RecordMetricsReportingDefaultState(
GetApplicationContext()->GetLocalState(), GetApplicationContext()->GetLocalState(),
kDefaultStatsCheckboxValue ? metrics::EnableMetricsDefault::OPT_OUT kDefaultStatsCheckboxValue ? metrics::EnableMetricsDefault::OPT_OUT
......
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