From ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 16 May 2011 16:25:10 +0100 Subject: Merge WebKit at r76408: Initial merge by git. Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53 --- .../inspector/front-end/AuditLauncherView.js | 58 +++++++--------------- 1 file changed, 18 insertions(+), 40 deletions(-) (limited to 'Source/WebCore/inspector/front-end/AuditLauncherView.js') diff --git a/Source/WebCore/inspector/front-end/AuditLauncherView.js b/Source/WebCore/inspector/front-end/AuditLauncherView.js index c140589..df16a41 100644 --- a/Source/WebCore/inspector/front-end/AuditLauncherView.js +++ b/Source/WebCore/inspector/front-end/AuditLauncherView.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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 @@ -50,60 +50,38 @@ WebInspector.AuditLauncherView = function(runnerCallback) this._headerElement.className = "no-audits"; this._headerElement.textContent = WebInspector.UIString("No audits to run"); this._contentElement.appendChild(this._headerElement); + + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this); + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceFinished, this); } WebInspector.AuditLauncherView.prototype = { - get totalResources() + _resetResourceCount: function() { - return this._totalResources; + this._loadedResources = 0; + this._totalResources = 0; }, - set totalResources(x) + _onResourceStarted: function(event) { - if (this._totalResources === x) + var resource = event.data; + // Ignore long-living WebSockets for the sake of progress indicator, as we won't be waiting them anyway. + if (resource.type === WebInspector.Resource.Type.WebSocket) return; - this._totalResources = x; + ++this._totalResources; this._updateResourceProgress(); }, - get loadedResources() - { - return this._loadedResources; - }, - - set loadedResources(x) + _onResourceFinished: function(event) { - if (this._loadedResources === x) + var resource = event.data; + // See resorceStarted for details. + if (resource.type === WebInspector.Resource.Type.WebSocket) return; - this._loadedResources = x; + ++this._loadedResources; this._updateResourceProgress(); }, - _resetResourceCount: function() - { - this.loadedResources = 0; - this.totalResources = 0; - }, - - resourceStarted: function(resource) - { - // Ignore long-living WebSockets for the sake of progress indicator, as we won't be waiting them anyway. - if (resource.type !== WebInspector.Resource.Type.WebSocket) - ++this.totalResources; - }, - - resourceFinished: function(resource) - { - // See resorceStarted for details. - if (resource.type !== WebInspector.Resource.Type.WebSocket) - ++this.loadedResources; - }, - - reset: function() - { - this._resetResourceCount(); - }, - addCategory: function(category) { if (!this._sortedCategories.length) @@ -264,7 +242,7 @@ WebInspector.AuditLauncherView.prototype = { this._resourceProgressContainer.addStyleClass("hidden"); } else this._resourceProgressContainer.removeStyleClass("hidden"); - this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources); + this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this._loadedResources, this._totalResources); }, _updateButton: function() -- cgit v1.1