Diff
Modified: trunk/LayoutTests/ChangeLog (110412 => 110413)
--- trunk/LayoutTests/ChangeLog 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/LayoutTests/ChangeLog 2012-03-12 08:32:08 UTC (rev 110413)
@@ -1,3 +1,14 @@
+2012-03-11 Pavel Podivilov <[email protected]>
+
+ Web Inspector: decouple LiveLocation from RawSourceCode.
+ https://bugs.webkit.org/show_bug.cgi?id=80785
+
+ Reviewed by Vsevolod Vlasov.
+
+ * inspector/debugger/callstack-placards-discarded-expected.txt:
+ * inspector/debugger/callstack-placards-discarded.html:
+ * inspector/debugger/linkifier.html:
+
2012-03-11 Fumitoshi Ukai <[email protected]>
Unreviewed, update chromium test expectations.
Modified: trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt (110412 => 110413)
--- trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt 2012-03-12 08:32:08 UTC (rev 110413)
@@ -7,13 +7,11 @@
Set timer for test function.
Received DebuggerPaused event.
Function name: testFunction
-Listeners length: 2
Script execution paused.
Script execution resumed.
Set timer for test function.
Received DebuggerPaused event.
Function name: testFunction
-Listeners length: 2
Script execution paused.
Script execution resumed.
Debugger was disabled.
Modified: trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html (110412 => 110413)
--- trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html 2012-03-12 08:32:08 UTC (rev 110413)
@@ -15,18 +15,16 @@
function testCallStackPlacardsDiscarded(next)
{
WebInspector.debuggerPresentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, didPause, this);
- var previousListenerLength = undefined;
+ var previousCount = undefined;
function didPause(event)
{
InspectorTest.addResult("Received DebuggerPaused event.");
var callFrame = event.data.callFrames[0];
InspectorTest.addResult("Function name: " + callFrame._callFrame.functionName);
- var rawSourceCode = WebInspector.debuggerPresentationModel._scriptMapping._rawSourceCodeForScriptId[callFrame._callFrame.location.scriptId];
- var listeners = rawSourceCode._listeners[WebInspector.RawSourceCode.Events.UISourceCodeListChanged];
- InspectorTest.addResult("Listeners length: " + listeners.length);
- if (previousListenerLength !== undefined && listeners.length !== previousListenerLength)
- InspectorTest.addResult("FAILED: RawSourceCode listeners count has changed!");
- previousListenerLength = listeners.length;
+ var count = liveLocationsCount();
+ if (previousCount !== undefined && count !== previousCount)
+ InspectorTest.addResult("FAILED: Live locations count has changed!");
+ previousCount = count;
}
InspectorTest.showScriptSource("callstack-placards-discarded.html", didShowScriptSource);
@@ -53,6 +51,15 @@
}
},
]);
+
+ function liveLocationsCount()
+ {
+ var locations = WebInspector.debuggerPresentationModel._scriptMapping._liveLocationsForScriptId;
+ var count = 0;
+ for (id in locations)
+ count += locations[id].length;
+ return count;
+ }
}
</script>
Modified: trunk/LayoutTests/inspector/debugger/linkifier.html (110412 => 110413)
--- trunk/LayoutTests/inspector/debugger/linkifier.html 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/LayoutTests/inspector/debugger/linkifier.html 2012-03-12 08:32:08 UTC (rev 110413)
@@ -10,7 +10,6 @@
var linkifier;
var link;
- var rawSourceCode;
function waitForScripts()
{
@@ -34,11 +33,10 @@
function debuggerTest()
{
linkifier = WebInspector.debuggerPresentationModel.createLinkifier();
- rawSourceCode = WebInspector.debuggerPresentationModel._scriptMapping._rawSourceCodeForURL[WebInspector.inspectedPageURL];
- var count1 = listenersCount(rawSourceCode);
+ var count1 = liveLocationsCount();
link = linkifier.linkifyLocation(WebInspector.inspectedPageURL, 20, 0, "dummy-class");
- var count2 = listenersCount(rawSourceCode);
+ var count2 = liveLocationsCount();
InspectorTest.addResult("listeners added on raw source code: " + (count2 - count1));
InspectorTest.addResult("original location: " + link.textContent);
@@ -58,23 +56,21 @@
{
InspectorTest.addResult("reverted location: " + link.textContent);
- var count1 = listenersCount(rawSourceCode);
+ var count1 = liveLocationsCount();
linkifier.reset();
- var count2 = listenersCount(rawSourceCode);
+ var count2 = liveLocationsCount();
InspectorTest.addResult("listeners removed from raw source code: " + (count1 - count2));
InspectorTest.completeDebuggerTest();
}
- function listenersCount(object)
+ function liveLocationsCount()
{
- var listeners = object._listeners;
+ var locations = WebInspector.debuggerPresentationModel._scriptMapping._liveLocationsForScriptId;
var count = 0;
- for (var eventTypes in listeners) {
- var listenersArray = listeners[eventTypes];
- count += listenersArray.length;
- }
+ for (id in locations)
+ count += locations[id].length;
return count;
}
}
Modified: trunk/Source/WebCore/ChangeLog (110412 => 110413)
--- trunk/Source/WebCore/ChangeLog 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/Source/WebCore/ChangeLog 2012-03-12 08:32:08 UTC (rev 110413)
@@ -1,3 +1,30 @@
+2012-03-11 Pavel Podivilov <[email protected]>
+
+ Web Inspector: decouple LiveLocation from RawSourceCode.
+ https://bugs.webkit.org/show_bug.cgi?id=80785
+
+ Reviewed by Vsevolod Vlasov.
+
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.DebuggerPresentationModel.prototype.createPlacard):
+ (WebInspector.DebuggerPresentationModel.prototype._debuggerPaused):
+ (WebInspector.PresentationCallFrame):
+ (WebInspector.PresentationCallFrame.prototype.uiLocation):
+ (WebInspector.DebuggerPresentationModel.CallFramePlacard):
+ * inspector/front-end/RawSourceCode.js:
+ * inspector/front-end/ScriptMapping.js:
+ (WebInspector.MainScriptMapping):
+ (WebInspector.MainScriptMapping.prototype.createLiveLocation):
+ (WebInspector.MainScriptMapping.prototype._registerLiveLocation):
+ (WebInspector.MainScriptMapping.prototype._unregisterLiveLocation):
+ (WebInspector.MainScriptMapping.prototype._updateLiveLocations):
+ (WebInspector.MainScriptMapping.prototype._uiSourceCodeListChanged):
+ (WebInspector.MainScriptMapping.prototype.reset):
+ (WebInspector.LiveLocation):
+ (WebInspector.LiveLocation.prototype.init):
+ (WebInspector.LiveLocation.prototype.dispose):
+ (WebInspector.LiveLocation.prototype._update):
+
2012-03-11 Victor Carbune <[email protected]>
The main code structure for placing future text track cue rendering
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (110412 => 110413)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2012-03-12 08:32:08 UTC (rev 110413)
@@ -88,7 +88,7 @@
*/
createPlacard: function(callFrame)
{
- return new WebInspector.DebuggerPresentationModel.CallFramePlacard(callFrame, this._scriptMapping);
+ return new WebInspector.DebuggerPresentationModel.CallFramePlacard(callFrame, this);
},
/**
@@ -114,7 +114,7 @@
/**
* @param {DebuggerAgent.Location} rawLocation
* @param {function(WebInspector.UILocation)} updateDelegate
- * @return {WebInspector.RawSourceCode.LiveLocation}
+ * @return {WebInspector.LiveLocation}
*/
createLiveLocation: function(rawLocation, updateDelegate)
{
@@ -482,7 +482,7 @@
for (var i = 0; i < callFrames.length; ++i) {
var callFrame = callFrames[i];
if (WebInspector.debuggerModel.scriptForSourceID(callFrame.location.scriptId))
- this._presentationCallFrames.push(new WebInspector.PresentationCallFrame(callFrame, i, this._scriptMapping));
+ this._presentationCallFrames.push(new WebInspector.PresentationCallFrame(callFrame, i, this));
}
var details = WebInspector.debuggerModel.debuggerPausedDetails;
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, { callFrames: this._presentationCallFrames, details: details });
@@ -630,13 +630,13 @@
* @constructor
* @param {DebuggerAgent.CallFrame} callFrame
* @param {number} index
- * @param {WebInspector.MainScriptMapping} scriptMapping
+ * @param {WebInspector.DebuggerPresentationModel} model
*/
-WebInspector.PresentationCallFrame = function(callFrame, index, scriptMapping)
+WebInspector.PresentationCallFrame = function(callFrame, index, model)
{
this._callFrame = callFrame;
this._index = index;
- this._scriptMapping = scriptMapping;
+ this._model = model;
}
WebInspector.PresentationCallFrame.prototype = {
@@ -709,7 +709,7 @@
callback(uiLocation);
liveLocation.dispose();
}
- var liveLocation = this._scriptMapping.createLiveLocation(this._callFrame.location, locationUpdated.bind(this));
+ var liveLocation = this._model.createLiveLocation(this._callFrame.location, locationUpdated.bind(this));
liveLocation.init();
}
}
@@ -718,12 +718,12 @@
* @constructor
* @extends {WebInspector.Placard}
* @param {WebInspector.PresentationCallFrame} callFrame
- * @param {WebInspector.MainScriptMapping} scriptMapping
+ * @param {WebInspector.DebuggerPresentationModel} model
*/
-WebInspector.DebuggerPresentationModel.CallFramePlacard = function(callFrame, scriptMapping)
+WebInspector.DebuggerPresentationModel.CallFramePlacard = function(callFrame, model)
{
WebInspector.Placard.call(this, callFrame._callFrame.functionName || WebInspector.UIString("(anonymous function)"), "");
- this._liveLocation = scriptMapping.createLiveLocation(callFrame._callFrame.location, this._update.bind(this));
+ this._liveLocation = model.createLiveLocation(callFrame._callFrame.location, this._update.bind(this));
this._liveLocation.init();
}
Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (110412 => 110413)
--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2012-03-12 08:32:08 UTC (rev 110413)
@@ -108,11 +108,6 @@
return [];
},
- createLiveLocation: function(rawLocation, updateDelegate)
- {
- return new WebInspector.RawSourceCode.LiveLocation(this, rawLocation, updateDelegate);
- },
-
/**
* @param {boolean} formatted
*/
@@ -284,39 +279,6 @@
WebInspector.RawSourceCode.prototype.__proto__ = WebInspector.Object.prototype;
/**
- * @constructor
- * @param {WebInspector.RawSourceCode} rawSourceCode
- * @param {DebuggerAgent.Location} rawLocation
- * @param {function(WebInspector.UILocation)} updateDelegate
- */
-WebInspector.RawSourceCode.LiveLocation = function(rawSourceCode, rawLocation, updateDelegate)
-{
- this._rawSourceCode = rawSourceCode;
- this._rawLocation = rawLocation;
- this._updateDelegate = updateDelegate;
-}
-
-WebInspector.RawSourceCode.LiveLocation.prototype = {
- init: function()
- {
- this._rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.UISourceCodeListChanged, this._update, this);
- this._update();
- },
-
- dispose: function()
- {
- this._rawSourceCode.removeEventListener(WebInspector.RawSourceCode.Events.UISourceCodeListChanged, this._update, this);
- },
-
- _update: function()
- {
- var uiLocation = this._rawSourceCode.rawLocationToUILocation(this._rawLocation);
- if (uiLocation)
- this._updateDelegate(uiLocation);
- }
-}
-
-/**
* @interface
*/
WebInspector.RawSourceCode.SourceMapping = function()
Modified: trunk/Source/WebCore/inspector/front-end/ScriptMapping.js (110412 => 110413)
--- trunk/Source/WebCore/inspector/front-end/ScriptMapping.js 2012-03-12 07:14:20 UTC (rev 110412)
+++ trunk/Source/WebCore/inspector/front-end/ScriptMapping.js 2012-03-12 08:32:08 UTC (rev 110413)
@@ -56,13 +56,6 @@
uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) {},
/**
- * @param {DebuggerAgent.Location} rawLocation
- * @param {function(WebInspector.UILocation)} updateDelegate
- * @return {WebInspector.RawSourceCode.LiveLocation}
- */
- createLiveLocation: function(rawLocation, updateDelegate) {},
-
- /**
* @return {Array.<WebInspector.UISourceCode>}
*/
uiSourceCodeList: function() {}
@@ -83,6 +76,7 @@
this._rawSourceCodeForUISourceCode = new Map();
this._formatter = new WebInspector.ScriptFormatter();
this._formatSource = false;
+ this._liveLocationsForScriptId = {};
}
WebInspector.MainScriptMapping.Events = {
@@ -115,14 +109,33 @@
/**
* @param {DebuggerAgent.Location} rawLocation
* @param {function(WebInspector.UILocation)} updateDelegate
- * @return {WebInspector.RawSourceCode.LiveLocation}
+ * @return {WebInspector.LiveLocation}
*/
createLiveLocation: function(rawLocation, updateDelegate)
{
- var rawSourceCode = this._rawSourceCodeForScriptId[rawLocation.scriptId];
- return new WebInspector.RawSourceCode.LiveLocation(rawSourceCode, rawLocation, updateDelegate);
+ return new WebInspector.LiveLocation(this, rawLocation, updateDelegate);
},
+ _registerLiveLocation: function(scriptId, liveLocation)
+ {
+ this._liveLocationsForScriptId[scriptId].push(liveLocation)
+ liveLocation._update();
+ },
+
+ _unregisterLiveLocation: function(scriptId, liveLocation)
+ {
+ this._liveLocationsForScriptId[scriptId].remove(liveLocation);
+ },
+
+ _updateLiveLocations: function(scriptIds)
+ {
+ for (var i = 0; i < scriptIds.length; ++i) {
+ var liveLocations = this._liveLocationsForScriptId[scriptIds[i]];
+ for (var j = 0; j < liveLocations.length; ++j)
+ liveLocations[j]._update();
+ }
+ },
+
/**
* @return {Array.<WebInspector.UISourceCode>}
*/
@@ -142,6 +155,8 @@
*/
addScript: function(script)
{
+ this._liveLocationsForScriptId[script.scriptId] = [];
+
var resource = null;
var isInlineScript = false;
if (script.isInlineScript()) {
@@ -195,6 +210,11 @@
for (var i = 0; i < addedItems.length; ++i)
this._rawSourceCodeForUISourceCode.put(addedItems[i], rawSourceCode);
this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, { removedItems: removedItems, addedItems: addedItems });
+
+ var scriptIds = [];
+ for (var i = 0; i < rawSourceCode._scripts.length; ++i)
+ scriptIds.push(rawSourceCode._scripts[i].scriptId);
+ this._updateLiveLocations(scriptIds);
},
/**
@@ -241,7 +261,40 @@
this._rawSourceCodeForURL = {};
this._rawSourceCodeForDocumentURL = {};
this._rawSourceCodeForUISourceCode.clear();
+ this._liveLocationsForScriptId = {};
}
}
WebInspector.MainScriptMapping.prototype.__proto__ = WebInspector.Object.prototype;
+
+/**
+ * @constructor
+ * @param {WebInspector.MainScriptMapping} scriptMapping
+ * @param {DebuggerAgent.Location} rawLocation
+ * @param {function(WebInspector.UILocation)} updateDelegate
+ */
+WebInspector.LiveLocation = function(scriptMapping, rawLocation, updateDelegate)
+{
+ this._scriptMapping = scriptMapping;
+ this._rawLocation = rawLocation;
+ this._updateDelegate = updateDelegate;
+}
+
+WebInspector.LiveLocation.prototype = {
+ init: function()
+ {
+ this._scriptMapping._registerLiveLocation(this._rawLocation.scriptId, this);
+ },
+
+ dispose: function()
+ {
+ this._scriptMapping._unregisterLiveLocation(this._rawLocation.scriptId, this);
+ },
+
+ _update: function()
+ {
+ var uiLocation = this._scriptMapping.rawLocationToUILocation(this._rawLocation);
+ if (uiLocation)
+ this._updateDelegate(uiLocation);
+ }
+}