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

Unified Diff: tools/telemetry/telemetry/value/none_values.py

Issue 475503004: Support None value for telemetry values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out smoothness/rendering_stats changes Created 6 years, 4 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: tools/telemetry/telemetry/value/none_values.py
diff --git a/tools/telemetry/telemetry/value/none_values.py b/tools/telemetry/telemetry/value/none_values.py
new file mode 100644
index 0000000000000000000000000000000000000000..8738c764b35ad200014ad28768fe84fbc2c62480
--- /dev/null
+++ b/tools/telemetry/telemetry/value/none_values.py
@@ -0,0 +1,18 @@
+# Copyright 2014 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.
+
+MERGE_FAILURE_REASON = (
+ 'Merging values containing a None value results in a None value')
+
+class NoneValueMissingReason(Exception):
+ pass
+
+class ValueMustHaveNoneValue(Exception):
+ pass
+
+def ValidateNullableValue(value, none_value_reason):
nednguyen 2014/08/18 06:54:57 Validate none_value_reason's type since the AsDict
ariblue 2014/08/18 17:56:45 Done.
+ if value is None and none_value_reason is None:
+ raise NoneValueMissingReason()
+ if value is not None and none_value_reason is not None:
+ raise ValueMustHaveNoneValue()

Powered by Google App Engine
This is Rietveld 408576698