Title: [99689] trunk/Source/WebCore
Revision
99689
Author
[email protected]
Date
2011-11-09 05:02:03 -0800 (Wed, 09 Nov 2011)

Log Message

Web Inspector: Extract ApplicationCacheModel from ApplicationCacheItemsView.
https://bugs.webkit.org/show_bug.cgi?id=71850

Reviewed by Pavel Feldman.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.sh:
* inspector/front-end/ApplicationCacheItemsView.js:
(WebInspector.ApplicationCacheItemsView):
(WebInspector.ApplicationCacheItemsView.prototype._update):
* inspector/front-end/ApplicationCacheModel.js: Added.
(WebInspector.ApplicationCacheModel):
(WebInspector.ApplicationCacheModel.prototype.getApplicationCachesAsync):
(WebInspector.ApplicationCacheDispatcher):
(WebInspector.ApplicationCacheDispatcher.prototype.updateApplicationCacheStatus):
(WebInspector.ApplicationCacheDispatcher.prototype.updateNetworkState):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.wasShown):
(WebInspector.ResourcesPanel.prototype.reset):
(WebInspector.ResourcesPanel.prototype._populateResourceTree):
(WebInspector.ResourcesPanel.prototype.showApplicationCache):
(WebInspector.ResourcesPanel.prototype._initializeApplicationCacheModel):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99688 => 99689)


--- trunk/Source/WebCore/ChangeLog	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/ChangeLog	2011-11-09 13:02:03 UTC (rev 99689)
@@ -1,5 +1,33 @@
 2011-11-09  Vsevolod Vlasov  <[email protected]>
 
+        Web Inspector: Extract ApplicationCacheModel from ApplicationCacheItemsView.
+        https://bugs.webkit.org/show_bug.cgi?id=71850
+
+        Reviewed by Pavel Feldman.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/ApplicationCacheItemsView.js:
+        (WebInspector.ApplicationCacheItemsView):
+        (WebInspector.ApplicationCacheItemsView.prototype._update):
+        * inspector/front-end/ApplicationCacheModel.js: Added.
+        (WebInspector.ApplicationCacheModel):
+        (WebInspector.ApplicationCacheModel.prototype.getApplicationCachesAsync):
+        (WebInspector.ApplicationCacheDispatcher):
+        (WebInspector.ApplicationCacheDispatcher.prototype.updateApplicationCacheStatus):
+        (WebInspector.ApplicationCacheDispatcher.prototype.updateNetworkState):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype.wasShown):
+        (WebInspector.ResourcesPanel.prototype.reset):
+        (WebInspector.ResourcesPanel.prototype._populateResourceTree):
+        (WebInspector.ResourcesPanel.prototype.showApplicationCache):
+        (WebInspector.ResourcesPanel.prototype._initializeApplicationCacheModel):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
+2011-11-09  Vsevolod Vlasov  <[email protected]>
+
         Web Inspector: ResourcesPanel should support adding subtitle to any BaseStorageTreeElement.
         https://bugs.webkit.org/show_bug.cgi?id=71848
 

Modified: trunk/Source/WebCore/WebCore.gypi (99688 => 99689)


--- trunk/Source/WebCore/WebCore.gypi	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/WebCore.gypi	2011-11-09 13:02:03 UTC (rev 99689)
@@ -6274,6 +6274,7 @@
             'inspector/front-end/inspector.html',
             'inspector/front-end/AdvancedSearchController.js',
             'inspector/front-end/ApplicationCacheItemsView.js',
+            'inspector/front-end/ApplicationCacheModel.js',
             'inspector/front-end/AuditCategories.js',
             'inspector/front-end/AuditFormatters.js',
             'inspector/front-end/AuditLauncherView.js',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (99688 => 99689)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-11-09 13:02:03 UTC (rev 99689)
@@ -68573,6 +68573,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\ApplicationCacheModel.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\AuditCategories.js"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (99688 => 99689)


