Bug 1466691 - Remove useless attachTrace method. r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 05 Jun 2018 01:13:17 -0700
changeset 805662 eefe6ee6e9e17ffc465d256c5193918c848c7fa3
parent 805661 6ee6d17d138c317e43d437d490e2a2eb3e8749fb
child 805663 27a3d726f9790fe494f0b7070b4f90e6c69b9dc1
child 805664 5da432c87f00edb91829035c6e1195ac60780fad
push id112733
push userbmo:poirot.alex@gmail.com
push dateFri, 08 Jun 2018 08:55:34 +0000
reviewersjryans
bugs1466691
milestone62.0a1
Bug 1466691 - Remove useless attachTrace method. r=jryans MozReview-Commit-ID: KHh57uwJnNI
devtools/shared/client/debugger-client.js
devtools/shared/client/moz.build
devtools/shared/client/trace-client.js
--- a/devtools/shared/client/debugger-client.js
+++ b/devtools/shared/client/debugger-client.js
@@ -21,17 +21,16 @@ loader.lazyRequireGetter(this, "Debugger
 loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 loader.lazyRequireGetter(this, "getDeviceFront", "devtools/shared/fronts/device", true);
 
 loader.lazyRequireGetter(this, "WebConsoleClient", "devtools/shared/webconsole/client", true);
 loader.lazyRequireGetter(this, "AddonClient", "devtools/shared/client/addon-client");
 loader.lazyRequireGetter(this, "RootClient", "devtools/shared/client/root-client");
 loader.lazyRequireGetter(this, "TabClient", "devtools/shared/client/tab-client");
 loader.lazyRequireGetter(this, "ThreadClient", "devtools/shared/client/thread-client");
-loader.lazyRequireGetter(this, "TraceClient", "devtools/shared/client/trace-client");
 loader.lazyRequireGetter(this, "WorkerClient", "devtools/shared/client/worker-client");
 loader.lazyRequireGetter(this, "ObjectClient", "devtools/shared/client/object-client");
 
 const noop = () => {};
 
 // Define the minimum officially supported version of Firefox when connecting to a remote
 // runtime. (Use ".0a1" to support the very first nightly version)
 // This is usually the current ESR version.
@@ -478,47 +477,16 @@ DebuggerClient.prototype = {
         this.registerClient(threadClient);
       }
       onResponse(response, threadClient);
       return [response, threadClient];
     });
   },
 
   /**
-   * Attach to a trace actor.
-   *
-   * @param string traceActor
-   *        The actor ID for the tracer to attach.
-   * @param function onResponse
-   *        Called with the response packet and a TraceClient
-   *        (which will be undefined on error).
-   */
-  attachTracer: function(traceActor, onResponse = noop) {
-    if (this._clients.has(traceActor)) {
-      const client = this._clients.get(traceActor);
-      DevToolsUtils.executeSoon(() => onResponse({}, client));
-      return promise.resolve([{}, client]);
-    }
-
-    const packet = {
-      to: traceActor,
-      type: "attach"
-    };
-    return this.request(packet).then(response => {
-      let traceClient;
-      if (!response.error) {
-        traceClient = new TraceClient(this, traceActor);
-        this.registerClient(traceClient);
-      }
-      onResponse(response, traceClient);
-      return [response, traceClient];
-    });
-  },
-
-  /**
    * Fetch the ChromeActor for the main process or ChildProcessActor for a
    * a given child process ID.
    *
    * @param number id
    *        The ID for the process to attach (returned by `listProcesses`).
    *        Connected to the main process if omitted, or is 0.
    */
   getProcess: function(id) {
--- a/devtools/shared/client/moz.build
+++ b/devtools/shared/client/moz.build
@@ -16,11 +16,10 @@ DevToolsModules(
     'long-string-client.js',
     'object-client.js',
     'property-iterator-client.js',
     'root-client.js',
     'source-client.js',
     'symbol-iterator-client.js',
     'tab-client.js',
     'thread-client.js',
-    'trace-client.js',
     'worker-client.js',
-)
\ No newline at end of file
+)
deleted file mode 100644
--- a/devtools/shared/client/trace-client.js
+++ /dev/null
@@ -1,112 +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, DebuggerClient} = require("devtools/shared/client/debugger-client");
-
-/**
- * Creates a tracing profiler client for the remote debugging protocol
- * server. This client is a front to the trace actor created on the
- * server side, hiding the protocol details in a traditional
- * JavaScript API.
- *
- * @param client DebuggerClient
- *        The debugger client parent.
- * @param actor string
- *        The actor ID for this thread.
- */
-function TraceClient(client, actor) {
-  this._client = client;
-  this._actor = actor;
-  this._activeTraces = new Set();
-  this._waitingPackets = new Map();
-  this._expectedPacket = 0;
-  this.request = this._client.request;
-  this.events = [];
-}
-
-TraceClient.prototype = {
-  get actor() {
-    return this._actor;
-  },
-  get tracing() {
-    return this._activeTraces.size > 0;
-  },
-
-  get _transport() {
-    return this._client._transport;
-  },
-
-  /**
-   * Detach from the trace actor.
-   */
-  detach: DebuggerClient.requester({
-    type: "detach"
-  }, {
-    after: function(response) {
-      this._client.unregisterClient(this);
-      return response;
-    },
-  }),
-
-  /**
-   * Start a new trace.
-   *
-   * @param trace [string]
-   *        An array of trace types to be recorded by the new trace.
-   *
-   * @param name string
-   *        The name of the new trace.
-   *
-   * @param onResponse function
-   *        Called with the request's response.
-   */
-  startTrace: DebuggerClient.requester({
-    type: "startTrace",
-    name: arg(1),
-    trace: arg(0)
-  }, {
-    after: function(response) {
-      if (response.error) {
-        return response;
-      }
-
-      if (!this.tracing) {
-        this._waitingPackets.clear();
-        this._expectedPacket = 0;
-      }
-      this._activeTraces.add(response.name);
-
-      return response;
-    },
-  }),
-
-  /**
-   * End a trace. If a name is provided, stop the named
-   * trace. Otherwise, stop the most recently started trace.
-   *
-   * @param name string
-   *        The name of the trace to stop.
-   *
-   * @param onResponse function
-   *        Called with the request's response.
-   */
-  stopTrace: DebuggerClient.requester({
-    type: "stopTrace",
-    name: arg(0)
-  }, {
-    after: function(response) {
-      if (response.error) {
-        return response;
-      }
-
-      this._activeTraces.delete(response.name);
-
-      return response;
-    },
-  })
-};
-
-module.exports = TraceClient;