Source/WebCore: [Web Inspector]Add WebSocket networking events in Timeline panel.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 09:04:02 +0000 (09:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 09:04:02 +0000 (09:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105527.

Patch by Pan Deng <pan.deng@intel.com> on 2013-02-21
Reviewed by Pavel Feldman.

This patch add four WebSocket networking events in Timeline panel. The Events
are CreateWebSocket, SendWebSocketHandshakeRequest, ReceiveWebSocketHandShakeResponse
and DestoryWebSocket. Thanks to Kitamura san's previous work.

Test: http/tests/inspector/websocket/timeline-websocket-event.html

* English.lproj/localizedStrings.js:
* Modules/websockets/WebSocketChannel.cpp: Add protocol information
(WebCore::WebSocketChannel::connect):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didCreateWebSocketImpl): Add Timeline agent instrumentation for websocket
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl): Ditto
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl): Ditto
(WebCore::InspectorInstrumentation::didCloseWebSocketImpl): Ditto
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::didCreateWebSocket):
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorInstrumentation::didCloseWebSocket):
* inspector/InspectorTimelineAgent.cpp:
(TimelineRecordType):
(WebCore):
(WebCore::InspectorTimelineAgent::didCreateWebSocket): Add Timeline record for websocket create
(WebCore::InspectorTimelineAgent::addWebSocketRecord): Add general websocket record
(WebCore::InspectorTimelineAgent::willSendWebSocketHandshakeRequest): Add Timeline record for websocket handshake request send
(WebCore::InspectorTimelineAgent::didReceiveWebSocketHandshakeResponse): Add Timeline record for websocket handshake response receive
(WebCore::InspectorTimelineAgent::didDestroyWebSocket): Add Timeline record for websocket destroy
* inspector/InspectorTimelineAgent.h:
(WebCore):
(InspectorTimelineAgent):
* inspector/TimelineRecordFactory.h:
(TimelineRecordFactory):
(WebCore::TimelineRecordFactory::createWebSocketCreateData):
(WebCore::TimelineRecordFactory::createGenericWebSocketData):
* inspector/front-end/TimelineModel.js: Add Timeline record type for websocket
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel._initRecordStyles):
(WebInspector.TimelinePresentationModel.prototype.reset): Add slot to store WebSocket Create record
(WebInspector.TimelinePresentationModel.Record):
(WebInspector.TimelinePresentationModel.Record.prototype._generatePopupContentWithImagePreview): Add PopupContent for websocket record, including url and protocol

LayoutTests: [Web Inspector]Add WebSocket networking events in WebInspector Timeline panel.
https://bugs.webkit.org/show_bug.cgi?id=105527.

Patch by Pan Deng <pan.deng@intel.com> on 2013-02-21
Reviewed by Pavel Feldman.

This change add the record event type to test expections. The Events are CreateWebSocket,
SendWebSocketHandshakeRequest, ReceiveWebSocketHandShakeResponse and DestoryWebSocket.
timeline-test.js was moved to http folder, since new added websocket test need it from server side.