--- trunk/Source/WebCore/inspector/compile-front-end.sh	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh	2011-11-09 13:02:03 UTC (rev 99689)
@@ -45,7 +45,8 @@
         --js Source/WebCore/inspector/front-end/UserMetrics.js \
         --js Source/WebCore/inspector/front-end/HandlerRegistry.js \
         --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
-    --module jsmodule_sdk:25:jsmodule_common \
+    --module jsmodule_sdk:26:jsmodule_common \
+        --js Source/WebCore/inspector/front-end/ApplicationCacheModel.js \
         --js Source/WebCore/inspector/front-end/CompilerSourceMapping.js \
         --js Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js \
         --js Source/WebCore/inspector/front-end/ConsoleModel.js \

Modified: trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js (99688 => 99689)


--- trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js	2011-11-09 13:02:03 UTC (rev 99689)
@@ -27,9 +27,11 @@
  * @constructor
  * @extends {WebInspector.View}
  */
-WebInspector.ApplicationCacheItemsView = function(treeElement, appcacheDomain)
+WebInspector.ApplicationCacheItemsView = function(model, treeElement, appcacheDomain)
 {
     WebInspector.View.call(this);
+    
+    this._model = model;
 
     this.element.addStyleClass("storage-view");
     this.element.addStyleClass("table");
@@ -149,7 +151,7 @@
 
     _update: function()
     {
-        WebInspector.ApplicationCacheDispatcher.getApplicationCachesAsync(this._updateCallback.bind(this));
+        this._model.getApplicationCachesAsync(this._updateCallback.bind(this));
     },
 
     _updateCallback: function(applicationCaches)
@@ -274,37 +276,3 @@
 }
 
 WebInspector.ApplicationCacheItemsView.prototype.__proto__ = WebInspector.View.prototype;
-
-/**
- * @constructor
- * @implements {ApplicationCacheAgent.Dispatcher}
- */
-WebInspector.ApplicationCacheDispatcher = function()
-{
-}
-
-WebInspector.ApplicationCacheDispatcher.getApplicationCachesAsync = function(callback)
-{
-    function mycallback(error, applicationCaches)
-    {
-        // FIXME: Currently, this list only returns a single application cache.
-        if (!error && applicationCaches)
-            callback(applicationCaches);
-    }
-
-    ApplicationCacheAgent.getApplicationCaches(mycallback);
-}
-
-WebInspector.ApplicationCacheDispatcher.prototype = {
-    updateApplicationCacheStatus: function(status)
-    {
-        WebInspector.panels.resources.updateApplicationCacheStatus(status);
-    },
-
-    updateNetworkState: function(isNowOnline)
-    {
-        WebInspector.panels.resources.updateNetworkState(isNowOnline);
-    }
-}
-
-InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher());

Added: trunk/Source/WebCore/inspector/front-end/ApplicationCacheModel.js (0 => 99689)


--- trunk/Source/WebCore/inspector/front-end/ApplicationCacheModel.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/ApplicationCacheModel.js	2011-11-09 13:02:03 UTC (rev 99689)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS 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 GOOGLE INC.
+ * OR ITS 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.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
+WebInspector.ApplicationCacheModel = function()
+{
+    InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher(this));
+}
+
+WebInspector.ApplicationCacheModel.prototype = {
+    getApplicationCachesAsync: function(callback)
+    {
+        function mycallback(error, applicationCaches)
+        {
+            // FIXME: Currently, this list only returns a single application cache.
+            if (!error && applicationCaches)
+                callback(applicationCaches);
+        }
+
+        ApplicationCacheAgent.getApplicationCaches(mycallback);
+    }
+}
+
+WebInspector.ApplicationCacheModel.prototype.__proto__ = WebInspector.Object.prototype;
+
+/**
+ * @constructor
+ * @implements {ApplicationCacheAgent.Dispatcher}
+ */
+WebInspector.ApplicationCacheDispatcher = function(applicationCacheModel)
+{
+    this._applicationCacheModel = applicationCacheModel;
+}
+
+WebInspector.ApplicationCacheDispatcher.prototype = {
+    /**
+     * @param {number} status
+     */
+    updateApplicationCacheStatus: function(status)
+    {
+        WebInspector.panels.resources.updateApplicationCacheStatus(status);
+    },
+
+    /**
+     * @param {boolean} isNowOnline
+     */
+    updateNetworkState: function(isNowOnline)
+    {
+        WebInspector.panels.resources.updateNetworkState(isNowOnline);
+    }
+}
Property changes on: trunk/Source/WebCore/inspector/front-end/ApplicationCacheModel.js
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (99688 => 99689)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-11-09 13:02:03 UTC (rev 99689)
@@ -108,7 +108,14 @@
     wasShown: function()
     {
         WebInspector.Panel.prototype.wasShown.call(this);
-        this._populateResourceTree();
+        if (!this._initialized) {
+            this._populateResourceTree();
+            this._initializeApplicationCacheModel();
+
+            this._initDefaultSelection();
+            
+            this._initialized = true;
+        }
     },
 
     _onLoadEventFired: function()
