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

Side by Side Diff: third_party/WebKit/Source/core/experiments/Experiments.h

Issue 1541983003: Force all experiment enabled checks to use ExperimentalFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments to explain class design and code generation Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef Experiments_h 5 #ifndef Experiments_h
6 #define Experiments_h 6 #define Experiments_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
11 #include "wtf/text/WTFString.h" 11 #include "wtf/text/WTFString.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // The Experimental Framework (EF) provides limited access to experimental APIs, 15 // The Experimental Framework (EF) provides limited access to experimental APIs,
16 // on a per-origin basis. This class provides an interface to API implementers, 16 // on a per-origin basis. This class provides the implementation to check if
17 // for checking if the experimental API should be enabled for the current 17 // the experimental API should be enabled for the current context. This class
18 // context. 18 // is not for direct use by API implementers. Instead, the ExperimentalFeatures
19 // generated class provides a static method for each API to check if it is
20 // enabled. Experimental APIs must be defined in RuntimeEnabledFeatures.in,
21 // which is used to generate ExperimentalFeatures.h/cpp.
19 // 22 //
20 // Experimental APIs are defined by string names, provided by the implementers. 23 // Experimental APIs are defined by string names, provided by the implementers.
21 // The EF code does not maintain an enum or constant list for experiment names. 24 // The EF code does not maintain an enum or constant list for experiment names.
22 // Instead, the EF validates the name provided by the API implementation against 25 // Instead, the EF validates the name provided by the API implementation against
23 // any provided API keys. 26 // any provided API keys.
24 // TODO(chasej): Link to documentation, or provide more detail on keys, .etc 27 // TODO(chasej): Link to documentation, or provide more detail on keys, .etc
25 class CORE_EXPORT Experiments { 28 class CORE_EXPORT Experiments {
26 public: 29 public:
27 static bool isApiEnabled(ExecutionContext*, const String& apiName, String& e rrorMessage);
28 // Creates a NotSupportedError exception with a message explaining to 30 // Creates a NotSupportedError exception with a message explaining to
29 // external developers why the API is disabled and how to join API 31 // external developers why the API is disabled and how to join API
30 // experiments. 32 // experiments.
31 static DOMException* createApiDisabledException(const String& apiName); 33 static DOMException* createApiDisabledException(const String& apiName);
32 34
33 private: 35 private:
36 friend class ExperimentalFeatures;
37 friend class ExperimentsTest;
38
34 explicit Experiments(); 39 explicit Experiments();
40
41 static bool isApiEnabled(ExecutionContext*, const String& apiName, String* e rrorMessage);
35 }; 42 };
36 43
37 } // namespace blink 44 } // namespace blink
38 45
39 #endif // Experiments_h 46 #endif // Experiments_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698