blob: 548d14d2eaa2332838d0e85d025e580968007d19 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright (c) 2013 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.
'use strict';
base.require('ui');
base.exportTo('tracing.analysis', function() {
/**
* Slice views allow customized visualization of specific slices, indexed by
* title. If not registered, the default slice viewing logic is used.
*
* @constructor
*/
var SliceView = ui.define('slice-view');
SliceView.prototype = {
__proto__: HTMLDivElement.prototype,
decorate: function() {
this.objectInstance_ = undefined;
},
get requiresTallView() {
return false;
},
set modelEvent(obj) {
this.slice = obj;
},
get modelEvent() {
return this.slice;
},
get slice() {
return this.slice_;
},
set slice(s) {
this.slice_ = s;
this.updateContents();
},
updateContents: function() {
throw new Error('Not implemented');
}
};
SliceView.titleToViewInfoMap = {};
SliceView.register = function(title, viewConstructor) {
if (SliceView.titleToViewInfoMap[title])
throw new Error('Handler already registerd for ' + title);
SliceView.titleToViewInfoMap[title] = {
constructor: viewConstructor
};
};
SliceView.unregister = function(title) {
if (SliceView.titleToViewInfoMap[title] === undefined)
throw new Error(title + ' not registered');
delete SliceView.titleToViewInfoMap[title];
};
SliceView.getViewInfo = function(title) {
return SliceView.titleToViewInfoMap[title];
};
return {
SliceView: SliceView
};
});
|