| Index: Source/devtools/front_end/common/Object.js
|
| diff --git a/Source/devtools/front_end/common/Object.js b/Source/devtools/front_end/common/Object.js
|
| index 8528e8e682b852437007a979140868e4137c69a4..2026873829793ebcbfdfd79ba8ef2ccaa858e9e1 100644
|
| --- a/Source/devtools/front_end/common/Object.js
|
| +++ b/Source/devtools/front_end/common/Object.js
|
| @@ -145,6 +145,51 @@
|
| }
|
|
|
| /**
|
| + * @constructor
|
| + * @extends {WebInspector.Object}
|
| + */
|
| +WebInspector.Lock = function()
|
| +{
|
| + this._count = 0; // Reentrant.
|
| +}
|
| +
|
| +/**
|
| + * @enum {string}
|
| + */
|
| +WebInspector.Lock.Events = {
|
| + StateChanged: "StateChanged"
|
| +}
|
| +
|
| +WebInspector.Lock.prototype = {
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + isAcquired: function()
|
| + {
|
| + return !!this._count;
|
| + },
|
| +
|
| + acquire: function()
|
| + {
|
| + if (++this._count === 1)
|
| + this.dispatchEventToListeners(WebInspector.Lock.Events.StateChanged);
|
| + },
|
| +
|
| + release: function()
|
| + {
|
| + --this._count;
|
| + if (this._count < 0) {
|
| + console.error("WebInspector.Lock acquire/release calls are unbalanced " + new Error().stack);
|
| + return;
|
| + }
|
| + if (!this._count)
|
| + this.dispatchEventToListeners(WebInspector.Lock.Events.StateChanged);
|
| + },
|
| +
|
| + __proto__: WebInspector.Object.prototype
|
| +}
|
| +
|
| +/**
|
| * @interface
|
| */
|
| WebInspector.EventTarget = function()
|
|
|