Changeset 84904 in webkit
- Timestamp:
- Apr 26, 2011 4:35:42 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84901 r84904 1 2011-04-26 Pavel Feldman <pfeldman@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: extract Page agent dispatcher into the ResourceTreeModel. 6 https://bugs.webkit.org/show_bug.cgi?id=59440 7 8 * inspector/Inspector.json: 9 * inspector/InspectorAgent.cpp: 10 (WebCore::InspectorAgent::restoreInspectorStateFromCookie): 11 * inspector/InspectorPageAgent.cpp: 12 (WebCore::InspectorPageAgent::setFrontend): 13 (WebCore::InspectorPageAgent::frameNavigated): 14 * inspector/InspectorPageAgent.h: 15 * inspector/front-end/AuditsPanel.js: 16 (WebInspector.AuditsPanel): 17 (WebInspector.AuditsPanel.prototype._onLoadEventFired): 18 (WebInspector.AuditsPanel.prototype._domContentLoadedEventFired): 19 * inspector/front-end/CSSStyleModel.js: 20 (WebInspector.CSSStyleModelResourceBinding): 21 (WebInspector.CSSStyleModelResourceBinding.prototype._inspectedURLChanged): 22 * inspector/front-end/DOMBreakpointsSidebarPane.js: 23 (WebInspector.DOMBreakpointsSidebarPane): 24 (WebInspector.DOMBreakpointsSidebarPane.prototype._inspectedURLChanged): 25 * inspector/front-end/DOMStorage.js: 26 (WebInspector.DOMStorageDispatcher.prototype.addDOMStorage): 27 * inspector/front-end/ExtensionServer.js: 28 (WebInspector.ExtensionServer.prototype._inspectedURLChanged): 29 (WebInspector.ExtensionServer.prototype.initExtensions): 30 * inspector/front-end/NetworkPanel.js: 31 (WebInspector.NetworkPanel): 32 (WebInspector.NetworkPanel.prototype._onLoadEventFired): 33 (WebInspector.NetworkPanel.prototype._domContentLoadedEventFired): 34 (WebInspector.NetworkPanel.prototype._frameNavigated): 35 * inspector/front-end/ResourceTreeModel.js: 36 (WebInspector.ResourceTreeModel): 37 (WebInspector.ResourceTreeModel.prototype._processCachedResources): 38 (WebInspector.ResourceTreeModel.prototype._dispatchInspectedURLChanged): 39 (WebInspector.ResourceTreeModel.prototype._frameNavigated): 40 (WebInspector.ResourceTreeModel.prototype._frameDetached): 41 (WebInspector.ResourceTreeModel.prototype._clearChildFramesAndResources): 42 (WebInspector.PageDispatcher): 43 (WebInspector.PageDispatcher.prototype.domContentEventFired): 44 (WebInspector.PageDispatcher.prototype.loadEventFired): 45 (WebInspector.PageDispatcher.prototype.frameNavigated): 46 (WebInspector.PageDispatcher.prototype.frameDetached): 47 * inspector/front-end/ResourcesPanel.js: 48 (WebInspector.ResourcesPanel): 49 (WebInspector.ResourcesPanel.prototype._onLoadEventFired): 50 (WebInspector.ResourcesPanel.prototype._frameNavigated): 51 * inspector/front-end/inspector.js: 52 1 53 2011-04-26 Csaba Osztrogonác <ossy@webkit.org> 2 54 -
trunk/Source/WebCore/inspector/Inspector.json
r84775 r84904 161 161 ], 162 162 "events": [ 163 {164 "name": "inspectedURLChanged",165 "parameters": [166 { "name": "url", "type": "string" }167 ]168 },169 163 { 170 164 "name": "domContentEventFired", -
trunk/Source/WebCore/inspector/InspectorAgent.cpp
r84833 r84904 195 195 196 196 m_frontend->inspector()->frontendReused(); 197 m_pageAgent->restore();198 197 199 198 m_domAgent->restore(); -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r84774 r84904 201 201 m_frontend = frontend->page(); 202 202 m_instrumentingAgents->setInspectorPageAgent(this); 203 204 // Initialize Web Inspector title.205 m_frontend->inspectedURLChanged(m_page->mainFrame()->document()->url().string());206 203 } 207 204 … … 351 348 } 352 349 353 void InspectorPageAgent::restore()354 {355 m_frontend->inspectedURLChanged(mainFrame()->document()->url().string());356 }357 358 350 void InspectorPageAgent::domContentEventFired() 359 351 { … … 369 361 { 370 362 m_frontend->frameNavigated(buildObjectForFrame(loader->frame()), loaderId(loader)); 371 m_frontend->inspectedURLChanged(loader->url().string());372 363 } 373 364 -
trunk/Source/WebCore/inspector/InspectorPageAgent.h
r84774 r84904 102 102 void setFrontend(InspectorFrontend*); 103 103 void clearFrontend(); 104 void restore();105 104 106 105 // Cross-agents API -
trunk/Source/WebCore/inspector/front-end/AuditsPanel.js
r84772 r84904 58 58 for (id in this.categoriesById) 59 59 this._launcherView.addCategory(this.categoriesById[id]); 60 61 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._onLoadEventFired, this); 62 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); 60 63 } 61 64 … … 76 79 }, 77 80 78 set mainResourceLoadTime(x)79 { 80 this._mainResourceLoadTime = x;81 _onLoadEventFired: function(event) 82 { 83 this._mainResourceLoadTime = event.data; 81 84 this._didMainResourceLoad(); 82 85 }, … … 87 90 }, 88 91 89 set mainResourceDOMContentTime(x)90 { 91 this._mainResourceDOMContentTime = x;92 _domContentLoadedEventFired: function(event) 93 { 94 this._mainResourceDOMContentTime = event.data; 92 95 }, 93 96 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r84481 r84904 609 609 this._styleSheetIdToURL = {}; 610 610 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this); 611 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes. FrameNavigated, this._frameNavigated, this);611 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this); 612 612 WebInspector.Resource.registerDomainModelBinding(WebInspector.Resource.Type.Stylesheet, this); 613 613 } … … 623 623 }, 624 624 625 _frameNavigated: function(event) 626 { 627 var frameId = event.data; 628 if (!frameId) { 629 // Main frame navigation - clear history. 630 this._urlToStyleSheetId = {}; 631 this._styleSheetIdToURL = {}; 632 } 625 _inspectedURLChanged: function(event) 626 { 627 // Main frame navigation - clear history. 628 this._urlToStyleSheetId = {}; 629 this._styleSheetIdToURL = {}; 633 630 }, 634 631 -
trunk/Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js
r83864 r84904 50 50 WebInspector.UIString("Break on Node Removal") 51 51 ]; 52 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this); 52 53 } 53 54 54 55 WebInspector.DOMBreakpointsSidebarPane.prototype = { 55 setInspectedURL: function(url)56 _inspectedURLChanged: function(event) 56 57 { 57 58 this._reset(); 59 var url = event.data; 58 60 this._inspectedURL = url.removeURLFragment(); 59 61 }, -
trunk/Source/WebCore/inspector/front-end/DOMStorage.js
r80931 r84904 74 74 addDOMStorage: function(payload) 75 75 { 76 if (!WebInspector.panels.resources)77 return;78 76 var domStorage = new WebInspector.DOMStorage( 79 77 payload.id, -
trunk/Source/WebCore/inspector/front-end/ExtensionServer.js
r84772 r84904 80 80 }, 81 81 82 notifyInspectedURLChanged: function(url) 83 { 82 _inspectedURLChanged: function(event) 83 { 84 var url = event.data; 84 85 this._postNotification("inspectedURLChanged", url); 85 86 }, … … 377 378 // The networkManager is normally created after the ExtensionServer is constructed, but before initExtensions() is called. 378 379 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._notifyResourceFinished, this); 380 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this); 379 381 380 382 InspectorExtensionRegistry.getExtensionsAsync(); -
trunk/Source/WebCore/inspector/front-end/NetworkPanel.js
r84778 r84904 85 85 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this); 86 86 87 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this); 88 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._onLoadEventFired, this); 89 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); 90 87 91 this.registerShortcuts(); 88 92 } … … 608 612 }, 609 613 610 set mainResourceLoadTime(x) 611 { 612 if (this._mainResourceLoadTime === x) 613 return; 614 615 this._mainResourceLoadTime = x || -1; 614 _onLoadEventFired: function(event) 615 { 616 this._mainResourceLoadTime = event.data || -1; 616 617 // Update the dividers to draw the new line 617 618 this._updateDividersIfNeeded(true); 618 619 }, 619 620 620 set mainResourceDOMContentTime(x) 621 { 622 if (this._mainResourceDOMContentTime === x) 623 return; 624 625 this._mainResourceDOMContentTime = x || -1; 621 _domContentLoadedEventFired: function(event) 622 { 623 this._mainResourceDOMContentTime = event.data || -1; 626 624 this._updateDividersIfNeeded(true); 627 625 }, … … 807 805 }, 808 806 809 frameNavigated: function(frame, loaderId) 810 { 811 if (frame.parentId) 812 return; 813 807 _frameNavigated: function(event) 808 { 809 if (!event.data.isMainFrame) 810 return; 811 812 var loaderId = event.data.loaderId; 814 813 // Main frame committed load. 815 814 if (this._preserveLogToggle.toggled) -
trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js
r84774 r84904 37 37 38 38 this.frontendReused(); 39 InspectorBackend.registerDomainDispatcher("Page", new WebInspector.PageDispatcher(this)); 39 40 } 40 41 … … 44 45 FrameDetached: "FrameDetached", 45 46 ResourceAdded: "ResourceAdded", 46 CachedResourcesLoaded: "CachedResourcesLoaded" 47 CachedResourcesLoaded: "CachedResourcesLoaded", 48 DOMContentLoaded: "DOMContentLoaded", 49 OnLoad: "OnLoad", 50 InspectedURLChanged: "InspectedURLChanged" 47 51 } 48 52 … … 61 65 return; 62 66 63 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, 0);64 65 67 WebInspector.mainResource = this._addFramesRecursively(mainFramePayload); 66 68 this._cachedResourcesProcessed = true; 67 69 70 this._dispatchInspectedURLChanged(WebInspector.mainResource.url); 71 68 72 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded); 73 }, 74 75 _dispatchInspectedURLChanged: function(url) 76 { 77 InspectorFrontendHost.inspectedURLChanged(url); 78 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, url); 69 79 }, 70 80 … … 100 110 }, 101 111 102 frameNavigated: function(frame, loaderId)112 _frameNavigated: function(frame, loaderId) 103 113 { 104 114 if (!this._cachedResourcesProcessed) … … 106 116 107 117 var isMainFrame = !frame.parentId; 118 if (isMainFrame) 119 this._dispatchInspectedURLChanged(WebInspector.mainResource.url); 120 121 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, { frame: frame, loaderId: loaderId, isMainFrame: isMainFrame }); 108 122 109 123 // frame.parentId === 0 is when main frame navigation happens. … … 125 139 }, 126 140 127 frameDetached: function(frameId)141 _frameDetached: function(frameId) 128 142 { 129 143 if (!this._cachedResourcesProcessed) … … 212 226 _clearChildFramesAndResources: function(frameId, loaderToPreserveId) 213 227 { 214 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, frameId);215 216 228 this._clearResources(frameId, loaderToPreserveId); 217 229 var subframes = this._subframes[frameId]; … … 306 318 307 319 WebInspector.ResourceTreeModel.prototype.__proto__ = WebInspector.Object.prototype; 320 321 WebInspector.PageDispatcher = function(resourceTreeModel) 322 { 323 this._resourceTreeModel = resourceTreeModel; 324 } 325 326 WebInspector.PageDispatcher.prototype = { 327 domContentEventFired: function(time) 328 { 329 this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded, time); 330 331 // FIXME: the only client is HAR, fix it there. 332 WebInspector.mainResourceDOMContentTime = time; 333 }, 334 335 loadEventFired: function(time) 336 { 337 this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.OnLoad, time); 338 339 // FIXME: the only client is HAR, fix it there. 340 WebInspector.mainResourceLoadTime = time; 341 }, 342 343 frameNavigated: function(frame, loaderId) 344 { 345 this._resourceTreeModel._frameNavigated(frame, loaderId); 346 }, 347 348 frameDetached: function(frameId) 349 { 350 this._resourceTreeModel._frameDetached(loaderId); 351 } 352 } -
trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js
r84772 r84904 79 79 80 80 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._refreshResource, this); 81 82 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._onLoadEventFired, this); 81 83 } 82 84 … … 107 109 }, 108 110 109 loadEventFired: function()111 _onLoadEventFired: function() 110 112 { 111 113 this._initDefaultSelection(); … … 254 256 _frameNavigated: function(event) 255 257 { 256 var frameId = event.data; 257 if (!frameId) { 258 if (event.data.isMainFrame) { 258 259 // Total update. 259 260 this.resourcesListTreeElement.removeChildren(); … … 263 264 } 264 265 266 var frameId = event.data.frame.id; 265 267 var frameTreeElement = this._treeElementForFrameId[frameId]; 266 268 if (frameTreeElement) -
trunk/Source/WebCore/inspector/front-end/inspector.js
r84780 r84904 437 437 438 438 InspectorBackend.registerDomainDispatcher("Inspector", this); 439 InspectorBackend.registerDomainDispatcher("Page", this);440 439 441 440 this.resourceCategories = { … … 982 981 } 983 982 984 WebInspector.domContentEventFired = function(time)985 {986 this.panels.audits.mainResourceDOMContentTime = time;987 this.panels.network.mainResourceDOMContentTime = time;988 989 this.mainResourceDOMContentTime = time;990 }991 992 WebInspector.loadEventFired = function(time)993 {994 this.panels.audits.mainResourceLoadTime = time;995 this.panels.network.mainResourceLoadTime = time;996 this.panels.resources.loadEventFired();997 998 this.mainResourceLoadTime = time;999 }1000 1001 // FIXME: move these into the dedicated dispatcher.1002 WebInspector.frameNavigated = function(frame, loaderId)1003 {1004 this.resourceTreeModel.frameNavigated(frame, loaderId);1005 this.panels.network.frameNavigated(frame, loaderId);1006 }1007 WebInspector.frameDetached = function(frameId)1008 {1009 this.resourceTreeModel.frameDetached(loaderId);1010 }1011 1012 983 WebInspector.reset = function() 1013 984 { … … 1030 1001 { 1031 1002 InspectorFrontendHost.bringToFront(); 1032 }1033 1034 WebInspector.inspectedURLChanged = function(url)1035 {1036 InspectorFrontendHost.inspectedURLChanged(url);1037 this.domBreakpointsSidebarPane.setInspectedURL(url);1038 this.extensionServer.notifyInspectedURLChanged(url);1039 1003 } 1040 1004
Note: See TracChangeset
for help on using the changeset viewer.