16

Chrome(バージョン23.0.1271.101)。それでも問題があれば、私はOSXを使用しています。

Chromeにブレークポイントを無効にしたり無効にしたりする機能があるのはなぜですか?私が気付いていない電力使用はありますか?

一部のブレークポイントを無効にしてから、すべてを無効にできることに気づきましたそれらを再アクティブ化すると、同じ無効化されたものが無効化されます。それ以外に、2つのオプションを持つ目的は何ですか?

ここに画像の説明を入力してください

4

2 に答える 2

12

ブレークポイントを非アクティブ化すると、ブレークポイント機能がオフになります。すべてのブレークポイントを無効にするは、各ブレークポイントを無効としてマークするためのショートカットです。

[すべてのブレークポイントを有効にする]と[ブレークポイントをアクティブにする]を比較すると、違いがより明確になります。

個々のブレークポイントは、各ブレークポイントの横にあるチェックボックスを使用して有効または無効にできます。

ここに画像の説明を入力してください

[すべてのブレークポイントを無効にする]は、すべてのブレークポイントのチェックを外し、事実上、ブレークポイント機能をオフにします。ブレークポイントを非アクティブ化すると、ブレークポイント機能が明示的にオフになります。したがって、これら2つのオプションは同じ効果があります。

ブレークポイントをアクティブ化すると、ブレークポイント機能が有効になり、個々のブレークポイントの有効/無効ステータスが保持されます。[すべてのブレークポイントを有効にする]は各ブレークポイントを有効にしますが、無効になっている場合はブレークポイント機能自体をオンにしません。

于 2014-05-30T18:36:55.527 に答える
1

これは、最近のクロム源からのブレークポイントプロトタイプです。ご覧のとおり、ブレークポイントは有効または無効になっています。ブレークポイントが「無効」または「非アクティブ」になっていることを反映している可能性のあるプロパティは表示されません。多分それは条件と関係があります。そうでなければ、それはフロントエンドの不整合だと思います。

WebInspector.BreakpointManager.Breakpoint.prototype = {
/**
 * @return {WebInspector.UILocation}
 */
primaryUILocation: function()
{
    return this._primaryUILocation;
},

/**
 * @param {WebInspector.DebuggerModel.Location} location
 */
_addResolvedLocation: function(location)
{
    this._liveLocations.push(this._breakpointManager._debuggerModel.createLiveLocation(location, this._locationUpdated.bind(this, location)));
},

/**
 * @param {WebInspector.DebuggerModel.Location} location
 * @param {WebInspector.UILocation} uiLocation
 */
_locationUpdated: function(location, uiLocation)
{
    var stringifiedLocation = location.scriptId + ":" + location.lineNumber + ":" + location.columnNumber;
    var oldUILocation = /** @type {WebInspector.UILocation} */ (this._uiLocations[stringifiedLocation]);
    if (oldUILocation)
        this._breakpointManager._uiLocationRemoved(this, oldUILocation);
    if (this._uiLocations[""]) {
        delete this._uiLocations[""];
        this._breakpointManager._uiLocationRemoved(this, this._primaryUILocation);
    }
    this._uiLocations[stringifiedLocation] = uiLocation;
    this._breakpointManager._uiLocationAdded(this, uiLocation);
},

/**
 * @return {boolean}
 */
enabled: function()
{
    return this._enabled;
},

/**
 * @param {boolean} enabled
 */
setEnabled: function(enabled)
{
    this._updateBreakpoint(this._condition, enabled);
},

/**
 * @return {string}
 */
condition: function()
{
    return this._condition;
},

/**
 * @param {string} condition
 */
setCondition: function(condition)
{
    this._updateBreakpoint(condition, this._enabled);
},

/**
 * @param {string} condition
 * @param {boolean} enabled
 */
_updateBreakpoint: function(condition, enabled)
{
    if (this._enabled === enabled && this._condition === condition)
        return;

    if (this._enabled)
        this._removeFromDebugger();

    this._enabled = enabled;
    this._condition = condition;
    this._breakpointManager._storage._updateBreakpoint(this);

    var scriptFile = this._primaryUILocation.uiSourceCode.scriptFile();
    if (this._enabled && !(scriptFile && scriptFile.hasDivergedFromVM())) {
        this._setInDebugger();
        return;
    }

    this._fakeBreakpointAtPrimaryLocation();
},

/**
 * @param {boolean=} keepInStorage
 */
remove: function(keepInStorage)
{
    var removeFromStorage = !keepInStorage;
    this._resetLocations();
    this._removeFromDebugger();
    this._breakpointManager._removeBreakpoint(this, removeFromStorage);
},

_setInDebugger: function()
{
    var rawLocation = this._primaryUILocation.uiLocationToRawLocation();
    var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ (rawLocation);
    if (debuggerModelLocation)
        this._breakpointManager._debuggerModel.setBreakpointByScriptLocation(debuggerModelLocation, this._condition, didSetBreakpoint.bind(this));
    else
        this._breakpointManager._debuggerModel.setBreakpointByURL(this._primaryUILocation.uiSourceCode.url, this._primaryUILocation.lineNumber, 0, this._condition, didSetBreakpoint.bind(this));

    /**
     * @this {WebInspector.BreakpointManager.Breakpoint}
     * @param {?DebuggerAgent.BreakpointId} breakpointId
     * @param {Array.<WebInspector.DebuggerModel.Location>} locations
     */
    function didSetBreakpoint(breakpointId, locations)
    {
        if (!breakpointId) {
            this._resetLocations();
            this._breakpointManager._removeBreakpoint(this, false);
            return;
        }

        this._debuggerId = breakpointId;
        this._breakpointManager._breakpointForDebuggerId[breakpointId] = this;

        if (!locations.length) {
            this._fakeBreakpointAtPrimaryLocation();
            return;
        }

        this._resetLocations();
        for (var i = 0; i < locations.length; ++i) {
            var script = this._breakpointManager._debuggerModel.scriptForId(locations[i].scriptId);
            var uiLocation = script.rawLocationToUILocation(locations[i].lineNumber, locations[i].columnNumber);
            if (this._breakpointManager.findBreakpoint(uiLocation.uiSourceCode, uiLocation.lineNumber)) {
                // location clash
                this.remove();
                return;
            }
        }

        for (var i = 0; i < locations.length; ++i)
            this._addResolvedLocation(locations[i]);
    }
},

_removeFromDebugger: function()
{
    if (this._debuggerId) {
        this._breakpointManager._debuggerModel.removeBreakpoint(this._debuggerId);
        delete this._breakpointManager._breakpointForDebuggerId[this._debuggerId];
        delete this._debuggerId;
    }
},

_resetLocations: function()
{
    for (var stringifiedLocation in this._uiLocations)
        this._breakpointManager._uiLocationRemoved(this, this._uiLocations[stringifiedLocation]);

    for (var i = 0; i < this._liveLocations.length; ++i)
        this._liveLocations[i].dispose();
    this._liveLocations = [];

    this._uiLocations = {};
},

/**
 * @return {string}
 */
_breakpointStorageId: function()
{
    return this._sourceFileId + ":" + this._primaryUILocation.lineNumber;
},

_fakeBreakpointAtPrimaryLocation: function()
{
    this._resetLocations();
    this._uiLocations[""] = this._primaryUILocation;
    this._breakpointManager._uiLocationAdded(this, this._primaryUILocation);
}
}
于 2013-01-04T15:34:25.580 に答える