Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: third_party/WebKit/Source/core/frame/HostsUsingFeatures.cpp

Issue 2057153002: Add GetUserMedia ETLD+1 rappor metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stop reporting host-based GetUserMedia rappor Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/HostsUsingFeatures.cpp
diff --git a/third_party/WebKit/Source/core/frame/HostsUsingFeatures.cpp b/third_party/WebKit/Source/core/frame/HostsUsingFeatures.cpp
index 8277ba8423c8d111fd9994ea6c5ab40342b99bdf..975e84283c6b3c5c4f7bb8b6f633e4566e26a67e 100644
--- a/third_party/WebKit/Source/core/frame/HostsUsingFeatures.cpp
+++ b/third_party/WebKit/Source/core/frame/HostsUsingFeatures.cpp
@@ -75,8 +75,8 @@ void HostsUsingFeatures::countName(Feature feature, const String& name)
void HostsUsingFeatures::clear()
{
- m_hostAndValues.clear();
m_valueByName.clear();
+ m_urlAndValues.clear();
}
void HostsUsingFeatures::documentDetached(Document& document)
@@ -89,37 +89,56 @@ void HostsUsingFeatures::documentDetached(Document& document)
if (!url.protocolIsInHTTPFamily())
return;
- m_hostAndValues.append(std::make_pair(url.host(), counter));
+ m_urlAndValues.append(std::make_pair(url, counter));
document.HostsUsingFeaturesValue().clear();
DCHECK(document.HostsUsingFeaturesValue().isEmpty());
}
void HostsUsingFeatures::updateMeasurementsAndClear()
{
- if (!m_hostAndValues.isEmpty())
+ if (!m_urlAndValues.isEmpty()) {
recordHostToRappor();
+ recordETLDPlus1ToRappor();
+ m_urlAndValues.clear();
+ }
if (!m_valueByName.isEmpty())
recordNamesToRappor();
}
void HostsUsingFeatures::recordHostToRappor()
{
- DCHECK(!m_hostAndValues.isEmpty());
+ DCHECK(!m_urlAndValues.isEmpty());
// Aggregate values by hosts.
HashMap<String, HostsUsingFeatures::Value> aggregatedByHost;
- for (const auto& hostAndValue : m_hostAndValues) {
- DCHECK(!hostAndValue.first.isEmpty());
- auto result = aggregatedByHost.add(hostAndValue.first, hostAndValue.second);
+ for (const auto& urlAndValue : m_urlAndValues) {
+ DCHECK(!urlAndValue.first.isEmpty());
+ auto result = aggregatedByHost.add(urlAndValue.first.host(), urlAndValue.second);
if (!result.isNewEntry)
- result.storedValue->value.aggregate(hostAndValue.second);
+ result.storedValue->value.aggregate(urlAndValue.second);
}
// Report to RAPPOR.
for (auto& hostAndValue : aggregatedByHost)
hostAndValue.value.recordHostToRappor(hostAndValue.key);
+}
+
+void HostsUsingFeatures::recordETLDPlus1ToRappor()
+{
+ DCHECK(!m_urlAndValues.isEmpty());
- m_hostAndValues.clear();
+ // Aggregate values by URL.
+ HashMap<String, HostsUsingFeatures::Value> aggregatedByURL;
+ for (const auto& urlAndValue : m_urlAndValues) {
+ DCHECK(!urlAndValue.first.isEmpty());
+ auto result = aggregatedByURL.add(urlAndValue.first, urlAndValue.second);
+ if (!result.isNewEntry)
+ result.storedValue->value.aggregate(urlAndValue.second);
+ }
+
+ // Report to RAPPOR.
+ for (auto& urlAndValue : aggregatedByURL)
+ urlAndValue.value.recordETLDPlus1ToRappor(KURL(ParsedURLString, urlAndValue.key));
}
void HostsUsingFeatures::recordNamesToRappor()
@@ -155,10 +174,6 @@ void HostsUsingFeatures::Value::recordHostToRappor(const String& host)
Platform::current()->recordRappor("PowerfulFeatureUse.Host.Fullscreen.Insecure", host);
if (get(Feature::GeolocationInsecureHost))
Platform::current()->recordRappor("PowerfulFeatureUse.Host.Geolocation.Insecure", host);
- if (get(Feature::GetUserMediaInsecureHost))
- Platform::current()->recordRappor("PowerfulFeatureUse.Host.GetUserMedia.Insecure", host);
- if (get(Feature::GetUserMediaSecureHost))
- Platform::current()->recordRappor("PowerfulFeatureUse.Host.GetUserMedia.Secure", host);
if (get(Feature::ApplicationCacheManifestSelectInsecureHost))
Platform::current()->recordRappor("PowerfulFeatureUse.Host.ApplicationCacheManifestSelect.Insecure", host);
if (get(Feature::ApplicationCacheAPIInsecureHost))
@@ -171,4 +186,12 @@ void HostsUsingFeatures::Value::recordNameToRappor(const String& name)
Platform::current()->recordRappor("WebComponents.EventPath.Extensions", name);
}
+void HostsUsingFeatures::Value::recordETLDPlus1ToRappor(const KURL& url)
+{
+ if (get(Feature::GetUserMediaInsecureHost))
+ Platform::current()->recordRapporURL("PowerfulFeatureUse.ETLDPlus1.GetUserMedia.Insecure", WebURL(url));
+ if (get(Feature::GetUserMediaSecureHost))
+ Platform::current()->recordRapporURL("PowerfulFeatureUse.ETLDPlus1.GetUserMedia.Secure", WebURL(url));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/HostsUsingFeatures.h ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698