Bug 917983 - BreakpointActor instances should be saved in the threadLifetimePool; r=past
authorNick Fitzgerald <fitzgen@gmail.com>
Fri, 06 Dec 2013 09:25:58 -0800
changeset 174909 1fd3bf3cc55e1a1e936458084d7736998244928e
parent 174908 e7bcfaff073b6c210bc61f62b254a4ec6ba61d7f
child 174910 b86d25a3c04889e8ef3ce707af6323810cca46ba
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs917983
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 917983 - BreakpointActor instances should be saved in the threadLifetimePool; r=past
toolkit/devtools/server/actors/root.js
toolkit/devtools/server/actors/script.js
toolkit/devtools/server/actors/webbrowser.js
toolkit/devtools/server/tests/unit/testactors.js
--- a/toolkit/devtools/server/actors/root.js
+++ b/toolkit/devtools/server/actors/root.js
@@ -376,40 +376,16 @@ RootActor.prototype = {
     let e = Services.wm.getEnumerator(null);
     while (e.hasMoreElements()) {
       let win = e.getNext();
       let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
       windowUtils.resumeTimeouts();
       windowUtils.suppressEventHandling(false);
     }
-  },
-
-  /* ChromeDebuggerActor hooks. */
-
-  /**
-   * Add the specified actor to the default actor pool connection, in order to
-   * keep it alive as long as the server is. This is used by breakpoints in the
-   * thread and chrome debugger actors.
-   *
-   * @param actor aActor
-   *        The actor object.
-   */
-  addToParentPool: function(aActor) {
-    this.conn.addActor(aActor);
-  },
-
-  /**
-   * Remove the specified actor from the default actor pool.
-   *
-   * @param BreakpointActor aActor
-   *        The actor object.
-   */
-  removeFromParentPool: function(aActor) {
-    this.conn.removeActor(aActor);
   }
-}
+};
 
 RootActor.prototype.requestTypes = {
   "listTabs": RootActor.prototype.onListTabs,
   "listAddons": RootActor.prototype.onListAddons,
   "echo": RootActor.prototype.onEcho
 };
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -398,19 +398,17 @@ EventLoop.prototype = {
 /**
  * Creates a ThreadActor.
  *
  * ThreadActors manage a JSInspector object and manage execution/inspection
  * of debuggees.
  *
  * @param aHooks object
  *        An object with preNest and postNest methods for calling when entering
- *        and exiting a nested event loop, addToParentPool and
- *        removeFromParentPool methods for handling the lifetime of actors that
- *        will outlive the thread, like breakpoints.
+ *        and exiting a nested event loop.
  * @param aGlobal object [optional]
  *        An optional (for content debugging only) reference to the content
  *        window.
  */
 function ThreadActor(aHooks, aGlobal)
 {
   this._state = "detached";
   this._frameActors = [];
@@ -1363,17 +1361,17 @@ ThreadActor.prototype = {
     if (storedBp.actor) {
       actor = storedBp.actor;
     } else {
       storedBp.actor = actor = new BreakpointActor(this, {
         url: aLocation.url,
         line: aLocation.line,
         column: aLocation.column
       });
-      this._hooks.addToParentPool(actor);
+      this.threadLifetimePool.addActor(actor);
     }
 
     // Find all scripts matching the given location
     let scripts = this.dbg.findScripts(aLocation);
     if (scripts.length == 0) {
       return {
         error: "noScript",
         actor: actor.actorID
@@ -3563,17 +3561,17 @@ BreakpointActor.prototype = {
    * Handle a protocol request to remove this breakpoint.
    *
    * @param aRequest object
    *        The protocol request object.
    */
   onDelete: function (aRequest) {
     // Remove from the breakpoint store.
     this.threadActor.breakpointStore.removeBreakpoint(this.location);
-    this.threadActor._hooks.removeFromParentPool(this);
+    this.threadActor.threadLifetimePool.removeActor(this);
     // Remove the actual breakpoint from the associated scripts.
     this.removeScripts();
     return { from: this.actorID };
   }
 };
 
 BreakpointActor.prototype.requestTypes = {
   "delete": BreakpointActor.prototype.onDelete
@@ -3813,19 +3811,17 @@ Object.defineProperty(Debugger.Frame.pro
  *
  * @param aConnection object
  *        The DebuggerServerConnection with which this ChromeDebuggerActor
  *        is associated. (Currently unused, but required to make this
  *        constructor usable with addGlobalActor.)
  *
  * @param aHooks object
  *        An object with preNest and postNest methods for calling when entering
- *        and exiting a nested event loop and also addToParentPool and
- *        removeFromParentPool methods for handling the lifetime of actors that
- *        will outlive the thread, like breakpoints.
+ *        and exiting a nested event loop.
  */
 function ChromeDebuggerActor(aConnection, aHooks)
 {
   ThreadActor.call(this, aHooks);
 }
 
 ChromeDebuggerActor.prototype = Object.create(ThreadActor.prototype);
 
--- a/toolkit/devtools/server/actors/webbrowser.js
+++ b/toolkit/devtools/server/actors/webbrowser.js
@@ -498,38 +498,16 @@ BrowserTabActor.prototype = {
   _tabPool: null,
   get tabActorPool() { return this._tabPool; },
 
   _contextPool: null,
   get contextActorPool() { return this._contextPool; },
 
   _pendingNavigation: null,
 
-  /**
-   * Add the specified actor to the default actor pool connection, in order to
-   * keep it alive as long as the server is. This is used by breakpoints in the
-   * thread actor.
-   *
-   * @param actor aActor
-   *        The actor object.
-   */
-  addToParentPool: function BTA_addToParentPool(aActor) {
-    this.conn.addActor(aActor);
-  },
-
-  /**
-   * Remove the specified actor from the default actor pool.
-   *
-   * @param BreakpointActor aActor
-   *        The actor object.
-   */
-  removeFromParentPool: function BTA_removeFromParentPool(aActor) {
-    this.conn.removeActor(aActor);
-  },
-
   // A constant prefix that will be used to form the actor ID by the server.
   actorPrefix: "tab",
 
   /**
    * Getter for the tab title.
    * @return string
    *         Tab title.
    */
--- a/toolkit/devtools/server/tests/unit/testactors.js
+++ b/toolkit/devtools/server/tests/unit/testactors.js
@@ -100,24 +100,15 @@ TestTabActor.prototype = {
     if (!this._attached) {
       return { "error":"wrongState" };
     }
     return { type: "detached" };
   },
 
   /* Support for DebuggerServer.addTabActor. */
   _createExtraActors: CommonCreateExtraActors,
-  _appendExtraActors: CommonAppendExtraActors,
-
-  // Hooks for use by TestTabActors.
-  addToParentPool: function(aActor) {
-    this.conn.addActor(aActor);
-  },
-
-  removeFromParentPool: function(aActor) {
-    this.conn.removeActor(aActor);
-  }
+  _appendExtraActors: CommonAppendExtraActors
 };
 
 TestTabActor.prototype.requestTypes = {
   "attach": TestTabActor.prototype.onAttach,
   "detach": TestTabActor.prototype.onDetach
 };