@@ -118,7 +125,7 @@
 
     _initDefaultSelection: function()
     {
-        if (!this._treeElementForFrameId)
+        if (!this._initialized)
             return;
 
         var itemURL = WebInspector.settings.resourcesLastSelectedItem.get();
@@ -137,6 +144,9 @@
 
     reset: function()
     {
+        this.resourcesListTreeElement.removeChildren();
+        this._treeElementForFrameId = {};
+
         this._origins = {};
         this._domains = {};
         for (var i = 0; i < this._databases.length; ++i) {
@@ -177,16 +187,13 @@
 
     _populateResourceTree: function()
     {
-        if (this._treeElementForFrameId)
-            return;
-
         this._treeElementForFrameId = {};
         WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
         WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
         WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
         WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
         WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._cachedResourcesLoaded, this);
-        WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources, this._resetResourcesTree, this);
+        WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources, this.reset, this);
 
         function populateFrame(frameId)
         {
@@ -201,8 +208,6 @@
                 this._resourceAdded({data:resources[i]});
         }
         populateFrame.call(this, "");
-
-        this._initDefaultSelection();
     },
 
     _frameAdded: function(event)
@@ -259,13 +264,6 @@
             frameTreeElement.frameNavigated(event.data.frame);
     },
 
-    _resetResourcesTree: function()
-    {
-        this.resourcesListTreeElement.removeChildren();
-        this._treeElementForFrameId = {};
-        this.reset();
-    },
-
     _cachedResourcesLoaded: function()
     {
         this._initDefaultSelection();
@@ -486,7 +484,7 @@
     {
         var view = this._applicationCacheView;
         if (!view) {
-            view = new WebInspector.ApplicationCacheItemsView(treeElement, appcacheDomain);
+            view = new WebInspector.ApplicationCacheItemsView(this._applicationCacheModel, treeElement, appcacheDomain);
             this._applicationCacheView = view;
         }
 
@@ -568,6 +566,11 @@
             domStorage._domStorageView.update();
     },
 
+    _initializeApplicationCacheModel: function()
+    {
+        this._applicationCacheModel = new WebInspector.ApplicationCacheModel();
+    },
+    
     updateApplicationCacheStatus: function(status)
     {
         this._cachedApplicationCacheViewStatus = status;

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (99688 => 99689)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2011-11-09 13:02:03 UTC (rev 99689)
@@ -3,6 +3,7 @@
     <file>inspector.html</file>
     <file>AdvancedSearchController.js</file>
     <file>ApplicationCacheItemsView.js</file>
+    <file>ApplicationCacheModel.js</file>
     <file>AuditCategories.js</file>
     <file>AuditFormatters.js</file>
     <file>AuditLauncherView.js</file>

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


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2011-11-09 13:01:45 UTC (rev 99688)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2011-11-09 13:02:03 UTC (rev 99689)
@@ -78,6 +78,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
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to