Title: [121592] trunk
Revision
121592
Author
[email protected]
Date
2012-06-29 14:57:24 -0700 (Fri, 29 Jun 2012)

Log Message

Source/WebCore: 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 <[email protected]> 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 <[email protected]> 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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121591 => 121592)


--- trunk/LayoutTests/ChangeLog	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/LayoutTests/ChangeLog	2012-06-29 21:57:24 UTC (rev 121592)
@@ -1,3 +1,17 @@
+2012-06-29  Hanna Ma  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed chromium xp rebaseline.

Added: trunk/LayoutTests/inspector/timeline/timeline-network-received-data-expected.txt (0 => 121592)


--- trunk/LayoutTests/inspector/timeline/timeline-network-received-data-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-network-received-data-expected.txt	2012-06-29 21:57:24 UTC (rev 121592)
@@ -0,0 +1,6 @@
+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.
+

Added: trunk/LayoutTests/inspector/timeline/timeline-network-received-data.html (0 => 121592)


--- trunk/LayoutTests/inspector/timeline/timeline-network-received-data.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-network-received-data.html	2012-06-29 21:57:24 UTC (rev 121592)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+var scriptUrl = "timeline-network-resource.js";
+
+function performActions() 
+{
+    var image = new Image();
+    image.src = ""
+    var script = document.createElement("script");
+    script.src = ""
+    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>

Modified: trunk/LayoutTests/inspector/timeline/timeline-test.js (121591 => 121592)


--- trunk/LayoutTests/inspector/timeline/timeline-test.js	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/LayoutTests/inspector/timeline/timeline-test.js	2012-06-29 21:57:24 UTC (rev 121592)
@@ -19,7 +19,8 @@
     timerId: "formatAsTypeName",
     scriptLine: "formatAsTypeName",
     lineNumber: "formatAsTypeName",
-    frameId: "formatAsTypeName"
+    frameId: "formatAsTypeName",
+    encodedDataLength: "formatAsTypeName"
 };
 
 InspectorTest.startTimeline = function(callback)

Modified: trunk/Source/WebCore/ChangeLog (121591 => 121592)


--- trunk/Source/WebCore/ChangeLog	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/ChangeLog	2012-06-29 21:57:24 UTC (rev 121592)
@@ -1,3 +1,41 @@
+2012-06-29  Hanna Ma  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed build fix after 121580.

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (121591 => 121592)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-06-29 21:57:24 UTC (rev 121592)
@@ -706,3 +706,5 @@
 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";

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (121591 => 121592)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-06-29 21:57:24 UTC (rev 121592)
@@ -629,11 +629,11 @@
         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);

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (121591 => 121592)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2012-06-29 21:57:24 UTC (rev 121592)
@@ -165,7 +165,7 @@
     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&);
@@ -330,7 +330,7 @@
     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&);
@@ -1014,12 +1014,12 @@
 #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();
 }

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (121591 => 121592)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-06-29 21:57:24 UTC (rev 121592)
@@ -346,10 +346,10 @@
     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()

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (121591 => 121592)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-06-29 21:57:24 UTC (rev 121592)
@@ -130,7 +130,7 @@
     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*);

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (121591 => 121592)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2012-06-29 21:57:24 UTC (rev 121592)
@@ -161,10 +161,11 @@
     return data.release();
 }
 
-PassRefPtr<InspectorObject> TimelineRecordFactory::createReceiveResourceData(const String& requestId)
+PassRefPtr<InspectorObject> TimelineRecordFactory::createReceiveResourceData(const String& requestId, int length)
 {
     RefPtr<InspectorObject> data = ""
     data->setString("requestId", requestId);
+    data->setNumber("encodedDataLength", length);
     return data.release();
 }
     

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.h (121591 => 121592)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2012-06-29 21:57:24 UTC (rev 121592)
@@ -71,7 +71,7 @@
 
         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);
 

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (121591 => 121592)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-06-29 21:57:24 UTC (rev 121592)
@@ -515,6 +515,8 @@
                     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)

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (121591 => 121592)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-06-29 21:53:42 UTC (rev 121591)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-06-29 21:57:24 UTC (rev 121592)
@@ -425,7 +425,7 @@
 
 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);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to