Commit 32744f2f authored by Alexander Cooper's avatar Alexander Cooper Committed by Commit Bot

Cleanup session_metrics_helper before move to content

Makes a couple of small cleanup changes that came up as a result of
either presubmit warnings or DEPS issues when moving metrics code to
content:
* Swap two "NULL"s for "nullptr"s
* Replace ukm::GetSourceIdForWebContentsDocument with
  WebContents::GetLastCommittedSourceId

Bug: 1031622
Change-Id: Ic41ffa44abe9774b954c78bb6d710720b5632a9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2151326
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759423}
parent 9f3c75c8
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "chrome/browser/vr/metrics/session_timer.h" #include "chrome/browser/vr/metrics/session_timer.h"
#include "chrome/browser/vr/metrics/webxr_session_tracker.h" #include "chrome/browser/vr/metrics/webxr_session_tracker.h"
#include "components/ukm/content/source_url_recorder.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
...@@ -71,10 +70,10 @@ SessionMetricsHelper* SessionMetricsHelper::FromWebContents( ...@@ -71,10 +70,10 @@ SessionMetricsHelper* SessionMetricsHelper::FromWebContents(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!web_contents) if (!web_contents)
return NULL; return nullptr;
SessionMetricsHelperData* data = static_cast<SessionMetricsHelperData*>( SessionMetricsHelperData* data = static_cast<SessionMetricsHelperData*>(
web_contents->GetUserData(kSessionMetricsHelperDataKey)); web_contents->GetUserData(kSessionMetricsHelperDataKey));
return data ? data->get() : NULL; return data ? data->get() : nullptr;
} }
// static // static
...@@ -114,10 +113,9 @@ SessionMetricsHelper::StartInlineSession( ...@@ -114,10 +113,9 @@ SessionMetricsHelper::StartInlineSession(
webxr_inline_session_trackers_.end()); webxr_inline_session_trackers_.end());
auto result = webxr_inline_session_trackers_.emplace( auto result = webxr_inline_session_trackers_.emplace(
session_id, session_id, std::make_unique<WebXRSessionTracker>(
std::make_unique<WebXRSessionTracker>( std::make_unique<ukm::builders::XR_WebXR_Session>(
std::make_unique<ukm::builders::XR_WebXR_Session>( web_contents()->GetLastCommittedSourceId())));
ukm::GetSourceIdForWebContentsDocument(web_contents()))));
auto* tracker = result.first->second.get(); auto* tracker = result.first->second.get();
ReportInitialSessionData(tracker, session_options, enabled_features); ReportInitialSessionData(tracker, session_options, enabled_features);
...@@ -152,7 +150,7 @@ SessionMetricsHelper::StartImmersiveSession( ...@@ -152,7 +150,7 @@ SessionMetricsHelper::StartImmersiveSession(
webxr_immersive_session_tracker_ = std::make_unique<WebXRSessionTracker>( webxr_immersive_session_tracker_ = std::make_unique<WebXRSessionTracker>(
std::make_unique<ukm::builders::XR_WebXR_Session>( std::make_unique<ukm::builders::XR_WebXR_Session>(
ukm::GetSourceIdForWebContentsDocument(web_contents()))); web_contents()->GetLastCommittedSourceId()));
// TODO(https://crbug.com/1056930): Consider renaming the timers to something // TODO(https://crbug.com/1056930): Consider renaming the timers to something
// that indicates both that these also record AR, and that these are no longer // that indicates both that these also record AR, and that these are no longer
......
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