keep track of the amount of data loaded and the total data length
https://bugs.webkit.org/show_bug.cgi?id=89244
Patch by Hanna Ma <Hanma@rim.com> on 2012-06-29
Reviewed by Pavel Feldman.
Added data length to inspector timeline popup
content for resources to keep track of the amount of data loaded.
Tests: inspector/timeline/timeline-network-received-data.html
* English.lproj/localizedStrings.js:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willReceiveResourceDataImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::willReceiveResourceData):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::willReceiveResourceData):
* inspector/InspectorTimelineAgent.h:
(InspectorTimelineAgent):
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createReceiveResourceData):
* inspector/TimelineRecordFactory.h:
(TimelineRecordFactory):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._showPopover):
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel.prototype.reset):
(WebInspector.TimelinePresentationModel.Record):
(WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveData):
* inspector/timeline/timeline-network-received-data.html: Added.
* inspector/timeline/timeline-network-received-data-expected.txt: Added.
* inspector/timeline/timeline-test.js:
LayoutTests: Web Inspector: Add data length to resource events on timeline to
keep track of the amount of data loaded and the total data length.
https://bugs.webkit.org/show_bug.cgi?id=89244
Patch by Hanna Ma <Hanma@rim.com> on 2012-06-29
Reviewed by Pavel Feldman.
Added tests for resource receive data events.
* inspector/timeline/timeline-network-received-data-expected.txt: Added.
* inspector/timeline/timeline-network-received-data.html: Added.
* inspector/timeline/timeline-test.js:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121592
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-06-29 Hanna Ma <Hanma@rim.com>
+
+ Web Inspector: Add data length to resource events on timeline to
+ keep track of the amount of data loaded and the total data length.
+ https://bugs.webkit.org/show_bug.cgi?id=89244
+
+ Reviewed by Pavel Feldman.
+
+ Added tests for resource receive data events.
+
+ * inspector/timeline/timeline-network-received-data-expected.txt: Added.
+ * inspector/timeline/timeline-network-received-data.html: Added.
+ * inspector/timeline/timeline-test.js:
+
2012-06-29 Emil A Eklund <eae@chromium.org>
Unreviewed chromium xp rebaseline.
--- /dev/null
+CONSOLE MESSAGE: line 7: Script evaluated
+Tests the Timeline API instrumentation of a network resource received data
+
+Script resource loaded
+Resource received data has length, test passed.
+
--- /dev/null
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="timeline-test.js"></script>
+<script>
+
+var scriptUrl = "timeline-network-resource.js";
+
+function performActions()
+{
+ var image = new Image();
+ image.src = "resources/anImage.png";
+ var script = document.createElement("script");
+ script.src = scriptUrl;
+ document.body.appendChild(script);
+}
+
+function test()
+{
+ var scriptUrl = "timeline-network-resource.js";
+
+ var calledOnce;
+
+ InspectorTest.startTimeline(function() {
+ InspectorTest.evaluateInPage("performActions()");
+ });
+
+ InspectorTest.waitForRecordType("ResourceReceivedData", finish);
+
+ function finish(object)
+ {
+ for (var prop in object) {
+ if (!InspectorTest.timelinePropertyFormatters[prop]) {
+ for (var property in object[prop]) {
+ if (property === "encodedDataLength") {
+ if (!calledOnce) {
+ calledOnce = true;
+ InspectorTest.addResult("Resource received data has length, test passed.");
+ InspectorTest.completeTest();
+ }
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests the Timeline API instrumentation of a network resource received data
+</p>
+</body>
+</html>
timerId: "formatAsTypeName",
scriptLine: "formatAsTypeName",
lineNumber: "formatAsTypeName",
- frameId: "formatAsTypeName"
+ frameId: "formatAsTypeName",
+ encodedDataLength: "formatAsTypeName"
};
InspectorTest.startTimeline = function(callback)
+2012-06-29 Hanna Ma <Hanma@rim.com>
+
+ Web Inspector: Add data length to resource events on timeline to
+ keep track of the amount of data loaded and the total data length
+ https://bugs.webkit.org/show_bug.cgi?id=89244
+
+ Reviewed by Pavel Feldman.
+
+ Added data length to inspector timeline popup
+ content for resources to keep track of the amount of data loaded.
+ Tests: inspector/timeline/timeline-network-received-data.html
+
+ * English.lproj/localizedStrings.js:
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::willReceiveResourceDataImpl):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+ (WebCore::InspectorInstrumentation::willReceiveResourceData):
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::willReceiveResourceData):
+ * inspector/InspectorTimelineAgent.h:
+ (InspectorTimelineAgent):
+ * inspector/TimelineRecordFactory.cpp:
+ (WebCore::TimelineRecordFactory::createReceiveResourceData):
+ * inspector/TimelineRecordFactory.h:
+ (TimelineRecordFactory):
+ * inspector/front-end/TimelinePanel.js:
+ (WebInspector.TimelinePanel.prototype._showPopover):
+ * inspector/front-end/TimelinePresentationModel.js:
+ (WebInspector.TimelinePresentationModel.prototype.reset):
+ (WebInspector.TimelinePresentationModel.Record):
+ (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::didReceiveData):
+ * inspector/timeline/timeline-network-received-data.html: Added.
+ * inspector/timeline/timeline-network-received-data-expected.txt: Added.
+ * inspector/timeline/timeline-test.js:
+
2012-06-29 Shawn Singh <shawnsingh@chromium.org>
Unreviewed build fix after 121580.
localizedStrings["apply revision content"] = "apply revision content";
localizedStrings["revert"] = "revert";
localizedStrings["CPU Time"] = "CPU Time";
+localizedStrings["Encoded Data Length"] = "Encoded Data Length";
+localizedStrings["%d Bytes"] = "%d Bytes";
resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
}
-InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Frame* frame, int length)
{
int timelineAgentId = 0;
if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
- timelineAgent->willReceiveResourceData(identifier, frame);
+ timelineAgent->willReceiveResourceData(identifier, frame, length);
timelineAgentId = timelineAgent->id();
}
return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
static void continueAfterPingLoader(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
static void markResourceAsCached(Page*, unsigned long identifier);
static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
- static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier);
+ static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier, int length);
static void didReceiveResourceData(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
- static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*);
+ static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*, int length);
static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*);
static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
#endif
}
-inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier, int length)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
- return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame);
+ return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length);
#endif
return InspectorInstrumentationCookie();
}
m_frontend->eventRecorded(record.release());
}
-void InspectorTimelineAgent::willReceiveResourceData(unsigned long identifier, Frame* frame)
+void InspectorTimelineAgent::willReceiveResourceData(unsigned long identifier, Frame* frame, int length)
{
String requestId = IdentifiersFactory::requestId(identifier);
- pushCurrentRecord(TimelineRecordFactory::createReceiveResourceData(requestId), TimelineRecordType::ResourceReceivedData, false, frame);
+ pushCurrentRecord(TimelineRecordFactory::createReceiveResourceData(requestId, length), TimelineRecordType::ResourceReceivedData, false, frame);
}
void InspectorTimelineAgent::didReceiveResourceData()
void willReceiveResourceResponse(unsigned long, const ResourceResponse&, Frame*);
void didReceiveResourceResponse();
void didFinishLoadingResource(unsigned long, bool didFail, double finishTime, Frame*);
- void willReceiveResourceData(unsigned long identifier, Frame*);
+ void willReceiveResourceData(unsigned long identifier, Frame*, int length);
void didReceiveResourceData();
void didRequestAnimationFrame(int callbackId, Frame*);
return data.release();
}
-PassRefPtr<InspectorObject> TimelineRecordFactory::createReceiveResourceData(const String& requestId)
+PassRefPtr<InspectorObject> TimelineRecordFactory::createReceiveResourceData(const String& requestId, int length)
{
RefPtr<InspectorObject> data = InspectorObject::create();
data->setString("requestId", requestId);
+ data->setNumber("encodedDataLength", length);
return data.release();
}
static PassRefPtr<InspectorObject> createResourceReceiveResponseData(const String& requestId, const ResourceResponse&);
- static PassRefPtr<InspectorObject> createReceiveResourceData(const String& requestId);
+ static PassRefPtr<InspectorObject> createReceiveResourceData(const String& requestId, int length);
static PassRefPtr<InspectorObject> createResourceFinishData(const String& requestId, bool didFail, double finishTime);
contentHelper._appendTextRow(WebInspector.UIString("Status Code"), this.data["statusCode"]);
if (this.data["mimeType"])
contentHelper._appendTextRow(WebInspector.UIString("MIME Type"), this.data["mimeType"]);
+ if (this.data["encodedDataLength"])
+ contentHelper._appendTextRow(WebInspector.UIString("Encoded Data Length"), WebInspector.UIString("%d Bytes", this.data["encodedDataLength"]));
break;
case recordTypes.EvaluateScript:
if (this.data && this.url)
void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int encodedDataLength)
{
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier());
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier(), encodedDataLength);
didReceiveData(data, length, encodedDataLength, false);
InspectorInstrumentation::didReceiveResourceData(cookie);
}