Commit d31606f5 authored by Ryan Sturm's avatar Ryan Sturm Committed by Chromium LUCI CQ

Fixing use of uninitialized PLM UKM value

render_process_assignment_ was uninitialized and can be used in OnHidden
before OnCommit happens. We'll move to the optional pattern used in this
file.

Bug: 1157751
Change-Id: I4c126735ef51b126b93208cc61a1a08802bde802
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2585991Reviewed-by: default avatarRobert Ogden <robertogden@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836206}
parent 8330d4a5
...@@ -757,9 +757,6 @@ void UkmPageLoadMetricsObserver::RecordPageLoadMetrics( ...@@ -757,9 +757,6 @@ void UkmPageLoadMetricsObserver::RecordPageLoadMetrics(
foreground_duration.value().InMilliseconds()); foreground_duration.value().InMilliseconds());
} }
builder.SetSiteInstanceRenderProcessAssignment(
SiteInstanceRenderProcessAssignmentToInt(render_process_assignment_));
// Convert to the EffectiveConnectionType as used in SystemProfileProto // Convert to the EffectiveConnectionType as used in SystemProfileProto
// before persisting the metric. // before persisting the metric.
metrics::SystemProfileProto::Network::EffectiveConnectionType metrics::SystemProfileProto::Network::EffectiveConnectionType
...@@ -803,8 +800,11 @@ void UkmPageLoadMetricsObserver::RecordPageLoadMetrics( ...@@ -803,8 +800,11 @@ void UkmPageLoadMetricsObserver::RecordPageLoadMetrics(
void UkmPageLoadMetricsObserver::RecordRendererUsageMetrics() { void UkmPageLoadMetricsObserver::RecordRendererUsageMetrics() {
ukm::builders::PageLoad builder(GetDelegate().GetPageUkmSourceId()); ukm::builders::PageLoad builder(GetDelegate().GetPageUkmSourceId());
builder.SetSiteInstanceRenderProcessAssignment( if (render_process_assignment_) {
SiteInstanceRenderProcessAssignmentToInt(render_process_assignment_)); builder.SetSiteInstanceRenderProcessAssignment(
SiteInstanceRenderProcessAssignmentToInt(
render_process_assignment_.value()));
}
builder.Record(ukm::UkmRecorder::Get()); builder.Record(ukm::UkmRecorder::Get());
} }
......
...@@ -222,7 +222,8 @@ class UkmPageLoadMetricsObserver ...@@ -222,7 +222,8 @@ class UkmPageLoadMetricsObserver
base::Optional<net::LoadTimingInfo> main_frame_timing_; base::Optional<net::LoadTimingInfo> main_frame_timing_;
// How the SiteInstance for the committed page was assigned a renderer. // How the SiteInstance for the committed page was assigned a renderer.
content::SiteInstanceProcessAssignment render_process_assignment_; base::Optional<content::SiteInstanceProcessAssignment>
render_process_assignment_;
// PAGE_TRANSITION_LINK is the default PageTransition value. // PAGE_TRANSITION_LINK is the default PageTransition value.
ui::PageTransition page_transition_ = ui::PAGE_TRANSITION_LINK; ui::PageTransition page_transition_ = ui::PAGE_TRANSITION_LINK;
......
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