* http/tests/inspector/timeline-test.js: Renamed from LayoutTests/inspector/timeline/timeline-test.js.
(initialize_Timeline.InspectorTest.startTimeline.addRecord):
(initialize_Timeline.InspectorTest.startTimeline):
(initialize_Timeline.addRecord):
(initialize_Timeline.InspectorTest.waitForRecordType):
(initialize_Timeline.InspectorTest.stopTimeline):
(initialize_Timeline.step1):
(initialize_Timeline.step2):
(initialize_Timeline.InspectorTest.evaluateWithTimeline):
(initialize_Timeline.):
(initialize_Timeline.InspectorTest.performActionsAndPrint):
(initialize_Timeline.InspectorTest.printTimelineRecords):
(initialize_Timeline.InspectorTest.printTimestampRecords):
(initialize_Timeline.InspectorTest.innerPrintTimelineRecords):
(initialize_Timeline.InspectorTest.dumpTimelineRecord):
(initialize_Timeline.InspectorTest.dumpTimelineRecords):
(initialize_Timeline.InspectorTest.printTimelineRecordProperties):
(initialize_Timeline.InspectorTest._timelineAgentTypeToString):
(initialize_Timeline.InspectorTest.findPresentationRecord.findByType):
(initialize_Timeline.InspectorTest.findPresentationRecord):
(initialize_Timeline.InspectorTest.FakeFileReader):
(initialize_Timeline.InspectorTest.FakeFileReader.prototype.start):
(initialize_Timeline.InspectorTest.FakeFileReader.prototype.cancel):
(initialize_Timeline.InspectorTest.FakeFileReader.prototype.loadedSize):
(initialize_Timeline.InspectorTest.FakeFileReader.prototype.fileSize):
(initialize_Timeline.InspectorTest.FakeFileReader.prototype.fileName):
(initialize_Timeline.InspectorTest):
(initialize_Timeline):
* http/tests/inspector/websocket/timeline-websocket-event-expected.txt: Added.
* http/tests/inspector/websocket/timeline-websocket-event.html: Added.
* inspector/timeline/timeline-animation-frame.html: Modify address of script "timeline-test.js"
* inspector/timeline/timeline-decode-resize.html:
* inspector/timeline/timeline-dom-content-loaded-event.html:
* inspector/timeline/timeline-enum-stability-expected.txt:
* inspector/timeline/timeline-event-dispatch.html:
* inspector/timeline/timeline-frames.html:
* inspector/timeline/timeline-injected-script-eval.html:
* inspector/timeline/timeline-layout-reason.html:
* inspector/timeline/timeline-layout.html:
* inspector/timeline/timeline-load-event.html:
* inspector/timeline/timeline-load.html:
* inspector/timeline/timeline-mark-timeline.html:
* inspector/timeline/timeline-network-received-data.html:
* inspector/timeline/timeline-network-resource.html:
* inspector/timeline/timeline-paint.html:
* inspector/timeline/timeline-parse-html.html:
* inspector/timeline/timeline-recalculate-styles.html:
* inspector/timeline/timeline-receive-response-event.html:
* inspector/timeline/timeline-script-tag-1.html:
* inspector/timeline/timeline-script-tag-2.html:
* inspector/timeline/timeline-start-time.html:
* inspector/timeline/timeline-time-stamp.html:
* inspector/timeline/timeline-time.html:
* inspector/timeline/timeline-timer-fired-from-eval-call-site.html:
* inspector/timeline/timeline-timer.html:
* inspector/timeline/timeline-trivial.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143573 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/timeline-test.js [moved from LayoutTests/inspector/timeline/timeline-test.js with 98% similarity]
LayoutTests/http/tests/inspector/websocket/timeline-websocket-event-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/websocket/timeline-websocket-event.html [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-animation-frame.html
LayoutTests/inspector/timeline/timeline-decode-resize.html
LayoutTests/inspector/timeline/timeline-dom-content-loaded-event.html
LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt
LayoutTests/inspector/timeline/timeline-event-dispatch.html
LayoutTests/inspector/timeline/timeline-frames.html
LayoutTests/inspector/timeline/timeline-injected-script-eval.html
LayoutTests/inspector/timeline/timeline-layout-reason.html
LayoutTests/inspector/timeline/timeline-layout.html
LayoutTests/inspector/timeline/timeline-load-event.html
LayoutTests/inspector/timeline/timeline-load.html
LayoutTests/inspector/timeline/timeline-mark-timeline.html
LayoutTests/inspector/timeline/timeline-network-received-data.html
LayoutTests/inspector/timeline/timeline-network-resource.html
LayoutTests/inspector/timeline/timeline-paint.html
LayoutTests/inspector/timeline/timeline-parse-html.html
LayoutTests/inspector/timeline/timeline-recalculate-styles.html
LayoutTests/inspector/timeline/timeline-receive-response-event.html
LayoutTests/inspector/timeline/timeline-script-tag-1.html
LayoutTests/inspector/timeline/timeline-script-tag-2.html
LayoutTests/inspector/timeline/timeline-start-time.html
LayoutTests/inspector/timeline/timeline-time-stamp.html
LayoutTests/inspector/timeline/timeline-time.html
LayoutTests/inspector/timeline/timeline-timer-fired-from-eval-call-site.html
LayoutTests/inspector/timeline/timeline-timer.html
LayoutTests/inspector/timeline/timeline-trivial.html
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/Modules/websockets/WebSocketChannel.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h
Source/WebCore/inspector/TimelineRecordFactory.h
Source/WebCore/inspector/front-end/TimelineModel.js
Source/WebCore/inspector/front-end/TimelinePresentationModel.js

index 834211731ab298838c5b9fa3ac5c2cf26a350875..578700965cea8e6701ea219e5a3d30c0d9e7dd2b 100644 (file)
@@ -1,3 +1,71 @@
+2013-02-21  Pan Deng  <pan.deng@intel.com>
+
+        [Web Inspector]Add WebSocket networking events in WebInspector Timeline panel.
+        https://bugs.webkit.org/show_bug.cgi?id=105527.
+
+        Reviewed by Pavel Feldman.
+
+        This change add the record event type to test expections. The Events are CreateWebSocket, 
+        SendWebSocketHandshakeRequest, ReceiveWebSocketHandShakeResponse and DestoryWebSocket.
+        timeline-test.js was moved to http folder, since new added websocket test need it from server side.
+
+        * http/tests/inspector/timeline-test.js: Renamed from LayoutTests/inspector/timeline/timeline-test.js.
+        (initialize_Timeline.InspectorTest.startTimeline.addRecord):
+        (initialize_Timeline.InspectorTest.startTimeline):
+        (initialize_Timeline.addRecord):
+        (initialize_Timeline.InspectorTest.waitForRecordType):
+        (initialize_Timeline.InspectorTest.stopTimeline):
+        (initialize_Timeline.step1):
+        (initialize_Timeline.step2):
+        (initialize_Timeline.InspectorTest.evaluateWithTimeline):
+        (initialize_Timeline.):
+        (initialize_Timeline.InspectorTest.performActionsAndPrint):
+        (initialize_Timeline.InspectorTest.printTimelineRecords):
+        (initialize_Timeline.InspectorTest.printTimestampRecords):
+        (initialize_Timeline.InspectorTest.innerPrintTimelineRecords):
+        (initialize_Timeline.InspectorTest.dumpTimelineRecord):
+        (initialize_Timeline.InspectorTest.dumpTimelineRecords):
+        (initialize_Timeline.InspectorTest.printTimelineRecordProperties):
+        (initialize_Timeline.InspectorTest._timelineAgentTypeToString):
+        (initialize_Timeline.InspectorTest.findPresentationRecord.findByType):
+        (initialize_Timeline.InspectorTest.findPresentationRecord):
+        (initialize_Timeline.InspectorTest.FakeFileReader):
+        (initialize_Timeline.InspectorTest.FakeFileReader.prototype.start):
+        (initialize_Timeline.InspectorTest.FakeFileReader.prototype.cancel):
+        (initialize_Timeline.InspectorTest.FakeFileReader.prototype.loadedSize):
+        (initialize_Timeline.InspectorTest.FakeFileReader.prototype.fileSize):
+        (initialize_Timeline.InspectorTest.FakeFileReader.prototype.fileName):
+        (initialize_Timeline.InspectorTest):
+        (initialize_Timeline):
+        * http/tests/inspector/websocket/timeline-websocket-event-expected.txt: Added.
+        * http/tests/inspector/websocket/timeline-websocket-event.html: Added.
+        * inspector/timeline/timeline-animation-frame.html: Modify address of script "timeline-test.js"
+        * inspector/timeline/timeline-decode-resize.html:
+        * inspector/timeline/timeline-dom-content-loaded-event.html:
+        * inspector/timeline/timeline-enum-stability-expected.txt:
+        * inspector/timeline/timeline-event-dispatch.html:
+        * inspector/timeline/timeline-frames.html:
+        * inspector/timeline/timeline-injected-script-eval.html:
+        * inspector/timeline/timeline-layout-reason.html:
+        * inspector/timeline/timeline-layout.html:
+        * inspector/timeline/timeline-load-event.html:
+        * inspector/timeline/timeline-load.html:
+        * inspector/timeline/timeline-mark-timeline.html:
+        * inspector/timeline/timeline-network-received-data.html:
+        * inspector/timeline/timeline-network-resource.html:
+        * inspector/timeline/timeline-paint.html:
+        * inspector/timeline/timeline-parse-html.html:
+        * inspector/timeline/timeline-recalculate-styles.html:
+        * inspector/timeline/timeline-receive-response-event.html:
+        * inspector/timeline/timeline-script-tag-1.html:
+        * inspector/timeline/timeline-script-tag-2.html:
+        * inspector/timeline/timeline-start-time.html:
+        * inspector/timeline/timeline-time-stamp.html:
+        * inspector/timeline/timeline-time.html:
+        * inspector/timeline/timeline-timer-fired-from-eval-call-site.html:
+        * inspector/timeline/timeline-timer.html:
+        * inspector/timeline/timeline-trivial.html:
+
 2013-02-21  Nils Barth  <nbarth@google.com>
 
         File upload control doesn't apply CSS vertical padding or border to file name
similarity index 98%
rename from LayoutTests/inspector/timeline/timeline-test.js
rename to LayoutTests/http/tests/inspector/timeline-test.js
index d2b9dc12d03286c2c285636a47c8116d8d943f79..4e1f72446a9817d5a461b00880819a762211a0d9 100644 (file)
@@ -20,7 +20,8 @@ InspectorTest.timelinePropertyFormatters = {
     scriptLine: "formatAsTypeName",
     lineNumber: "formatAsTypeName",
     frameId: "formatAsTypeName",
-    encodedDataLength: "formatAsTypeName"
+    encodedDataLength: "formatAsTypeName",
+    identifier: "formatAsTypeName"    
 };
 
 InspectorTest.startTimeline = function(callback)
diff --git a/LayoutTests/http/tests/inspector/websocket/timeline-websocket-event-expected.txt b/LayoutTests/http/tests/inspector/websocket/timeline-websocket-event-expected.txt
new file mode 100644 (file)
index 0000000..9f4f0d9
--- /dev/null
@@ -0,0 +1,49 @@
+Tests the Timeline events for WebSocket
+
+WebSocketCreate Properties:
+{
+    counters : <object>
+    data : {
+        identifier : <number>
+        url : <string>
+    }
+    frameId : <string>
+    stackTrace : <object>
+    startTime : <number>
+    type : "WebSocketCreate"
+    usedHeapSize : <number>
+}
+WebSocketSendHandshakeRequest Properties:
+{
+    counters : <object>
+    data : {
+        identifier : <number>
+    }
+    frameId : <string>
+    startTime : <number>
+    type : "WebSocketSendHandshakeRequest"
+    usedHeapSize : <number>
+}
+WebSocketReceiveHandshakeResponse Properties:
+{
+    counters : <object>
+    data : {
+        identifier : <number>
+    }
+    frameId : <string>
+    startTime : <number>
+    type : "WebSocketReceiveHandshakeResponse"
+    usedHeapSize : <number>
+}
+WebSocketDestroy Properties:
+{
+    counters : <object>
+    data : {
+        identifier : <number>
+    }
+    frameId : <string>
+    startTime : <number>
+    type : "WebSocketDestroy"
+    usedHeapSize : <number>
+}
+
diff --git a/LayoutTests/http/tests/inspector/websocket/timeline-websocket-event.html b/LayoutTests/http/tests/inspector/websocket/timeline-websocket-event.html
new file mode 100644 (file)
index 0000000..447760a
--- /dev/null
@@ -0,0 +1,44 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../timeline-test.js"></script>
+<script>
+
+function performActions()
+{
+    var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/simple");
+
+    testRunner.display();
+}
+
+function test()
+{
+    InspectorTest.startTimeline(function() {
+        InspectorTest.evaluateInPage("performActions()");
+    });
+
+    InspectorTest.waitForRecordType("WebSocketDestroy", finish);
+
+    function finish()
+    {
+        InspectorTest.printTimelineRecords("WebSocketCreate");
+        InspectorTest.printTimelineRecords("WebSocketSendHandshakeRequest");
+        InspectorTest.printTimelineRecords("WebSocketReceiveHandshakeResponse");
+        InspectorTest.printTimelineRecords("WebSocketDestroy");
+        InspectorTest.completeTest();
+    }
+}
+
+if (!window.testRunner)
+    setTimeout(performActions, 2000);
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests the Timeline events for WebSocket
+</p>
+
+</body>
+</html>
index 09af677e0022228bacb0003b294909741243bfab..6ea029e24f76053838125097061d7f4e2b40689c 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index e169deb004e7e3d481a321c62411d5651cda809d..8a4689e8b4b31b3ec1aab311431b83b82ee5a78c 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function addImage(src, width, height, callback)
index c25c0ce7e812895e605a74c2db13aa948461e987..9e6f47ce11cdb9128fadee9333886f2dc168f681 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function test()
index 10e03f7712da9a966d341e8bc4c2aa7d0f64de73..d57b5261f0710b852a4f360115e9739f76591985 100644 (file)
@@ -36,6 +36,10 @@ Applications outside of WebKit depend on the stability of the mapping of these t
     TimerFire : "TimerFire"
     TimerInstall : "TimerInstall"
     TimerRemove : "TimerRemove"
+    WebSocketCreate : "WebSocketCreate"
+    WebSocketDestroy : "WebSocketDestroy"
+    WebSocketReceiveHandshakeResponse : "WebSocketReceiveHandshakeResponse"
+    WebSocketSendHandshakeRequest : "WebSocketSendHandshakeRequest"
     XHRLoad : "XHRLoad"
     XHRReadyStateChange : "XHRReadyStateChange"
 }
