summaryrefslogtreecommitdiffstats
path: root/devtools/shared/specs/timeline.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/shared/specs/timeline.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/shared/specs/timeline.js')
-rw-r--r--devtools/shared/specs/timeline.js118
1 files changed, 118 insertions, 0 deletions
diff --git a/devtools/shared/specs/timeline.js b/devtools/shared/specs/timeline.js
new file mode 100644
index 000000000..653ebef49
--- /dev/null
+++ b/devtools/shared/specs/timeline.js
@@ -0,0 +1,118 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const {
+ Arg,
+ RetVal,
+ Option,
+ generateActorSpec,
+ types
+} = require("devtools/shared/protocol");
+
+/**
+ * Type representing an array of numbers as strings, serialized fast(er).
+ * http://jsperf.com/json-stringify-parse-vs-array-join-split/3
+ *
+ * XXX: It would be nice if on local connections (only), we could just *give*
+ * the array directly to the front, instead of going through all this
+ * serialization redundancy.
+ */
+types.addType("array-of-numbers-as-strings", {
+ write: (v) => v.join(","),
+ // In Gecko <= 37, `v` is an array; do not transform in this case.
+ read: (v) => typeof v === "string" ? v.split(",") : v
+});
+
+const timelineSpec = generateActorSpec({
+ typeName: "timeline",
+
+ events: {
+ /**
+ * Events emitted when "DOMContentLoaded" and "Load" markers are received.
+ */
+ "doc-loading": {
+ type: "doc-loading",
+ marker: Arg(0, "json"),
+ endTime: Arg(0, "number")
+ },
+
+ /**
+ * The "markers" events emitted every DEFAULT_TIMELINE_DATA_PULL_TIMEOUT ms
+ * at most, when profile markers are found. The timestamps on each marker
+ * are relative to when recording was started.
+ */
+ "markers": {
+ type: "markers",
+ markers: Arg(0, "json"),
+ endTime: Arg(1, "number")
+ },
+
+ /**
+ * The "memory" events emitted in tandem with "markers", if this was enabled
+ * when the recording started. The `delta` timestamp on this measurement is
+ * relative to when recording was started.
+ */
+ "memory": {
+ type: "memory",
+ delta: Arg(0, "number"),
+ measurement: Arg(1, "json")
+ },
+
+ /**
+ * The "ticks" events (from the refresh driver) emitted in tandem with
+ * "markers", if this was enabled when the recording started. All ticks
+ * are timestamps with a zero epoch.
+ */
+ "ticks": {
+ type: "ticks",
+ delta: Arg(0, "number"),
+ timestamps: Arg(1, "array-of-numbers-as-strings")
+ },
+
+ /**
+ * The "frames" events emitted in tandem with "markers", containing
+ * JS stack frames. The `delta` timestamp on this frames packet is
+ * relative to when recording was started.
+ */
+ "frames": {
+ type: "frames",
+ delta: Arg(0, "number"),
+ frames: Arg(1, "json")
+ }
+ },
+
+ methods: {
+ isRecording: {
+ request: {},
+ response: {
+ value: RetVal("boolean")
+ }
+ },
+
+ start: {
+ request: {
+ withMarkers: Option(0, "boolean"),
+ withTicks: Option(0, "boolean"),
+ withMemory: Option(0, "boolean"),
+ withFrames: Option(0, "boolean"),
+ withGCEvents: Option(0, "boolean"),
+ withDocLoadingEvents: Option(0, "boolean")
+ },
+ response: {
+ value: RetVal("number")
+ }
+ },
+
+ stop: {
+ response: {
+ // Set as possibly nullable due to the end time possibly being
+ // undefined during destruction
+ value: RetVal("nullable:number")
+ }
+ },
+ },
+});
+
+exports.timelineSpec = timelineSpec;