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

Unified Diff: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h

Issue 1909633003: Collect UMA data for Origin Trials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address some comments Created 4 years, 8 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/origin_trials/OriginTrialContext.h
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
index 1b4b6772a2957519e527e8b250413092b5d323fa..80550e0f321b08ae8a2b60fc2827b80a97ae5f88 100644
--- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
+++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
@@ -17,20 +17,20 @@ namespace blink {
class ExecutionContext;
class WebTrialTokenValidator;
-// The Experimental Framework (EF) provides limited access to experimental
-// features, on a per-origin basis (origin trials). This class provides the
-// implementation to check if the experimental feature should be enabled for the
-// current context. This class is not for direct use by feature implementers.
+// The Origin Trials Framework provides limited access to experimental features,
+// on a per-origin basis (origin trials). This class provides the implementation
+// to check if the experimental feature should be enabled for the current
+// context. This class is not for direct use by feature implementers.
// Instead, the OriginTrials generated namespace provides a method for each
// feature to check if it is enabled. Experimental features must be defined in
// RuntimeEnabledFeatures.in, which is used to generate OriginTrials.h/cpp.
//
// Experimental features are defined by string names, provided by the
-// implementers. The EF code does not maintain an enum or constant list for
-// feature names. Instead, the EF validates the name provided by the feature
-// implementation against any provided tokens.
+// implementers. The framework does not maintain an enum or constant list for
+// feature names. Instead, the name provided by the feature implementation
+// is validated against any provided tokens.
//
-// TODO(chasej): Link to documentation, or provide more detail on keys, .etc
+// For more information, see https://github.com/jpchase/OriginTrials.
class CORE_EXPORT OriginTrialContext final : public GarbageCollectedFinalized<OriginTrialContext>, public Supplement<ExecutionContext> {
USING_GARBAGE_COLLECTED_MIXIN(OriginTrialContext)
public:
@@ -53,6 +53,13 @@ private:
Member<ExecutionContext> m_host;
Vector<String> m_tokens;
+ int checkFeatureEnabled(const String& featureName, String* errorMessage, WebTrialTokenValidator* = nullptr);
+
+ // Records whether metrics about the enabled status have been recorded, for
+ // each feature name. Only one result should be recorded per context,
+ // regardless of how many times the enabled check is actually done.
+ HashSet<String> m_enabledResultCountedForFeature;
+
// Records whether an error message has been generated, for each feature
// name. Since these messages are generally written to the console, this is
// used to avoid cluttering the console with messages on every access.

Powered by Google App Engine
This is Rietveld 408576698