index 9265f369096c5584d80e71a14b3aa33277b14d67..399fab610983ac8c604eb63ca8ad219899c6c14d 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function handleMouseDown(event) 
index 3c1dc16d3837f614d6e14590493f74616924eacf..273245ce231c82d2eba5e77eb3154c2c86756572 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 2d984bd74466607b19879514cbd4284b45ba48e0..b7bea026060c4c5938974e89d9d18fb10546bd46 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 095b226b90566b14d7dd36a2b1a10a6d1067afd0..84280a4a35d90840234fb2375382808a936db857 100644 (file)
@@ -4,7 +4,7 @@
 </style>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function invalidateStyle()
index b590b31d614a3d188a1e76c5451b144c95307e64..cb8b95368f1b5c14af7bea78cfc5143407a6167e 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 0dc4904e45484a786f7b471577038aab9d1ff76f..488654bf89263e82515fc312146ac5736025e80e 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function test()
index b26ebcdc1225ac307852f61f1b18b1f0ef2bfc32..f07e697627eb6be76d9bcc66424726d70480ff77 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function test()
index c0d487e8c3203f95ea2bb72caa98fe4a07fa10a1..837bd5e61532260aaf330abec7d1c508168c8dba 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 4b8ccff1b46d66d7e27d8aa3be5174ade9316799..1bfb88a818b3f0eb432b4231acced78259488440 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 var scriptUrl = "timeline-network-resource.js";
index 6b845e78c0a68f886096a2f26a25c2e9150a6bcf..da12b5b003ff1de4d315daaa57ce51989b29b9ca 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 var scriptUrl = "timeline-network-resource.js";
index b54c22852b5658fcd5d85f4a5ac9fbb0073abcb2..1a3fd96ed643b61b2e82988295b06e8849e54f90 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 60cdfd296466e47f4a21a92c796f6521c7b87b8c..62621a4f63541adf474a3b15fbfa850e3d73e034 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index db7a7f94b319294821daf395d8692a72c650814f..576a3730ea32f599139b1827abcbb46050714cdd 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 
 <style>
 .test-style {
index a44b8c52d42f5f2445da3fa122abeea42eab4aec..501e9fbe421eee9492b36070c27295267da9a018 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index efcd004e6ca142681278ec2eb658b7331b30f747..7fa281c5ad562dd4fbdef208b5368f52b2644610 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 3e8f18e8f4314b89c4dd3d7f07a07ac574ed81ec..8f6beabe9b6384f34c3d54d97208ddfa00c2fd12 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 3ac8e36b85e109958ce3b1c88f20b80aa00d6e29..ec237cb8e4deee1a923a63b44d9bb4a7fb595adf 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index d9eb23b79565c699c8cbf53829916c85f27753cc..6469260c06c40fb0898aef39828570833dab76dc 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index dbb0841448beab96271ebda6271ed351b62cd7f7..ce4ac4afa2b40ff6c9f9c61859af6de8ad9dc736 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function test()
index 2e7cf1c2c0e28b43199872bd6760dcec8cd256ef..2b534c5d6c5eaa92b78db0ecb9eee692844d07f3 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index 3c38c68912e80304538fc551ebd73a89edc4f698..51ae6fc8b6f217acaf155ebb690c5737f9f77cce 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function performActions()
index e7df8984bb1c1307ae4c543913c5217a31e00618..e0fd6c65c8235daa31f759398a21cb1a4834c4e8 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
-<script src="timeline-test.js"></script>
+<script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
 function test() {
index 2b29bf0f7831e66bc5936b1dad91bc53f8a355c2..392271f61a8db3c980d2d17670e4a36976c92aef 100644 (file)
@@ -1,3 +1,53 @@
+2013-02-21  Pan Deng  <pan.deng@intel.com>
+
+        [Web Inspector]Add WebSocket networking events in Timeline panel.
+        https://bugs.webkit.org/show_bug.cgi?id=105527.
+
+        Reviewed by Pavel Feldman.
+
+        This patch add four WebSocket networking events in Timeline panel. The Events
+        are CreateWebSocket, SendWebSocketHandshakeRequest, ReceiveWebSocketHandShakeResponse
+        and DestoryWebSocket. Thanks to Kitamura san's previous work.
+
+        Test: http/tests/inspector/websocket/timeline-websocket-event.html
+
+        * English.lproj/localizedStrings.js:
+        * Modules/websockets/WebSocketChannel.cpp: Add protocol information
+        (WebCore::WebSocketChannel::connect):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::didCreateWebSocketImpl): Add Timeline agent instrumentation for websocket
+        (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl): Ditto
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl): Ditto
+        (WebCore::InspectorInstrumentation::didCloseWebSocketImpl): Ditto
+        * inspector/InspectorInstrumentation.h:
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::didCreateWebSocket):
+        (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
+        (WebCore::InspectorInstrumentation::didCloseWebSocket):
+        * inspector/InspectorTimelineAgent.cpp:
+        (TimelineRecordType):
+        (WebCore):
+        (WebCore::InspectorTimelineAgent::didCreateWebSocket): Add Timeline record for websocket create
+        (WebCore::InspectorTimelineAgent::addWebSocketRecord): Add general websocket record
+        (WebCore::InspectorTimelineAgent::willSendWebSocketHandshakeRequest): Add Timeline record for websocket handshake request send
+        (WebCore::InspectorTimelineAgent::didReceiveWebSocketHandshakeResponse): Add Timeline record for websocket handshake response receive
+        (WebCore::InspectorTimelineAgent::didDestroyWebSocket): Add Timeline record for websocket destroy
+        * inspector/InspectorTimelineAgent.h:
+        (WebCore):
+        (InspectorTimelineAgent):
+        * inspector/TimelineRecordFactory.h:
+        (TimelineRecordFactory):
+        (WebCore::TimelineRecordFactory::createWebSocketCreateData):
+        (WebCore::TimelineRecordFactory::createGenericWebSocketData):
+        * inspector/front-end/TimelineModel.js: Add Timeline record type for websocket
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel._initRecordStyles):
+        (WebInspector.TimelinePresentationModel.prototype.reset): Add slot to store WebSocket Create record
+        (WebInspector.TimelinePresentationModel.Record):
+        (WebInspector.TimelinePresentationModel.Record.prototype._generatePopupContentWithImagePreview): Add PopupContent for websocket record, including url and protocol
+
 2013-02-21  Oswald Buddenhagen  <oswald.buddenhagen@digia.com>
 
         [Qt] Fix pkg-config dependencies of QtWebKit itself
