summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/tracing/tracing/value/diagnostics/generic.html
blob: 7ac19796e348e078d8eede87b6575af348c37a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<!--
Copyright 2016 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/value/diagnostics/diagnostic.html">

<script>
'use strict';

tr.exportTo('tr.v.d', function() {
  /**
   * A Generic diagnostic can contain any Plain-Ol'-Data objects that can be
   * serialized using JSON.stringify(): null, boolean, number, string, array,
   * dict. Generic diagnostics cannot contain tr.v.Value objects!
   *
   * @constructor
   * @param {*} value
   */
  function Generic(value) {
    this.value = value;
  }

  Generic.prototype = {
    __proto__: tr.v.d.Diagnostic.prototype,

    asDictInto_: function(d) {
      d.value = this.value;
    }
  };

  Generic.fromDict = function(d) {
    return new Generic(d.value);
  };

  tr.v.d.Diagnostic.register(Generic, {
    elementName: 'tr-v-ui-generic-diagnostic-span'
  });

  return {
    Generic: Generic
  };
});
</script>