Подтвердить что ты не робот

Какая разница между деактивацией и отключением точки останова в Chrome Dev Tools

Chrome (версия 23.0.1271.101). Я на OS X, если это даже имеет значение.

Почему у Chrome есть возможность отключить и/или отключить контрольные точки? Есть ли какое-то энергопотребление, о котором я не знаю?

Я заметил, что могу отключить некоторые точки останова, а затем деактивировать все. После их активации одни и те же отключенные отключены. Помимо этого, какая цель иметь два варианта?

enter image description here

4b9b3361

Ответ 1

Деактивация точек останова отключает функциональность точки останова. Отключить все точки останова является ярлыком для маркировки каждой точки останова как отключенной.

Разница становится более ясной, когда вы сравниваете "Включить все точки останова" и "Активировать точки останова".

Отдельные точки останова могут быть включены или отключены с помощью флажков рядом с каждой точкой останова.

enter image description here

Отключить все точки останова, отключает все точки останова, фактически отключая функциональность останова. Деактивация точек останова явно отключает функциональность точки останова. Таким образом, эти два параметра имеют одинаковый эффект.

Активировать точки останова позволяет использовать функциональность останова, сохраняя статус включения/отключения отдельных точек останова. Включить все точки останова позволяет каждой точке останова, но не включает функцию останова, если она была деактивирована.

Ответ 2

Это прототип точки останова из последних источников хрома. Как вы можете видеть, точка останова включена или отключена. Я не вижу никакого свойства, которое могло бы отражать точку останова, которая либо "отключена", либо "деактивирована". Может быть, это как-то связано с условиями. В противном случае я бы сказал, что это несогласованность сторонников.

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);
}
}