index f3b962a42906e6c235d318c6c5deb0d56782d655..119ab28a9598a029007c0324d6be5f7a3c3a7a71 100644 (file)
@@ -864,3 +864,8 @@ localizedStrings["Mappings"] = "Mappings";
 localizedStrings["Add"] = "Add";
 localizedStrings["Object state below is captured upon first expansion"] = "Object state below is captured upon first expansion";
 localizedStrings["(index)"] = "(index)";
+localizedStrings["WebSocket Protocol"] = "WebSocket Protocol";
+localizedStrings["Create WebSocket"] = "Create WebSocket";
+localizedStrings["Send WebSocket Handshake"] = "Send WebSocket Handshake";
+localizedStrings["Receive WebSocket Handshake"] = "Receive WebSocket Handshake";
+localizedStrings["Destroy WebSocket"] = "Destroy WebSocket";
index dcb5b153a9dcf8641af5f239eb1821cfe5f5a9d4..ccd60e79b3b10aa33eb91d4c96d5432703fb71fd 100644 (file)
@@ -108,7 +108,7 @@ void WebSocketChannel::connect(const KURL& url, const String& protocol)
     if (m_deflateFramer.canDeflate())
         m_handshake->addExtensionProcessor(m_deflateFramer.createExtensionProcessor());
     if (m_identifier)
