Commit fdfa08e0 authored by Bill Orr's avatar Bill Orr Committed by Commit Bot

Fix an issue where VR UKM was getting possibly stale source ids

UKM updates the per-WebContents source id during WebContentsObserver callbacks.
VR fires UKM events during WebContentsObserver callbacks.  Navigation events
may get fired to VR or UKM first, so we may get stale ids.

BUG=866633

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Iaf99f70b0defecd34156d64526ecd329f2315876
Reviewed-on: https://chromium-review.googlesource.com/1147504Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Bill Orr <billorr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577994}
parent e464f72f
...@@ -614,10 +614,11 @@ void SessionMetricsHelper::DidFinishNavigation( ...@@ -614,10 +614,11 @@ void SessionMetricsHelper::DidFinishNavigation(
// Get the ukm::SourceId from the handle so that we don't wind up with a // Get the ukm::SourceId from the handle so that we don't wind up with a
// wrong ukm::SourceId from this WebContentObserver perhaps executing after // wrong ukm::SourceId from this WebContentObserver perhaps executing after
// another which changes the SourceId. // another which changes the SourceId.
ukm::SourceId source_id = ukm::ConvertToSourceId(
handle->GetNavigationId(), ukm::SourceIdType::NAVIGATION_ID);
page_session_tracker_ = page_session_tracker_ =
std::make_unique<SessionTracker<ukm::builders::XR_PageSession>>( std::make_unique<SessionTracker<ukm::builders::XR_PageSession>>(
std::make_unique<ukm::builders::XR_PageSession>( std::make_unique<ukm::builders::XR_PageSession>(source_id));
ukm::GetSourceIdForWebContentsDocument(web_contents())));
if (pending_page_session_start_action_) { if (pending_page_session_start_action_) {
LogVrStartAction(*pending_page_session_start_action_); LogVrStartAction(*pending_page_session_start_action_);
pending_page_session_start_action_ = base::nullopt; pending_page_session_start_action_ = base::nullopt;
......
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