Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / tracing / analysis / slice_view.html
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
6 -->
7
8 <link rel="import" href="/tvcm/ui.html">
9
10 <script>
11 'use strict';
12
13 tvcm.exportTo('tracing.analysis', function() {
14   /**
15    * Slice views allow customized visualization of specific slices, indexed by
16    * title. If not registered, the default slice viewing logic is used.
17    *
18    * @constructor
19    */
20   var SliceView = tvcm.ui.define('slice-view');
21
22   SliceView.prototype = {
23     __proto__: HTMLDivElement.prototype,
24
25     decorate: function() {
26       this.objectInstance_ = undefined;
27     },
28
29     get requiresTallView() {
30       return false;
31     },
32
33     set modelEvent(obj) {
34       this.slice = obj;
35     },
36
37     get modelEvent() {
38       return this.slice;
39     },
40
41     get slice() {
42       return this.slice_;
43     },
44
45     set slice(s) {
46       this.slice_ = s;
47       this.updateContents();
48     },
49
50     updateContents: function() {
51       throw new Error('Not implemented');
52     }
53   };
54
55   SliceView.titleToViewInfoMap = {};
56   SliceView.register = function(title, viewConstructor) {
57     if (SliceView.titleToViewInfoMap[title])
58       throw new Error('Handler already registered for ' + title);
59     SliceView.titleToViewInfoMap[title] = {
60       constructor: viewConstructor
61     };
62   };
63
64   SliceView.unregister = function(title) {
65     if (SliceView.titleToViewInfoMap[title] === undefined)
66       throw new Error(title + ' not registered');
67     delete SliceView.titleToViewInfoMap[title];
68   };
69
70   SliceView.getViewInfo = function(title) {
71     return SliceView.titleToViewInfoMap[title];
72   };
73
74   return {
75     SliceView: SliceView
76   };
77 });
78 </script>