-        InspectorInstrumentation::didCreateWebSocket(m_document, m_identifier, url, m_document->url());
+        InspectorInstrumentation::didCreateWebSocket(m_document, m_identifier, url, m_document->url(), protocol);
     ref();
     m_handle = SocketStreamHandle::create(m_handshake->url(), this);
 }
index 5aaab18ac67c42a38668707d8ce54f24e1e3c55c..bb4d84ddf57db3881e191353437fbb17572c1caf 100644 (file)
@@ -1151,32 +1151,41 @@ void InspectorInstrumentation::workerContextTerminatedImpl(InstrumentingAgents*
 #endif
 
 #if ENABLE(WEB_SOCKETS)
-void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const KURL& requestURL, const KURL&)
+void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const KURL& requestURL, const KURL&, const String& protocol, Document* document)
 {
     InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
     if (!inspectorAgent || !inspectorAgent->developerExtrasEnabled())
         return;
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->didCreateWebSocket(identifier, requestURL);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didCreateWebSocket(identifier, requestURL, protocol, document->frame());
 }
 
-void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketHandshakeRequest& request)
+void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketHandshakeRequest& request, Document* document)
 {
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->willSendWebSocketHandshakeRequest(identifier, document->frame());
 }
 
-void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketHandshakeResponse& response)
+void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketHandshakeResponse& response, Document* document)
 {
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didReceiveWebSocketHandshakeResponse(identifier, document->frame());
 }
 
