Commit 9fde8605 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Move page load count to use WebStateObserver::DidStartNavigation.

Currently page load count is done via the call to
StabilityMetricsHelper::LogLoadStarted in WebStateDidStartLoading.
DidStartLoading was never an ideal location, and the move to
WKBasedNavigationManager introduces even more complexity.

Instead, move this call to WebStateDidStartNavigation.

Rollout will start behind a feature flag that will be paired with the
SlimNav experiment and control groups.

Bug: 786547
Change-Id: I1100bd0cca68fe511b992c1df67c449a6739fc4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632570Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664016}
parent 0ca205f1
......@@ -18,6 +18,16 @@ source_set("ukm_url_recorder") {
]
}
source_set("features") {
sources = [
"features.cc",
"features.h",
]
deps = [
"//base",
]
}
source_set("metrics") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
......@@ -47,6 +57,7 @@ source_set("metrics") {
":ukm_url_recorder",
]
deps = [
":features",
"//base",
"//components/browser_sync",
"//components/crash/core/common",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ios/chrome/browser/metrics/features.h"
const base::Feature kLogLoadStartedInDidStartNavigation{
"LogLoadStartedInDidStartNavigation", base::FEATURE_DISABLED_BY_DEFAULT};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_METRICS_FEATURES_H_
#define IOS_CHROME_BROWSER_METRICS_FEATURES_H_
#include "base/feature_list.h"
// Feature flag to move -LogLoadStarted() to WebStateDidStartNavigation().
extern const base::Feature kLogLoadStartedInDidStartNavigation;
#endif // IOS_CHROME_BROWSER_METRICS_FEATURES_H_
......@@ -4,8 +4,10 @@
#include "ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/metrics/features.h"
#import "ios/web/public/web_state/navigation_context.h"
#import "ios/web/public/web_state/web_state.h"
......@@ -63,7 +65,8 @@ void IOSChromeStabilityMetricsProvider::WebStateDidStartLoading(
return;
UMA_HISTOGRAM_BOOLEAN(kPageLoadCountLoadingStartedMetric, true);
helper_.LogLoadStarted();
if (!base::FeatureList::IsEnabled(kLogLoadStartedInDidStartNavigation))
helper_.LogLoadStarted();
}
void IOSChromeStabilityMetricsProvider::WebStateDidStartNavigation(
......@@ -79,7 +82,8 @@ void IOSChromeStabilityMetricsProvider::WebStateDidStartNavigation(
} else if (navigation_context->IsSameDocument()) {
type = PageLoadCountNavigationType::SAME_DOCUMENT_WEB_NAVIGATION;
} else {
// TODO(crbug.com/786547): Move helper_.LogLoadStarted() here.
if (base::FeatureList::IsEnabled(kLogLoadStartedInDidStartNavigation))
helper_.LogLoadStarted();
}
UMA_HISTOGRAM_ENUMERATION(kPageLoadCountMetric, type,
PageLoadCountNavigationType::COUNT);
......
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