Commit fb99e53d authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Remove unused kEventPath RAPPOR metric

This CL removes (except for the enum) the kEventPath RAPPOR metric,
which was not being used.

Bug: 1016906
Change-Id: Iaf10b47805a3054f39568d82a8720f52722d752f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1896055Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713228}
parent 137f7274
...@@ -1277,7 +1277,6 @@ jumbo_source_set("unit_tests") { ...@@ -1277,7 +1277,6 @@ jumbo_source_set("unit_tests") {
"frame/local_frame_view_test.cc", "frame/local_frame_view_test.cc",
"frame/mhtml_archive_test.cc", "frame/mhtml_archive_test.cc",
"frame/mhtml_loading_test.cc", "frame/mhtml_loading_test.cc",
"frame/origins_using_features_test.cc",
"frame/performance_monitor_test.cc", "frame/performance_monitor_test.cc",
"frame/reporting_context_test.cc", "frame/reporting_context_test.cc",
"frame/root_frame_viewport_test.cc", "frame/root_frame_viewport_test.cc",
......
...@@ -316,10 +316,6 @@ void Event::SetHandlingPassive(PassiveMode mode) { ...@@ -316,10 +316,6 @@ void Event::SetHandlingPassive(PassiveMode mode) {
HeapVector<Member<EventTarget>> Event::PathInternal(ScriptState* script_state, HeapVector<Member<EventTarget>> Event::PathInternal(ScriptState* script_state,
EventPathMode mode) const { EventPathMode mode) const {
if (target_)
HostsUsingFeatures::CountHostOrIsolatedWorldHumanReadableName(
script_state, *target_, HostsUsingFeatures::Feature::kEventPath);
if (!current_target_) { if (!current_target_) {
DCHECK_EQ(Event::kNone, event_phase_); DCHECK_EQ(Event::kNone, event_phase_);
if (!event_path_) { if (!event_path_) {
......
...@@ -55,10 +55,6 @@ void HostsUsingFeatures::CountHostOrIsolatedWorldHumanReadableName( ...@@ -55,10 +55,6 @@ void HostsUsingFeatures::CountHostOrIsolatedWorldHumanReadableName(
document->HostsUsingFeaturesValue().Count(feature); document->HostsUsingFeaturesValue().Count(feature);
return; return;
} }
if (Page* page = document->GetPage()) {
page->GetHostsUsingFeatures().CountName(
feature, script_state->World().NonMainWorldHumanReadableName());
}
} }
void HostsUsingFeatures::Value::Count(Feature feature) { void HostsUsingFeatures::Value::Count(Feature feature) {
...@@ -66,13 +62,7 @@ void HostsUsingFeatures::Value::Count(Feature feature) { ...@@ -66,13 +62,7 @@ void HostsUsingFeatures::Value::Count(Feature feature) {
count_bits_ |= 1 << static_cast<unsigned>(feature); count_bits_ |= 1 << static_cast<unsigned>(feature);
} }
void HostsUsingFeatures::CountName(Feature feature, const String& name) {
auto result = value_by_name_.insert(name, Value());
result.stored_value->value.Count(feature);
}
void HostsUsingFeatures::Clear() { void HostsUsingFeatures::Clear() {
value_by_name_.clear();
url_and_values_.clear(); url_and_values_.clear();
} }
...@@ -96,8 +86,6 @@ void HostsUsingFeatures::UpdateMeasurementsAndClear() { ...@@ -96,8 +86,6 @@ void HostsUsingFeatures::UpdateMeasurementsAndClear() {
RecordETLDPlus1ToRappor(); RecordETLDPlus1ToRappor();
url_and_values_.clear(); url_and_values_.clear();
} }
if (!value_by_name_.IsEmpty())
RecordNamesToRappor();
} }
void HostsUsingFeatures::RecordHostToRappor() { void HostsUsingFeatures::RecordHostToRappor() {
...@@ -136,22 +124,11 @@ void HostsUsingFeatures::RecordETLDPlus1ToRappor() { ...@@ -136,22 +124,11 @@ void HostsUsingFeatures::RecordETLDPlus1ToRappor() {
url_and_value.value.RecordETLDPlus1ToRappor(KURL(url_and_value.key)); url_and_value.value.RecordETLDPlus1ToRappor(KURL(url_and_value.key));
} }
void HostsUsingFeatures::RecordNamesToRappor() {
DCHECK(!value_by_name_.IsEmpty());
for (auto& name_and_value : value_by_name_)
name_and_value.value.RecordNameToRappor(name_and_value.key);
value_by_name_.clear();
}
void HostsUsingFeatures::Value::Aggregate(HostsUsingFeatures::Value other) { void HostsUsingFeatures::Value::Aggregate(HostsUsingFeatures::Value other) {
count_bits_ |= other.count_bits_; count_bits_ |= other.count_bits_;
} }
void HostsUsingFeatures::Value::RecordHostToRappor(const String& host) { void HostsUsingFeatures::Value::RecordHostToRappor(const String& host) {
if (Get(Feature::kEventPath))
Platform::Current()->RecordRappor("WebComponents.EventPath", host);
if (Get(Feature::kDeviceMotionInsecureHost)) if (Get(Feature::kDeviceMotionInsecureHost))
Platform::Current()->RecordRappor( Platform::Current()->RecordRappor(
"PowerfulFeatureUse.Host.DeviceMotion.Insecure", host); "PowerfulFeatureUse.Host.DeviceMotion.Insecure", host);
...@@ -173,12 +150,6 @@ void HostsUsingFeatures::Value::RecordHostToRappor(const String& host) { ...@@ -173,12 +150,6 @@ void HostsUsingFeatures::Value::RecordHostToRappor(const String& host) {
"PowerfulFeatureUse.Host.ApplicationCacheAPI.Insecure", host); "PowerfulFeatureUse.Host.ApplicationCacheAPI.Insecure", host);
} }
void HostsUsingFeatures::Value::RecordNameToRappor(const String& name) {
if (Get(Feature::kEventPath))
Platform::Current()->RecordRappor("WebComponents.EventPath.Extensions",
name);
}
void HostsUsingFeatures::Value::RecordETLDPlus1ToRappor(const KURL& url) { void HostsUsingFeatures::Value::RecordETLDPlus1ToRappor(const KURL& url) {
if (Get(Feature::kGetUserMediaInsecureHost)) if (Get(Feature::kGetUserMediaInsecureHost))
Platform::Current()->RecordRapporURL( Platform::Current()->RecordRapporURL(
......
...@@ -29,7 +29,7 @@ class CORE_EXPORT HostsUsingFeatures { ...@@ -29,7 +29,7 @@ class CORE_EXPORT HostsUsingFeatures {
enum class Feature { enum class Feature {
kElementCreateShadowRoot_Unused, kElementCreateShadowRoot_Unused,
kDocumentRegisterElement_Unused, kDocumentRegisterElement_Unused,
kEventPath, kEventPath_Unused,
kDeviceMotionInsecureHost, kDeviceMotionInsecureHost,
kDeviceOrientationInsecureHost, kDeviceOrientationInsecureHost,
kFullscreenInsecureHost, kFullscreenInsecureHost,
...@@ -72,15 +72,12 @@ class CORE_EXPORT HostsUsingFeatures { ...@@ -72,15 +72,12 @@ class CORE_EXPORT HostsUsingFeatures {
void Aggregate(Value); void Aggregate(Value);
void RecordHostToRappor(const String& host); void RecordHostToRappor(const String& host);
void RecordNameToRappor(const String& name);
void RecordETLDPlus1ToRappor(const KURL&); void RecordETLDPlus1ToRappor(const KURL&);
private: private:
unsigned count_bits_ : static_cast<unsigned>(Feature::kNumberOfFeatures); unsigned count_bits_ : static_cast<unsigned>(Feature::kNumberOfFeatures);
}; };
void CountName(Feature, const String&);
HashMap<String, Value>& ValueByName() { return value_by_name_; }
void Clear(); void Clear();
private: private:
...@@ -89,7 +86,6 @@ class CORE_EXPORT HostsUsingFeatures { ...@@ -89,7 +86,6 @@ class CORE_EXPORT HostsUsingFeatures {
void RecordETLDPlus1ToRappor(); void RecordETLDPlus1ToRappor();
Vector<std::pair<KURL, HostsUsingFeatures::Value>, 1> url_and_values_; Vector<std::pair<KURL, HostsUsingFeatures::Value>, 1> url_and_values_;
HashMap<String, HostsUsingFeatures::Value> value_by_name_;
}; };
} // namespace blink } // namespace blink
......
// Copyright 2015 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 "third_party/blink/renderer/core/frame/hosts_using_features.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
TEST(HostsUsingFeaturesTest, countName) {
HostsUsingFeatures hosts_using_features;
hosts_using_features.CountName(HostsUsingFeatures::Feature::kEventPath,
"test 1");
EXPECT_EQ(1u, hosts_using_features.ValueByName().size());
hosts_using_features.CountName(HostsUsingFeatures::Feature::kEventPath,
"test 2");
EXPECT_EQ(2u, hosts_using_features.ValueByName().size());
EXPECT_TRUE(hosts_using_features.ValueByName().at("test 1").Get(
HostsUsingFeatures::Feature::kEventPath));
EXPECT_TRUE(hosts_using_features.ValueByName().at("test 2").Get(
HostsUsingFeatures::Feature::kEventPath));
hosts_using_features.Clear();
}
} // namespace blink
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