| Index: tracing/tracing/value/value.html
|
| diff --git a/tracing/tracing/value/value.html b/tracing/tracing/value/value.html
|
| deleted file mode 100644
|
| index 3bcfe9adac77d94e038fcb7c9ef4525bfd1b1411..0000000000000000000000000000000000000000
|
| --- a/tracing/tracing/value/value.html
|
| +++ /dev/null
|
| @@ -1,143 +0,0 @@
|
| -<!DOCTYPE html>
|
| -<!--
|
| -Copyright (c) 2015 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.
|
| --->
|
| -
|
| -<link rel="import" href="/tracing/base/guid.html">
|
| -<link rel="import" href="/tracing/base/iteration_helpers.html">
|
| -<link rel="import" href="/tracing/base/utils.html">
|
| -<link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html">
|
| -
|
| -<script>
|
| -'use strict';
|
| -
|
| -tr.exportTo('tr.v', function() {
|
| - /** @constructor */
|
| - function Value(name, opt_options) {
|
| - if (typeof(name) !== 'string')
|
| - throw new Error('name must be a string');
|
| -
|
| - this.name_ = name;
|
| - this.shortName = undefined;
|
| -
|
| - // If this Value is being deserialized, then its guid will be set by
|
| - // fromDict().
|
| - // If this Value is being computed by a metric, then its guid will be
|
| - // allocated the first time the guid is gotten by asDict().
|
| - this.guid_ = undefined;
|
| -
|
| - this.diagnostics = new tr.v.d.DiagnosticMap();
|
| -
|
| - var options = opt_options || {};
|
| - this.description = options.description;
|
| - this.important = options.important !== undefined ?
|
| - options.important : false;
|
| - }
|
| -
|
| - Value.fromDict = function(d) {
|
| - var value = undefined;
|
| - switch (d.type) {
|
| - case 'numeric':
|
| - value = NumericValue.fromDict(d);
|
| - break;
|
| -
|
| - default:
|
| - throw new Error('Not implemented');
|
| - }
|
| -
|
| - value.guid = d.guid;
|
| - value.shortName = d.shortName;
|
| - value.diagnostics.addDicts(d.diagnostics);
|
| - return value;
|
| - };
|
| -
|
| - Value.prototype = {
|
| - get guid() {
|
| - if (this.guid_ === undefined)
|
| - this.guid_ = tr.b.GUID.allocateUUID4();
|
| -
|
| - return this.guid_;
|
| - },
|
| -
|
| - set guid(guid) {
|
| - if (this.guid_ !== undefined)
|
| - throw new Error('Cannot reset guid');
|
| -
|
| - this.guid_ = guid;
|
| - },
|
| -
|
| - get name() {
|
| - return this.name_;
|
| - },
|
| -
|
| - asDict: function() {
|
| - return this.asJSON();
|
| - },
|
| -
|
| - asJSON: function() {
|
| - var d = {
|
| - guid: this.guid,
|
| - name: this.name_,
|
| - description: this.description,
|
| - important: this.important,
|
| - diagnostics: this.diagnostics.asDict()
|
| - };
|
| -
|
| - if (this.shortName)
|
| - d.shortName = this.shortName;
|
| -
|
| - this.asDictInto_(d);
|
| - if (d.type === undefined)
|
| - throw new Error('asDictInto_ must set type field');
|
| - return d;
|
| - },
|
| -
|
| - asDictInto_: function(d) {
|
| - throw new Error('Not implemented');
|
| - }
|
| - };
|
| -
|
| - /** @constructor */
|
| - function NumericValue(name, numeric, opt_options) {
|
| - if (!(numeric instanceof tr.v.Histogram))
|
| - throw new Error('Expected numeric to be instance of tr.v.Histogram');
|
| -
|
| - Value.call(this, name, opt_options);
|
| - this.numeric = numeric;
|
| - }
|
| -
|
| - NumericValue.fromDict = function(d) {
|
| - if (d.numeric === undefined)
|
| - throw new Error('Expected numeric to be provided');
|
| - var numeric = tr.v.Histogram.fromDict(d.numeric);
|
| - var value = new NumericValue(d.name, numeric, d);
|
| - return value;
|
| - };
|
| -
|
| - NumericValue.prototype = {
|
| - __proto__: Value.prototype,
|
| -
|
| - merge: function(other) {
|
| - if (!(other instanceof NumericValue))
|
| - throw new Error('Merging non-NumericValues is not supported');
|
| -
|
| - var numeric = this.numeric.merge(other.numeric);
|
| - var result = new NumericValue(this.name, numeric);
|
| - // TODO(eakuefner): merge diagnostics?
|
| - return result;
|
| - },
|
| -
|
| - asDictInto_: function(d) {
|
| - d.type = 'numeric';
|
| - d.numeric = this.numeric.asDict();
|
| - }
|
| - };
|
| -
|
| - return {
|
| - Value: Value,
|
| - NumericValue: NumericValue,
|
| - };
|
| -});
|
| -</script>
|
|
|