-void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
+void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Document* document)
 {
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->didCloseWebSocket(identifier);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didDestroyWebSocket(identifier, document->frame());
 }
+
 void InspectorInstrumentation::didReceiveWebSocketFrameImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
 {
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
index ff6300516ef10334b0022109cfedb36f3d612f3a..e23357fe6b639facb7f6ac7fce11499b8c9d2b93 100644 (file)
@@ -263,7 +263,7 @@ public:
 #endif
 
 #if ENABLE(WEB_SOCKETS)
-    static void didCreateWebSocket(Document*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
+    static void didCreateWebSocket(Document*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL, const String& protocol);
     static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const WebSocketHandshakeRequest&);
     static void didReceiveWebSocketHandshakeResponse(Document*, unsigned long identifier, const WebSocketHandshakeResponse&);
     static void didCloseWebSocket(Document*, unsigned long identifier);
@@ -461,10 +461,10 @@ private:
 #endif
 
 #if ENABLE(WEB_SOCKETS)
-    static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
-    static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeRequest&);
-    static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeResponse&);
-    static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier);
+    static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL, const String& protocol, Document*);
+    static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeRequest&, Document*);
+    static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeResponse&, Document*);
+    static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier, Document*);
     static void didReceiveWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
     static void didSendWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
     static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents*, unsigned long identifier, const String&);
@@ -1819,16 +1819,17 @@ inline void InspectorInstrumentation::workerContextTerminated(ScriptExecutionCon
 
 
 #if ENABLE(WEB_SOCKETS)
-inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
+inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const KURL& documentURL, const String& protocol)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL);
+        didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL, protocol, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
     UNUSED_PARAM(requestURL);
     UNUSED_PARAM(documentURL);
+    UNUSED_PARAM(protocol);
 #endif
 }
 
@@ -1836,7 +1837,7 @@ inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request);
+        willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1848,7 +1849,7 @@ inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Docum
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response);
+        didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1860,7 +1861,7 @@ inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsi
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didCloseWebSocketImpl(instrumentingAgents, identifier);
+        didCloseWebSocketImpl(instrumentingAgents, identifier, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
index 97e14697f3176815d099a62186034c74bc2ceba9..116056e9665d8f76bbe7a4e8a32b5e2c8d9530ac 100644 (file)
@@ -111,6 +111,11 @@ static const char GCEvent[] = "GCEvent";
 static const char RequestAnimationFrame[] = "RequestAnimationFrame";
 static const char CancelAnimationFrame[] = "CancelAnimationFrame";
 static const char FireAnimationFrame[] = "FireAnimationFrame";
+
+static const char WebSocketCreate[] = "WebSocketCreate";
+static const char WebSocketSendHandshakeRequest[] = "WebSocketSendHandshakeRequest";
+static const char WebSocketReceiveHandshakeResponse[] = "WebSocketReceiveHandshakeResponse";
+static const char WebSocketDestroy[] = "WebSocketDestroy";
 }
 
 void InspectorTimelineAgent::pushGCEventRecords()
