Bug 895543 - part 1: cache SourceClient instances; r=robcee

This commit is contained in:
Nick Fitzgerald 2013-07-30 20:36:12 -07:00
parent e9069b15ab
commit 79e6109df6

View File

@ -1581,16 +1581,16 @@ ThreadClient.prototype = {
}, },
/** /**
* Invalidate pause-lifetime grip clients and clear the list of * Invalidate pause-lifetime grip clients and clear the list of current grip
* current grip clients. * clients.
*/ */
_clearPauseGrips: function TC_clearPauseGrips() { _clearPauseGrips: function TC_clearPauseGrips() {
this._clearGripClients("_pauseGrips"); this._clearGripClients("_pauseGrips");
}, },
/** /**
* Invalidate pause-lifetime grip clients and clear the list of * Invalidate thread-lifetime grip clients and clear the list of current grip
* current grip clients. * clients.
*/ */
_clearThreadGrips: function TC_clearPauseGrips() { _clearThreadGrips: function TC_clearPauseGrips() {
this._clearGripClients("_threadGrips"); this._clearGripClients("_threadGrips");
@ -1612,7 +1612,12 @@ ThreadClient.prototype = {
* Return an instance of SourceClient for the given source actor form. * Return an instance of SourceClient for the given source actor form.
*/ */
source: function TC_source(aForm) { source: function TC_source(aForm) {
return new SourceClient(this._client, aForm); if (aForm.actor in this._threadGrips) {
return this._threadGrips[aForm.actor];
}
return this._threadGrips[aForm.actor] = new SourceClient(this._client,
aForm);
} }
}; };