Fix racing issue between creating report scheduler and loading profiles

There is a racing issue in existing logic.
1. UserSessionManager::PrepareProfile triggers a sub-thread to initialize the
profile information in ProfileManager.
2. UserCloudPolicyManagerChromeOS::StartReportSchedulerIfReady collects the
usage data in the main thread. ProfileReportGenerator will collect profile
info from ProfileManager no matter if it is ready or not.

Then, that's the interesting part: there is a |first_request_delay| parameter
in ReportScheduler::Start. In real environment, it can be between 0 and 24 *
60 * 60 seconds.
- If I hard code the value as 1 second or more, the #2 collects correct info
because #1 finishes.
- If I hard code the value as 0 second, the #2 collects nothing because #1
doesn't finish. (after 24 hours, the collection will trigger again, and
everything is fine.)

I need check such situation, then sync #1 and #2 by using a session
manager observer.

Bug: 1010213
Change-Id: I60ca3d2cf3cf64a453ccc99f41ef3d1d7971a616
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1989543
Commit-Queue: Anqing Zhao <anqing@google.com>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Sergey Poromov <poromov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730421}
5 files changed