@@ -491,6 +496,45 @@ void InspectorTimelineAgent::didProcessTask()
     didCompleteCurrentRecord(TimelineRecordType::Program);
 }
 
+#if ENABLE(WEB_SOCKETS)
+void InspectorTimelineAgent::didCreateWebSocket(unsigned long identifier, const KURL& url, const String& protocol, Frame* frame)
+{
+    pushGCEventRecords();
+    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
+    record->setObject("data", TimelineRecordFactory::createWebSocketCreateData(identifier, url, protocol));
+    String frameId;
+    if (frame && m_pageAgent)
+        frameId = m_pageAgent->frameId(frame);
+    addRecordToTimeline(record.release(), TimelineRecordType::WebSocketCreate, frameId);
+}
+
+void InspectorTimelineAgent::addWebSocketRecord(unsigned long identifier, Frame* frame, const String& type)
+{
+    pushGCEventRecords();
+    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
+    record->setObject("data", TimelineRecordFactory::createGenericWebSocketData(identifier));
+    String frameId;
+    if (frame && m_pageAgent)
+        frameId = m_pageAgent->frameId(frame);
+    addRecordToTimeline(record.release(), type, frameId);
+}
+
+void InspectorTimelineAgent::willSendWebSocketHandshakeRequest(unsigned long identifier, Frame* frame)
+{
+    addWebSocketRecord(identifier, frame, TimelineRecordType::WebSocketSendHandshakeRequest);
+}
+
+void InspectorTimelineAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, Frame* frame)
+{
+    addWebSocketRecord(identifier, frame, TimelineRecordType::WebSocketReceiveHandshakeResponse);
+}
+
+void InspectorTimelineAgent::didDestroyWebSocket(unsigned long identifier, Frame* frame)
+{
+    addWebSocketRecord(identifier, frame, TimelineRecordType::WebSocketDestroy);
+}
+#endif // ENABLE(WEB_SOCKETS)
+
 void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> record, const String& type, const String& frameId)
 {
     commitFrameRecord();
index 4c5a0d3575e9c4c258aa4af4f55015ff1846c09c..bc13b302a6cf5397e1c9683544453697b49cc76d 100644 (file)
@@ -53,6 +53,7 @@ class InspectorPageAgent;
 class InspectorState;
 class InstrumentingAgents;
 class IntRect;
+class KURL;
 class RenderObject;
 class ResourceRequest;
 class ResourceResponse;
@@ -158,6 +159,13 @@ public:
     void willProcessTask();
     void didProcessTask();
 
+#if ENABLE(WEB_SOCKETS)
+    void didCreateWebSocket(unsigned long identifier, const KURL&, const String& protocol, Frame*);
+    void willSendWebSocketHandshakeRequest(unsigned long identifier, Frame*);
+    void didReceiveWebSocketHandshakeResponse(unsigned long identifier, Frame*);
+    void didDestroyWebSocket(unsigned long identifier, Frame*);
+#endif
+
     // ScriptGCEventListener methods.
     virtual void didGC(double, double, size_t);
 
@@ -196,6 +204,10 @@ private:
     void pushGCEventRecords();
     void clearRecordStack();
 
+#if ENABLE(WEB_SOCKETS)
+    void addWebSocketRecord(unsigned long, Frame*, const String&);
+#endif
+
     double timestamp();
     double timestampFromMicroseconds(double microseconds);
 
index eeee67203325335b7845347083e8424bdfb9c3d7..ef5dd56d129debe8700997fdd8a6df60cdd610c0 100644 (file)
 #ifndef TimelineRecordFactory_h
 #define TimelineRecordFactory_h
 
+#include "InspectorValues.h"
+#include "KURL.h"
 #include "LayoutRect.h"
 #include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -85,6 +88,25 @@ namespace WebCore {
 
         static PassRefPtr<InspectorObject> createAnimationFrameData(int callbackId);
 
+#if ENABLE(WEB_SOCKETS)
+        static inline PassRefPtr<InspectorObject> createWebSocketCreateData(unsigned long identifier, const KURL& url, const String& protocol)
+        {
+            RefPtr<InspectorObject> data = InspectorObject::create();
+            data->setNumber("identifier", identifier);
+            data->setString("url", url.string());
+            if (!protocol.isNull())
+                data->setString("webSocketProtocol", protocol);
+            return data.release();
+        }
+
+        static inline PassRefPtr<InspectorObject> createGenericWebSocketData(unsigned long identifier)
+        {
+            RefPtr<InspectorObject> data = InspectorObject::create();
+            data->setNumber("identifier", identifier);
+            return data.release();
+        }
+#endif
+
     private:
         TimelineRecordFactory() { }
     };
