Commit 75d3c074 authored by apavlov@chromium.org's avatar apavlov@chromium.org

DevTools: [Console] Display timestamps when the Console timestamps setting is re-enabled

Drive-by: Do not subscribe each message to the timestamp display setting but rather the ConsoleMessageView

R=eustas, vsevik
BUG=357175
NOTRY=true

Review URL: https://codereview.chromium.org/214693005

git-svn-id: svn://svn.chromium.org/blink/trunk@170190 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent dcf5af89
......@@ -40,6 +40,9 @@ function test()
addMessageWithFixedTimestamp("<After>");
addMessageWithFixedTimestamp("<After>", baseTimestamp + 456);
WebInspector.settings.consoleTimestampsEnabled.set(false);
WebInspector.settings.consoleTimestampsEnabled.set(true);
InspectorTest.dumpConsoleMessages();
InspectorTest.completeTest();
}
......
......@@ -125,6 +125,7 @@ WebInspector.ConsoleView = function(hideContextSelector)
this.messagesElement.insertBefore(this._filterStatusMessageElement, this.topGroup.element);
this._updateFilterStatus();
WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._consoleTimestampsSettingChanged, this);
}
WebInspector.ConsoleView.prototype = {
......@@ -161,6 +162,14 @@ WebInspector.ConsoleView.prototype = {
},
_consoleTimestampsSettingChanged: function(event)
{
var enabled = /** @type {boolean} */ (event.data);
this._messageToViewMessage.values().forEach(function(viewMessage) {
viewMessage.updateTimestamp(enabled);
})
},
/**
* @return {!Element}
*/
......
......@@ -52,8 +52,6 @@ WebInspector.ConsoleViewMessage = function(target, consoleMessage, linkifier)
"node": this._formatParameterAsNode,
"string": this._formatParameterAsString
};
WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._consoleTimestampsSettingChanged, this);
}
WebInspector.ConsoleViewMessage.prototype = {
......@@ -871,7 +869,7 @@ WebInspector.ConsoleViewMessage.prototype = {
return regexObject.test(this._formattedMessageText()) || (!!this._anchorElement && regexObject.test(this._anchorElement.textContent));
},
_updateTimestamp: function(show)
updateTimestamp: function(show)
{
if (!this._element)
return;
......@@ -884,14 +882,10 @@ WebInspector.ConsoleViewMessage.prototype = {
return;
}
if (!show && this.timestampElement)
if (!show && this.timestampElement) {
this.timestampElement.remove();
},
_consoleTimestampsSettingChanged: function(event)
{
var enabled = /** @type {boolean} */ (event.data);
this._updateTimestamp(enabled);
delete this.timestampElement;
}
},
/**
......@@ -934,7 +928,7 @@ WebInspector.ConsoleViewMessage.prototype = {
if (this._repeatCount > 1)
this._showRepeatCountElement();
this._updateTimestamp(WebInspector.settings.consoleTimestampsEnabled.get());
this.updateTimestamp(WebInspector.settings.consoleTimestampsEnabled.get());
return element;
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment