1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 * @extends {WebInspector.Object}
9 WebInspector.Lock = function()
11 this._count = 0; // Reentrant.
17 WebInspector.Lock.Events = {
18 StateChanged: "StateChanged"
21 WebInspector.Lock.prototype = {
25 isAcquired: function()
32 if (++this._count === 1)
33 this.dispatchEventToListeners(WebInspector.Lock.Events.StateChanged);
39 if (this._count < 0) {
40 console.error("WebInspector.Lock acquire/release calls are unbalanced " + new Error().stack);
44 this.dispatchEventToListeners(WebInspector.Lock.Events.StateChanged);
47 __proto__: WebInspector.Object.prototype