index d729c5cece5830ada8afed16b2ed1b17b0adbafd..6dad21dcc6cf0a90518caf71b37b61198b6a7973 100644 (file)
@@ -89,7 +89,12 @@ WebInspector.TimelineModel.RecordType = {
 
     RequestAnimationFrame: "RequestAnimationFrame",
     CancelAnimationFrame: "CancelAnimationFrame",
-    FireAnimationFrame: "FireAnimationFrame"
+    FireAnimationFrame: "FireAnimationFrame",
+
+    WebSocketCreate : "WebSocketCreate",
+    WebSocketSendHandshakeRequest : "WebSocketSendHandshakeRequest",
+    WebSocketReceiveHandshakeResponse : "WebSocketReceiveHandshakeResponse",
+    WebSocketDestroy : "WebSocketDestroy",
 }
 
 WebInspector.TimelineModel.Events = {
index 90bcfb653725298aeafdda52e1d8714730dd6dc8..e52c2e95b732873fbf5b7e3da63582ca7d21e59f 100644 (file)
@@ -102,6 +102,10 @@ WebInspector.TimelinePresentationModel._initRecordStyles = function()
     recordStyles[recordTypes.RequestAnimationFrame] = { title: WebInspector.UIString("Request Animation Frame"), category: categories["scripting"] };
     recordStyles[recordTypes.CancelAnimationFrame] = { title: WebInspector.UIString("Cancel Animation Frame"), category: categories["scripting"] };
     recordStyles[recordTypes.FireAnimationFrame] = { title: WebInspector.UIString("Animation Frame Fired"), category: categories["scripting"] };
+    recordStyles[recordTypes.WebSocketCreate] = { title: WebInspector.UIString("Create WebSocket"), category: categories["scripting"] };
+    recordStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspector.UIString("Send WebSocket Handshake"), category: categories["scripting"] };
+    recordStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebInspector.UIString("Receive WebSocket Handshake"), category: categories["scripting"] };
+    recordStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString("Destroy WebSocket"), category: categories["scripting"] };
 
     WebInspector.TimelinePresentationModel._recordStylesMap = recordStyles;
     return recordStyles;
@@ -267,6 +271,7 @@ WebInspector.TimelinePresentationModel.prototype = {
         this._minimumRecordTime = -1;
         this._layoutInvalidateStack = {};
         this._lastScheduleStyleRecalculation = {};
+        this._webSocketCreateRecords = {};
     },
 
     addFrame: function(frame)
@@ -658,6 +663,24 @@ WebInspector.TimelinePresentationModel.Record = function(presentationModel, reco
             this.setHasWarning();
         presentationModel._layoutInvalidateStack[this.frameId] = null;
         break;
+
+    case recordTypes.WebSocketCreate:
+        this.webSocketURL = record.data["url"];
+        if (typeof record.data["webSocketProtocol"] !== "undefined")
+            this.webSocketProtocol = record.data["webSocketProtocol"];
+        presentationModel._webSocketCreateRecords[record.data["identifier"]] = this;
+        break;
+   
+    case recordTypes.WebSocketSendHandshakeRequest:
+    case recordTypes.WebSocketReceiveHandshakeResponse:
+    case recordTypes.WebSocketDestroy:
+        var webSocketCreateRecord = presentationModel._webSocketCreateRecords[record.data["identifier"]];
+        if (webSocketCreateRecord) { // False if we started instrumentation in the middle of request.
+            this.webSocketURL = webSocketCreateRecord.webSocketURL;
+            if (typeof webSocketCreateRecord.webSocketProtocol !== "undefined")
+                this.webSocketProtocol = webSocketCreateRecord.webSocketProtocol;
+        }
+        break;
     }
 }
 
@@ -910,6 +933,17 @@ WebInspector.TimelinePresentationModel.Record.prototype = {
                 if (typeof this.intervalDuration === "number")
                     contentHelper._appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true));
                 break;
+            case recordTypes.WebSocketCreate:
+            case recordTypes.WebSocketSendHandshakeRequest:
+            case recordTypes.WebSocketReceiveHandshakeResponse:
+            case recordTypes.WebSocketDestroy:
+                if (typeof this.webSocketURL !== "undefined")
+                    contentHelper._appendTextRow(WebInspector.UIString("URL"), this.webSocketURL);
+                if (typeof this.webSocketProtocol !== "undefined")
+                    contentHelper._appendTextRow(WebInspector.UIString("WebSocket Protocol"), this.webSocketProtocol);
+                if (typeof this.data["message"] !== "undefined")
+                    contentHelper._appendTextRow(WebInspector.UIString("Message"), this.data["message"])
+                    break;
             default:
                 if (this.detailsNode())
                     contentHelper._appendElementRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].cloneNode());