Skip to content

Commit b7e5331

Browse files
author
Jérôme Lebel
committed
[iOS] Should create IOSUserEventService as soon as possible
IOSUserEventService is not synchronous. To avoid to have the DCHECK in ConsentAuditor::RecordGaiaConsent() failing, this service should be created as soon as possible, to make sure it is correctly initialized before using it. With this fix, it is now possible to put back the DCHECK in ConsentAuditor::RecordGaiaConsent(). Bug: 819176 Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs Change-Id: I66be7843eb3cc73686c07b0ffdee232c90dad7dd Reviewed-on: https://chromium-review.googlesource.com/951484 Commit-Queue: Jérôme Lebel <jlebel@chromium.org> Reviewed-by: Martin Šrámek <msramek@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#541123}(cherry picked from commit 1f2f87f) Reviewed-on: https://chromium-review.googlesource.com/953463 Reviewed-by: Jérôme Lebel <jlebel@chromium.org> Cr-Commit-Position: refs/branch-heads/3359@{#72} Cr-Branched-From: 66afc5e-refs/heads/master@{#540276}
1 parent 640eb24 commit b7e5331

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/consent_auditor/consent_auditor.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "base/metrics/histogram_macros.h"
1010
#include "base/values.h"
11-
#include "build/build_config.h"
1211
#include "components/consent_auditor/pref_names.h"
1312
#include "components/prefs/pref_registry_simple.h"
1413
#include "components/prefs/pref_service.h"
@@ -111,14 +110,10 @@ void ConsentAuditor::RecordGaiaConsent(
111110
// FakeUserEventService doesn't have a sync bridge.
112111
// TODO(crbug.com/709094, crbug.com/761485): Remove this check when the store
113112
// initializes synchronously and is instantly ready to receive data.
114-
#if !defined(OS_IOS)
115-
// TODO(crbug.com/819176): On iOS the sync is may not be ready if the user
116-
// taps on "OK GOT IT" button too fast.
117113
DCHECK(!user_event_service_->GetSyncBridge() ||
118114
user_event_service_->GetSyncBridge()
119115
->change_processor()
120116
->IsTrackingMetadata());
121-
#endif
122117
user_event_service_->RecordUserEvent(std::move(specifics));
123118
}
124119

ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "ios/chrome/browser/signin/gaia_cookie_manager_service_factory.h"
4141
#include "ios/chrome/browser/signin/signin_manager_factory.h"
4242
#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
43+
#include "ios/chrome/browser/sync/ios_user_event_service_factory.h"
4344

4445
namespace {
4546

@@ -223,6 +224,10 @@ void ChromeBrowserStateManagerImpl::DoFinalInitForServices(
223224
->SetupInvalidationsOnProfileLoad(invalidation_service);
224225
ios::AccountReconcilorFactory::GetForBrowserState(browser_state);
225226
DesktopPromotionSyncServiceFactory::GetForBrowserState(browser_state);
227+
// TODO(crbug.com/709094), TODO(crbug.com/761485): Remove this following line
228+
// when UserEventService will be initialized synchronously. Until then, the
229+
// service has to be created as early as possible.
230+
IOSUserEventServiceFactory::GetForBrowserState(browser_state);
226231
}
227232

228233
void ChromeBrowserStateManagerImpl::AddBrowserStateToCache(

0 commit comments

Comments
 (0)