summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html')
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html
new file mode 100644
index 00000000000..08a8842b1f9
--- /dev/null
+++ b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html
@@ -0,0 +1,75 @@
+<!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/model/object_instance.html">
+
+<script>
+'use strict';
+
+/**
+ * @fileoverview BlameContext is the Trace Viewer side correspondence of
+ * Chrome's class base::trace_event::BlameContext. More specifically,
+ *
+ * BlameContextSnapshot, which inherits from ObjectSnapshot, is the base class
+ * of all snapshots of blame contexts traced in Chrome.
+ *
+ * BlameContextInstance, which inherits from ObjectInstance, gathers snapshots
+ * of the same blame context traced in Chrome.
+ *
+ * BlameContextSnapshot and BlameContextInstance should never be instantiated
+ * directly. Subclasses corresponding to different BlameContexts in Chrome
+ * should define their own BlameContextSnapshot and BlameContextInstance
+ * specializations for instantiation.
+ *
+ */
+tr.exportTo('tr.e.chrome', function() {
+ const ObjectSnapshot = tr.model.ObjectSnapshot;
+ const ObjectInstance = tr.model.ObjectInstance;
+
+ function BlameContextSnapshot() {
+ ObjectSnapshot.apply(this, arguments);
+ }
+
+ BlameContextSnapshot.prototype = {
+ __proto__: ObjectSnapshot.prototype,
+
+ /**
+ * Returns the parent in the context tree.
+ */
+ get parentContext() {
+ if (this.args.parent instanceof BlameContextSnapshot) {
+ return this.args.parent;
+ }
+ return undefined;
+ },
+
+ get userFriendlyName() {
+ return 'BlameContext';
+ }
+ };
+
+ function BlameContextInstance() {
+ ObjectInstance.apply(this, arguments);
+ }
+
+ BlameContextInstance.prototype = {
+ __proto__: ObjectInstance.prototype,
+
+ /**
+ * Returns the type of the blame context, to be overriden by subclasses.
+ */
+ get blameContextType() {
+ throw new Error('Not implemented');
+ }
+ };
+
+ return {
+ BlameContextSnapshot,
+ BlameContextInstance,
+ };
+});
+</script>