Bug 1449610 - Remove event loop lag in DevTools. r=ochameau
Bug 962511 added event loop lag info in DevTools for use via a "jank watcher"
tool on Firefox OS devices.
With the removal of Firefox OS, this is now dead code that can be removed.
MozReview-Commit-ID: IHRozqCviuQ
deleted file mode 100644
--- a/devtools/server/actors/eventlooplag.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* 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";
-
-/**
- * The eventLoopLag actor emits "event-loop-lag" events when the event
- * loop gets unresponsive. The event comes with a "time" property (the
- * duration of the lag in milliseconds).
- */
-
-const {Ci} = require("chrome");
-const Services = require("Services");
-const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
-const {Actor, ActorClassWithSpec} = require("devtools/shared/protocol");
-const {eventLoopLagSpec} = require("devtools/shared/specs/eventlooplag");
-
-exports.EventLoopLagActor = ActorClassWithSpec(eventLoopLagSpec, {
- _observerAdded: false,
-
- /**
- * Start tracking the event loop lags.
- */
- start: function() {
- if (!this._observerAdded) {
- Services.obs.addObserver(this, "event-loop-lag");
- this._observerAdded = true;
- }
- return Services.appShell.startEventLoopLagTracking();
- },
-
- /**
- * Stop tracking the event loop lags.
- */
- stop: function() {
- if (this._observerAdded) {
- Services.obs.removeObserver(this, "event-loop-lag");
- this._observerAdded = false;
- }
- Services.appShell.stopEventLoopLagTracking();
- },
-
- destroy: function() {
- this.stop();
- Actor.prototype.destroy.call(this);
- },
-
- // nsIObserver
-
- observe: function(subject, topic, data) {
- if (topic == "event-loop-lag") {
- // Forward event loop lag event
- this.emit("event-loop-lag", data);
- }
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-});
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -29,17 +29,16 @@ DevToolsModules(
'common.js',
'content.js',
'css-properties.js',
'csscoverage.js',
'device.js',
'emulation.js',
'environment.js',
'errordocs.js',
- 'eventlooplag.js',
'frame.js',
'framerate.js',
'gcli.js',
'heap-snapshot-file.js',
'highlighters.css',
'highlighters.js',
'layout.js',
'memory.js',
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -490,21 +490,16 @@ var DebuggerServer = {
constructor: "MemoryActor",
type: { tab: true }
});
this.registerModule("devtools/server/actors/framerate", {
prefix: "framerate",
constructor: "FramerateActor",
type: { tab: true }
});
- this.registerModule("devtools/server/actors/eventlooplag", {
- prefix: "eventLoopLag",
- constructor: "EventLoopLagActor",
- type: { tab: true }
- });
this.registerModule("devtools/server/actors/reflow", {
prefix: "reflow",
constructor: "ReflowActor",
type: { tab: true }
});
this.registerModule("devtools/server/actors/css-properties", {
prefix: "cssProperties",
constructor: "CssPropertiesActor",
deleted file mode 100644
--- a/devtools/server/tests/unit/test_eventlooplag_actor.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test the eventLoopLag actor.
- */
-
-"use strict";
-
-function run_test() {
- let {EventLoopLagFront} = require("devtools/shared/fronts/eventlooplag");
-
- DebuggerServer.init();
- DebuggerServer.registerAllActors();
-
- // As seen in EventTracer.cpp
- let threshold = 20;
- let interval = 10;
-
- let front;
- let client = new DebuggerClient(DebuggerServer.connectPipe());
-
- // Start tracking event loop lags.
- client.connect().then(function() {
- client.listTabs().then(function(resp) {
- front = new EventLoopLagFront(client, resp);
- front.start().then(success => {
- Assert.ok(success);
- front.once("event-loop-lag", gotLagEvent);
- executeSoon(lag);
- });
- });
- });
-
- // Force a lag
- function lag() {
- let start = new Date();
- let duration = threshold + interval + 1;
- while (true) {
- if (((new Date()) - start) > duration) {
- break;
- }
- }
- }
-
- // Got a lag event. The test will time out if the actor
- // fails to detect the lag.
- function gotLagEvent(time) {
- info("lag: " + time);
- Assert.ok(time >= threshold);
- front.stop().then(() => {
- finishClient(client);
- });
- }
-
- do_test_pending();
-}
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -127,19 +127,16 @@ skip-if = coverage # bug 1336670
skip-if = true
reason = bug 1104838
[test_breakpoint-20.js]
[test_breakpoint-21.js]
[test_breakpoint-22.js]
[test_conditional_breakpoint-01.js]
[test_conditional_breakpoint-02.js]
[test_conditional_breakpoint-03.js]
-[test_eventlooplag_actor.js]
-skip-if = true
-reason = only ran on B2G
[test_listsources-01.js]
[test_listsources-02.js]
[test_listsources-03.js]
[test_listsources-04.js]
[test_new_source-01.js]
[test_new_source-02.js]
[test_sourcemaps-01.js]
[test_sourcemaps-02.js]
deleted file mode 100644
--- a/devtools/shared/fronts/eventlooplag.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/* 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 { Front, FrontClassWithSpec } = require("devtools/shared/protocol");
-const { eventLoopLagSpec } = require("devtools/shared/specs/eventlooplag");
-
-exports.EventLoopLagFront = FrontClassWithSpec(eventLoopLagSpec, {
- initialize: function(client, form) {
- Front.prototype.initialize.call(this, client);
- this.actorID = form.eventLoopLagActor;
- this.manage(this);
- },
-});
--- a/devtools/shared/fronts/moz.build
+++ b/devtools/shared/fronts/moz.build
@@ -10,17 +10,16 @@ DevToolsModules(
'addons.js',
'animation.js',
'call-watcher.js',
'canvas.js',
'css-properties.js',
'csscoverage.js',
'device.js',
'emulation.js',
- 'eventlooplag.js',
'framerate.js',
'gcli.js',
'highlighters.js',
'inspector.js',
'layout.js',
'memory.js',
'node.js',
'perf.js',
deleted file mode 100644
--- a/devtools/shared/specs/eventlooplag.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 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, generateActorSpec } = require("devtools/shared/protocol");
-
-const eventLoopLagSpec = generateActorSpec({
- typeName: "eventLoopLag",
-
- events: {
- "event-loop-lag": {
- type: "event-loop-lag",
- // duration of the lag in milliseconds.
- time: Arg(0, "number")
- }
- },
-
- methods: {
- start: {
- request: {},
- response: {success: RetVal("number")}
- },
- stop: {
- request: {},
- response: {}
- }
- }
-});
-
-exports.eventLoopLagSpec = eventLoopLagSpec;
--- a/devtools/shared/specs/index.js
+++ b/devtools/shared/specs/index.js
@@ -69,21 +69,16 @@ const Types = exports.__TypesForTests =
front: "devtools/shared/fronts/emulation",
},
/* environment has old fashion client and no front */
{
types: ["environment"],
spec: "devtools/shared/specs/environment",
front: null,
},
- {
- types: ["eventLoopLag"],
- spec: "devtools/shared/specs/eventlooplag",
- front: "devtools/shared/fronts/eventlooplag",
- },
/* frame has old fashion client and no front */
{
types: ["frame"],
spec: "devtools/shared/specs/frame",
front: null,
},
{
types: ["framerate"],
--- a/devtools/shared/specs/moz.build
+++ b/devtools/shared/specs/moz.build
@@ -12,17 +12,16 @@ DevToolsModules(
'breakpoint.js',
'call-watcher.js',
'canvas.js',
'css-properties.js',
'csscoverage.js',
'device.js',
'emulation.js',
'environment.js',
- 'eventlooplag.js',
'frame.js',
'framerate.js',
'gcli.js',
'heap-snapshot-file.js',
'highlighters.js',
'index.js',
'inspector.js',
'layout.js',