Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 3 Copyright 2016 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="/tracing/model/event_set.html"> | |
| 9 <link rel="import" href="/tracing/model/object_instance.html"> | |
| 10 | |
| 11 <script> | |
| 12 'use strict'; | |
| 13 | |
| 14 /** | |
| 15 * @fileoverview BlameContext is the trace viewer side correspondence of | |
| 16 * Chrome's class base::trace_event::BlameContext. More specifically, | |
| 17 * | |
| 18 * BlameContextSnapshot, which inherits from ObjectSnapshot, is the base class | |
| 19 * fo all snapshots of blame contexts traced in Chrome. | |
|
Sami
2016/05/27 14:03:09
typo: of
Xiaocheng
2016/05/30 07:55:55
Done.
| |
| 20 * | |
| 21 * BlameContextInstance, which inherits from ObjectInstance, gathers snapshots | |
| 22 * of the same blame context traced in Chrome. | |
| 23 * | |
| 24 * BlameContextSnapshot and BlameContextInstance should never be instantiated | |
| 25 * directly. Subclasses of base::trace_event::BlameContext should define their | |
|
Sami
2016/05/27 14:03:09
nit: Remove base::trace_event:: since this is talk
Xiaocheng
2016/05/30 07:55:55
Sorry for my poor wording skills. The subject of t
Sami
2016/05/31 16:59:36
I'm still a bit confused: there are no BlameContex
Xiaocheng
2016/06/01 01:22:11
Yeah, it looks better.
| |
| 26 * own subclasses of BlameContextSnapshot and BlameContextInstance for | |
| 27 * instantiation. | |
| 28 * | |
| 29 */ | |
| 30 tr.exportTo('tr.e.chrome', function() { | |
| 31 var ObjectSnapshot = tr.model.ObjectSnapshot; | |
| 32 var ObjectInstance = tr.model.ObjectInstance; | |
| 33 | |
| 34 function BlameContextSnapshot() { | |
| 35 ObjectSnapshot.apply(this, arguments); | |
| 36 this.attributedEvents = new tr.model.EventSet(); | |
|
Sami
2016/05/27 14:03:09
I wonder what the performance/memory overhead of t
Xiaocheng
2016/05/30 07:55:55
Another idea is to move this part to Frame Data Si
Sami
2016/05/31 16:59:36
Right, having that work with a delay (as long as i
benjhayden
2016/05/31 17:37:12
attributedEvents looks very similar to some other
Sami
2016/05/31 18:15:10
In Trace Viewer we've faked it by splitting the wo
Xiaocheng
2016/06/01 01:22:11
If we don't open Frame Data Side Panel then none o
| |
| 37 } | |
| 38 | |
| 39 BlameContextSnapshot.prototype = { | |
| 40 __proto__: ObjectSnapshot.prototype, | |
| 41 | |
| 42 preInitialize: function() { | |
| 43 }, | |
| 44 | |
| 45 initialize: function() { | |
| 46 }, | |
| 47 | |
| 48 referencedAt: function(item, object, field) { | |
| 49 if (item instanceof tr.model.TimedEvent && | |
| 50 item.contexts.some(entry => object === entry) && | |
| 51 field === 'snapshot') | |
|
Sami
2016/05/27 14:03:09
nit: add braces
Xiaocheng
2016/05/30 07:55:55
Done.
| |
| 52 this.attributedEvents.push(item); | |
| 53 }, | |
| 54 | |
| 55 /** | |
| 56 * Returns the parent in the context tree. | |
| 57 */ | |
| 58 get parentContext() { | |
| 59 if (this.args.parent instanceof BlameContextSnapshot) | |
| 60 return this.args.parent; | |
| 61 }, | |
| 62 | |
| 63 get userFriendlyName() { | |
| 64 return 'BlameContext'; | |
| 65 } | |
| 66 }; | |
| 67 | |
| 68 function BlameContextInstance() { | |
| 69 ObjectInstance.apply(this, arguments); | |
| 70 } | |
| 71 | |
| 72 BlameContextInstance.prototype = { | |
| 73 __proto__: ObjectInstance.prototype, | |
| 74 | |
| 75 /** | |
| 76 * Returns the pid of the process where this blame context is traced. | |
| 77 */ | |
| 78 get pid() { | |
| 79 return this.parent.pid; | |
| 80 }, | |
| 81 | |
| 82 get isTracedByRenderer() { | |
| 83 throw new Error('Not implemented'); | |
| 84 }, | |
| 85 | |
| 86 /** | |
| 87 * Returns the type of the blame context, to be overriden by subclasses. | |
| 88 */ | |
| 89 get blameContextType() { | |
| 90 throw new Error('Not implemented'); | |
| 91 } | |
| 92 }; | |
| 93 | |
| 94 return { | |
| 95 BlameContextSnapshot: BlameContextSnapshot, | |
| 96 BlameContextInstance: BlameContextInstance | |
| 97 }; | |
| 98 }); | |
| 99 </script> | |
| OLD | NEW |