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

Unified Diff: chromecast/base/cast_features.h

Issue 2825873002: [Chromecast] Use base::FeatureList to control features. (Closed)
Patch Set: Rebase. Created 3 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: chromecast/base/cast_features.h
diff --git a/chromecast/base/cast_features.h b/chromecast/base/cast_features.h
new file mode 100644
index 0000000000000000000000000000000000000000..5380a65772fe97afc3420f1a3f85ff1020d45a74
--- /dev/null
+++ b/chromecast/base/cast_features.h
@@ -0,0 +1,44 @@
+// Copyright 2017 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 CHROMECAST_BASE_CAST_FEATURES_H_
+#define CHROMECAST_BASE_CAST_FEATURES_H_
+
+#include <memory>
+#include <unordered_set>
+
+#include "base/feature_list.h"
+#include "base/macros.h"
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+}
+
+namespace chromecast {
+
+// Initialize the global base::FeatureListInstance, taking into account
+// overrides from DCS and the command line. |features| is read from the
+// PrefService in the browser. Thread-safe.
halliwell 2017/04/20 02:49:31 I'm not sure "Thread-safe" completely characterise
slan 2017/04/20 16:26:02 You're right. Done.
+void InitializeFeatureList(const base::DictionaryValue& dcs_features,
+ const base::ListValue& dcs_experiment_ids,
+ const std::string& cmd_line_enable_features,
halliwell 2017/04/20 02:49:31 nit, include string
slan 2017/04/20 16:26:02 Done.
+ const std::string& cmd_line_disable_features);
+
+// Given a dictionary of features, create a copy that is ready to be persisted
+// to disk. Encodes all values as strings, which is how the FieldTrial
+// classes expect the param data.
+std::unique_ptr<base::DictionaryValue> GetOverriddenFeaturesForStorage(
+ const base::DictionaryValue& features);
+
+// Query the set of experiment ids set for this run. Intended only for metrics
+// reporting. Must be called after InitializeFeatureList. Thread-safe.
+std::unordered_set<int32_t> GetDCSExperimentIds();
halliwell 2017/04/20 02:49:31 include <cstdint>
halliwell 2017/04/20 02:49:31 how big is this set? Are users expecting to modif
slan 2017/04/20 16:26:02 Done.
slan 2017/04/20 16:26:02 This set is read-only. It will only ever be as lar
+
+// Reset static state to ensure clean unittests. For tests only!
+void ResetCastFeaturesForTest();
+
+} // namespace chromecast
+
+#endif // CHROMECAST_BASE_CAST_FEATURES_H_

Powered by Google App Engine
This is Rietveld 408576698