summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/inspector/front-end/AuditLauncherView.js
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebCore/inspector/front-end/AuditLauncherView.js
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore/inspector/front-end/AuditLauncherView.js')
-rw-r--r--Source/WebCore/inspector/front-end/AuditLauncherView.js58
1 files changed, 18 insertions, 40 deletions
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()