Title: [123761] trunk/Source/WebCore
Revision
123761
Author
vse...@chromium.org
Date
2012-07-26 09:42:27 -0700 (Thu, 26 Jul 2012)

Log Message

Web Inspector: Introduce generic LiveLocation, make Script.Location inherit it.
https://bugs.webkit.org/show_bug.cgi?id=92388

Reviewed by Pavel Feldman.

Introduced abstract LiveLocation implemented by Script.Location.

* inspector/front-end/Script.js:
(WebInspector.Script.Location):
(WebInspector.Script.Location.prototype.uiLocation):
(WebInspector.Script.Location.prototype.dispose):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode):
(WebInspector.LiveLocation):
(WebInspector.LiveLocation.prototype.update):
(WebInspector.LiveLocation.prototype.rawLocation):
(WebInspector.LiveLocation.prototype.uiLocation):
(WebInspector.LiveLocation.prototype.dispose):
* inspector/front-end/inspector.html:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123760 => 123761)


--- trunk/Source/WebCore/ChangeLog	2012-07-26 16:40:49 UTC (rev 123760)
+++ trunk/Source/WebCore/ChangeLog	2012-07-26 16:42:27 UTC (rev 123761)
@@ -1,3 +1,25 @@
+2012-07-26  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: Introduce generic LiveLocation, make Script.Location inherit it.
+        https://bugs.webkit.org/show_bug.cgi?id=92388
+
+        Reviewed by Pavel Feldman.
+
+        Introduced abstract LiveLocation implemented by Script.Location.
+
+        * inspector/front-end/Script.js:
+        (WebInspector.Script.Location):
+        (WebInspector.Script.Location.prototype.uiLocation):
+        (WebInspector.Script.Location.prototype.dispose):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode):
+        (WebInspector.LiveLocation):
+        (WebInspector.LiveLocation.prototype.update):
+        (WebInspector.LiveLocation.prototype.rawLocation):
+        (WebInspector.LiveLocation.prototype.uiLocation):
+        (WebInspector.LiveLocation.prototype.dispose):
+        * inspector/front-end/inspector.html:
+
 2012-07-26  Joshua Netterfield  <jnetterfi...@rim.com>
 
         [BlackBerry] readPixels on FBOs are limited to canvas size on SGX platforms

Modified: trunk/Source/WebCore/inspector/front-end/Script.js (123760 => 123761)


--- trunk/Source/WebCore/inspector/front-end/Script.js	2012-07-26 16:40:49 UTC (rev 123760)
+++ trunk/Source/WebCore/inspector/front-end/Script.js	2012-07-26 16:42:27 UTC (rev 123761)
@@ -205,39 +205,31 @@
 
 /**
  * @constructor
+ * @extends {WebInspector.LiveLocation}
  * @param {WebInspector.Script} script
  * @param {WebInspector.DebuggerModel.Location} rawLocation
  * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
  */
 WebInspector.Script.Location = function(script, rawLocation, updateDelegate)
 {
+    WebInspector.LiveLocation.call(this, rawLocation, updateDelegate);
     this._script = script;
-    this._rawLocation = rawLocation;
-    this._updateDelegate = updateDelegate;
-    this._uiSourceCodes = [];
 }
 
 WebInspector.Script.Location.prototype = {
-    update: function()
+    /**
+     * @return {WebInspector.UILocation}
+     */
+    uiLocation: function()
     {
-        var uiLocation = this._script.rawLocationToUILocation(this._rawLocation.lineNumber, this._rawLocation.columnNumber);
-        if (uiLocation) {
-            var uiSourceCode = uiLocation.uiSourceCode;
-            if (this._uiSourceCodes.indexOf(uiSourceCode) === -1) {
-                uiSourceCode.addLiveLocation(this);
-                this._uiSourceCodes.push(uiSourceCode);
-            }
-            var _oneTime_ = this._updateDelegate(uiLocation);
-            if (oneTime)
-                this.dispose();
-        }
+        return this._script.rawLocationToUILocation(this.rawLocation().lineNumber, this.rawLocation().columnNumber);
     },
 
     dispose: function()
     {
-        for (var i = 0; i < this._uiSourceCodes.length; ++i)
-            this._uiSourceCodes[i].removeLiveLocation(this);
-        this._uiSourceCodes = [];
+        WebInspector.LiveLocation.prototype.dispose.call(this);
         this._script._locations.remove(this);
     }
 }
+
+WebInspector.Script.Location.prototype.__proto__ = WebInspector.LiveLocation.prototype;

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (123760 => 123761)


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-26 16:40:49 UTC (rev 123760)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-26 16:42:27 UTC (rev 123761)
@@ -50,6 +50,9 @@
      * @type Array.<function(?string,boolean,string)>
      */
     this._requestContentCallbacks = [];
+    /**
+     * @type Array.<WebInspector.LiveLocation>
+     */
     this._liveLocations = [];
     /**
      * @type {Array.<WebInspector.PresentationConsoleMessage>}
@@ -379,7 +382,7 @@
     },
 
     /**
-     * @param {WebInspector.Script.Location} liveLocation
+     * @param {WebInspector.LiveLocation} liveLocation
      */
     addLiveLocation: function(liveLocation)
     {
@@ -387,7 +390,7 @@
     },
 
     /**
-     * @param {WebInspector.Script.Location} liveLocation
+     * @param {WebInspector.LiveLocation} liveLocation
      */
     removeLiveLocation: function(liveLocation)
     {
@@ -403,7 +406,6 @@
 
     /**
      * @param {WebInspector.UILocation} uiLocation
-     * @return {WebInspector.UILocation}
      */
     overrideLocation: function(uiLocation)
     {
@@ -521,6 +523,58 @@
 
 /**
  * @constructor
+ * @param {WebInspector.RawLocation} rawLocation
+ * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
+ */
+WebInspector.LiveLocation = function(rawLocation, updateDelegate)
+{
+    this._rawLocation = rawLocation;
+    this._updateDelegate = updateDelegate;
+    this._uiSourceCodes = [];
+}
+
+WebInspector.LiveLocation.prototype = {
+    update: function()
+    {
+        var uiLocation = this.uiLocation();
+        if (uiLocation) {
+            var uiSourceCode = uiLocation.uiSourceCode;
+            if (this._uiSourceCodes.indexOf(uiSourceCode) === -1) {
+                uiSourceCode.addLiveLocation(this);
+                this._uiSourceCodes.push(uiSourceCode);
+            }
+            var _oneTime_ = this._updateDelegate(uiLocation);
+            if (oneTime)
+                this.dispose();
+        }
+    },
+
+    /**
+     * @return {WebInspector.RawLocation}
+     */
+    rawLocation: function()
+    {
+        return this._rawLocation;
+    },
+
+    /**
+     * @return {WebInspector.UILocation}
+     */
+    uiLocation: function()
+    {
+        // Should be overridden by subclasses.
+    },
+
+    dispose: function()
+    {
+        for (var i = 0; i < this._uiSourceCodes.length; ++i)
+            this._uiSourceCodes[i].removeLiveLocation(this);
+        this._uiSourceCodes = [];
+    }
+}
+
+/**
+ * @constructor
  * @implements {WebInspector.ContentProvider}
  * @param {WebInspector.UISourceCode} uiSourceCode
  * @param {?string|undefined} content

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (123760 => 123761)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-07-26 16:40:49 UTC (rev 123760)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-07-26 16:42:27 UTC (rev 123761)
@@ -91,7 +91,6 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
@@ -187,6 +186,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to