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/object_instance.html"> | |
| 9 | |
| 10 <script> | |
| 11 'use strict'; | |
| 12 | |
| 13 /** | |
| 14 * @fileoverview BlameContext is the Trace Viewer side correspondence of | |
| 15 * Chrome's class base::trace_event::BlameContext. More specifically, | |
| 16 * | |
| 17 * BlameContextSnapshot, which inherits from ObjectSnapshot, is the base class | |
| 18 * of all snapshots of blame contexts traced in Chrome. | |
| 19 * | |
| 20 * BlameContextInstance, which inherits from ObjectInstance, gathers snapshots | |
| 21 * of the same blame context traced in Chrome. | |
| 22 * | |
| 23 * BlameContextSnapshot and BlameContextInstance should never be instantiated | |
| 24 * directly. Subclasses corresponding to different BlameContexts in Chrome | |
| 25 * should define their own BlameContextSnapshot and BlameContextInstance | |
| 26 * specializations for instantiation. | |
| 27 * | |
| 28 */ | |
| 29 tr.exportTo('tr.e.chrome', function() { | |
| 30 var ObjectSnapshot = tr.model.ObjectSnapshot; | |
| 31 var ObjectInstance = tr.model.ObjectInstance; | |
| 32 | |
| 33 function BlameContextSnapshot() { | |
| 34 ObjectSnapshot.apply(this, arguments); | |
| 35 } | |
| 36 | |
| 37 BlameContextSnapshot.prototype = { | |
| 38 __proto__: ObjectSnapshot.prototype, | |
| 39 | |
| 40 preInitialize: function() { | |
|
benjhayden
2016/06/01 20:48:24
Why override these methods? The base class impleme
Xiaocheng
2016/06/02 06:54:55
This part follows the current render_frame.html an
benjhayden
2016/06/02 20:07:01
Ah, nope, that was my bad copy-pasta.
Xiaocheng
2016/06/03 05:38:38
Done.
| |
| 41 }, | |
| 42 | |
| 43 initialize: function() { | |
| 44 }, | |
| 45 | |
| 46 referencedAt: function(item, object, field) { | |
| 47 }, | |
| 48 | |
| 49 /** | |
| 50 * Returns the parent in the context tree. | |
| 51 */ | |
| 52 get parentContext() { | |
| 53 if (this.args.parent instanceof BlameContextSnapshot) | |
| 54 return this.args.parent; | |
|
benjhayden
2016/06/01 20:48:24
Would you mind explicitly return undefined if ther
Xiaocheng
2016/06/02 06:54:55
No. Done.
| |
| 55 }, | |
| 56 | |
| 57 get userFriendlyName() { | |
| 58 return 'BlameContext'; | |
| 59 } | |
| 60 }; | |
| 61 | |
| 62 function BlameContextInstance() { | |
| 63 ObjectInstance.apply(this, arguments); | |
| 64 } | |
| 65 | |
| 66 BlameContextInstance.prototype = { | |
| 67 __proto__: ObjectInstance.prototype, | |
| 68 | |
| 69 /** | |
| 70 * Returns the pid of the process where this blame context is traced. | |
| 71 */ | |
| 72 get pid() { | |
|
benjhayden
2016/06/01 20:48:24
Why is this necessary?
Xiaocheng
2016/06/02 06:54:55
Sorry, it's a question that I forgot to ask: is |t
benjhayden
2016/06/02 20:07:01
Yes, objectInstance.parent.pid is the right way, s
Xiaocheng
2016/06/03 05:38:38
Done.
| |
| 73 return this.parent.pid; | |
| 74 }, | |
| 75 | |
| 76 get isTracedByRenderer() { | |
| 77 throw new Error('Not implemented'); | |
| 78 }, | |
| 79 | |
| 80 /** | |
| 81 * Returns the type of the blame context, to be overriden by subclasses. | |
| 82 */ | |
| 83 get blameContextType() { | |
| 84 throw new Error('Not implemented'); | |
| 85 } | |
| 86 }; | |
| 87 | |
| 88 return { | |
| 89 BlameContextSnapshot: BlameContextSnapshot, | |
| 90 BlameContextInstance: BlameContextInstance | |
| 91 }; | |
| 92 }); | |
| 93 </script> | |
| OLD | NEW |