2010-12-17 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Dec 2010 08:29:52 +0000 (08:29 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Dec 2010 08:29:52 +0000 (08:29 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: remove unnecessary dependencies from InspectorBackendStub.

        InspectorBackendStub is a transport-only thing but it has dependencies with
        Callback.js and WebInspector namespace. Callback can be integrated into
        InspectorBackendStub because it is the only client.
        Without these dependencies InspectorBackendStub can be used as an API
        wrapper for Inspector Protocol.

        https://bugs.webkit.org/show_bug.cgi?id=51184

        * WebCore.gypi:
        * inspector/CodeGeneratorInspector.pm:
        * inspector/front-end/Callback.js: Removed.
        * inspector/front-end/WebKit.qrc:
        * inspector/front-end/inspector.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/inspector/CodeGeneratorInspector.pm
WebCore/inspector/front-end/Callback.js [deleted file]
WebCore/inspector/front-end/WebKit.qrc
WebCore/inspector/front-end/inspector.html

index f34b2d9..3a38f38 100644 (file)
@@ -1,3 +1,23 @@
+2010-12-17  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: remove unnecessary dependencies from InspectorBackendStub.
+
+        InspectorBackendStub is a transport-only thing but it has dependencies with
+        Callback.js and WebInspector namespace. Callback can be integrated into
+        InspectorBackendStub because it is the only client.
+        Without these dependencies InspectorBackendStub can be used as an API
+        wrapper for Inspector Protocol.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51184
+
+        * WebCore.gypi:
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/front-end/Callback.js: Removed.
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
 2010-12-15  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Pavel Feldman.
index 66fccf4..fca8cfc 100644 (file)
             'inspector/front-end/Breakpoint.js',
             'inspector/front-end/BreakpointManager.js',
             'inspector/front-end/BreakpointsSidebarPane.js',
-            'inspector/front-end/Callback.js',
             'inspector/front-end/CallStackSidebarPane.js',
             'inspector/front-end/ChangesView.js',
             'inspector/front-end/Checkbox.js',
index 6d2e3c4..e960ed6 100644 (file)
@@ -564,13 +564,33 @@ sub generateBackendStubJS
     my $inspectorBackendStubJS = << "EOF";
 $licenseTemplate
 
-WebInspector.InspectorBackendStub = function()
+InspectorBackendStub = function()
 {
+    this._lastCallbackId = 1;
+    this._callbacks = {};
     this._domainDispatchers = {};
 $JSStubs
 }
 
-WebInspector.InspectorBackendStub.prototype = {
+InspectorBackendStub.prototype = {
+    _wrap: function(callback)
+    {
+        var callbackId = this._lastCallbackId++;
+        this._callbacks[callbackId] = callback || function() {};
+        return callbackId;
+    },
+
+    _processResponse: function(callbackId, args)
+    {
+        var callback = this._callbacks[callbackId];
+        callback.apply(null, args);
+        delete this._callbacks[callbackId];
+    },
+
+    _removeResponseCallbackEntry: function(callbackId)
+    {
+        delete this._callbacks[callbackId];
+    },
 
     _registerDelegate: function(commandInfo)
     {
@@ -601,7 +621,7 @@ WebInspector.InspectorBackendStub.prototype = {
                 console.error("Protocol Error: Optional callback argument for 'InspectorBackend.%s' call should be a function but its type is '%s'.", request.command, typeof args[0]);
                 return;
             }
-            request.seq = WebInspector.Callback.wrap(args[0]);
+            request.seq = this._wrap(args[0]);
         }
 
         if (window.dumpInspectorProtocolMessages)
@@ -630,9 +650,9 @@ WebInspector.InspectorBackendStub.prototype = {
 
         if ("seq" in messageObject) { // just a response for some request
             if (messageObject.success)
-                WebInspector.Callback.processResponse(messageObject.seq, arguments);
+                this._processResponse(messageObject.seq, arguments);
             else {
-                WebInspector.Callback.removeResponseCallbackEntry(messageObject.seq)
+                this._removeResponseCallbackEntry(messageObject.seq)
                 this.reportProtocolError(messageObject);
             }
             return;
@@ -657,11 +677,11 @@ WebInspector.InspectorBackendStub.prototype = {
         console.error("Protocol Error: InspectorBackend request with seq = %d failed.", messageObject.seq);
         for (var i = 0; i < messageObject.errors.length; ++i)
             console.error("    " + messageObject.errors[i]);
-        WebInspector.Callback.removeResponseCallbackEntry(messageObject.seq);
+        this._removeResponseCallbackEntry(messageObject.seq);
     }
 }
 
-InspectorBackend = new WebInspector.InspectorBackendStub();
+InspectorBackend = new InspectorBackendStub();
 
 EOF
     return split("\n", $inspectorBackendStubJS);
diff --git a/WebCore/inspector/front-end/Callback.js b/WebCore/inspector/front-end/Callback.js
deleted file mode 100644 (file)
index 8e3f1d7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.Callback = function()
-{
-    this._lastCallbackId = 1;
-    this._callbacks = {};
-}
-
-WebInspector.Callback.prototype = {
-    wrap: function(callback)
-    {
-        var callbackId = this._lastCallbackId++;
-        this._callbacks[callbackId] = callback || function() {};
-        return callbackId;
-    },
-
-    processResponse: function(callbackId, args)
-    {
-        var callback = this._callbacks[callbackId];
-        callback.apply(null, args);
-        delete this._callbacks[callbackId];
-    },
-
-    removeResponseCallbackEntry: function(callbackId)
-    {
-        delete this._callbacks[callbackId];
-    }
-}
-
-WebInspector.Callback._INSTANCE = new WebInspector.Callback();
-WebInspector.Callback.wrap = WebInspector.Callback._INSTANCE.wrap.bind(WebInspector.Callback._INSTANCE);
-WebInspector.Callback.processResponse = WebInspector.Callback._INSTANCE.processResponse.bind(WebInspector.Callback._INSTANCE);
-WebInspector.Callback.removeResponseCallbackEntry = WebInspector.Callback._INSTANCE.removeResponseCallbackEntry.bind(WebInspector.Callback._INSTANCE);
index 2f91adb..90c4317 100644 (file)
@@ -12,7 +12,6 @@
     <file>Breakpoint.js</file>
     <file>BreakpointManager.js</file>
     <file>BreakpointsSidebarPane.js</file>
-    <file>Callback.js</file>
     <file>CallStackSidebarPane.js</file>
     <file>ChangesView.js</file>
     <file>Checkbox.js</file>
index 40e75ea..9ed5019 100644 (file)
@@ -55,7 +55,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="TabbedPane.js"></script>
     <script type="text/javascript" src="Placard.js"></script>
     <script type="text/javascript" src="View.js"></script>
-    <script type="text/javascript" src="Callback.js"></script>
     <script type="text/javascript" src="Drawer.js"></script>
     <script type="text/javascript" src="ChangesView.js"></script>
     <script type="text/javascript" src="ConsoleView.js"></script>