Title: [130383] trunk
Revision
130383
Author
[email protected]
Date
2012-10-04 04:06:29 -0700 (Thu, 04 Oct 2012)

Log Message

Change RTCPeerConnection GetStats to use Date timestamp format
https://bugs.webkit.org/show_bug.cgi?id=98263

Patch by Harald Alvestrand <[email protected]> on 2012-10-04
Reviewed by Yury Semikhatsky.

Source/Platform:

* chromium/public/WebRTCStatsResponse.h:
(WebRTCStatsResponse):

Source/WebCore:

Tested by extension to RTCPeerConnection-stats test.

* Modules/mediastream/RTCStatsElement.cpp:
(WebCore::RTCStatsElement::create):
(WebCore::RTCStatsElement::RTCStatsElement):
* Modules/mediastream/RTCStatsElement.h: long -> double
(RTCStatsElement):
(WebCore::RTCStatsElement::timestamp):
* Modules/mediastream/RTCStatsElement.idl: long -> Date
* Modules/mediastream/RTCStatsReport.cpp:
(WebCore::RTCStatsReport::addElement):
* Modules/mediastream/RTCStatsReport.h:
(RTCStatsReport):
* Modules/mediastream/RTCStatsResponse.cpp:
(WebCore::RTCStatsResponse::addElement):
* Modules/mediastream/RTCStatsResponse.h:
(RTCStatsResponse):
* platform/chromium/support/WebRTCStatsResponse.cpp:
(WebKit::WebRTCStatsResponse::addElement):
* platform/mediastream/RTCStatsResponseBase.h:
(RTCStatsResponseBase):

Tools:

* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
(MockWebRTCPeerConnectionHandler::getStats):

LayoutTests:

* fast/mediastream/RTCPeerConnection-stats-expected.txt:
* fast/mediastream/RTCPeerConnection-stats.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (130382 => 130383)


--- trunk/LayoutTests/ChangeLog	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/LayoutTests/ChangeLog	2012-10-04 11:06:29 UTC (rev 130383)
@@ -1,3 +1,13 @@
+2012-10-04  Harald Alvestrand  <[email protected]>
+
+        Change RTCPeerConnection GetStats to use Date timestamp format
+        https://bugs.webkit.org/show_bug.cgi?id=98263
+
+        Reviewed by Yury Semikhatsky.
+
+        * fast/mediastream/RTCPeerConnection-stats-expected.txt:
+        * fast/mediastream/RTCPeerConnection-stats.html:
+
 2012-10-04  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r130377.

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt (130382 => 130383)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt	2012-10-04 11:06:29 UTC (rev 130383)
@@ -14,6 +14,7 @@
 PASS statsHandler2 was called
 PASS result.length is >= 2
 PASS local.length is 1
+PASS timestamp is >= startTime
 PASS local[0].stat("type") is "audio"
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html (130382 => 130383)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html	2012-10-04 11:06:29 UTC (rev 130383)
@@ -9,6 +9,7 @@
 
 var pc = null;
 var result;
+var timestamp;
 var local;
 
 function getUserMedia(dictionary, callback) {
@@ -49,10 +50,13 @@
     shouldBeGreaterThanOrEqual('result.length', '2');
     local = result[0].local();
     shouldBe('local.length', '1');
+    timestamp = local[0].timestamp;
+    shouldBeGreaterThanOrEqual('timestamp', 'startTime');
     shouldBe('local[0].stat("type")', '"audio"');
     finishJSTest();
 }
 
+var startTime = new Date().getTime();
 shouldNotThrow('pc = new webkitRTCPeerConnection(null)');
 shouldNotThrow('pc.getStats(statsHandler1)');
 

Modified: trunk/Source/Platform/ChangeLog (130382 => 130383)


--- trunk/Source/Platform/ChangeLog	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/Platform/ChangeLog	2012-10-04 11:06:29 UTC (rev 130383)
@@ -1,3 +1,13 @@
+2012-10-04  Harald Alvestrand  <[email protected]>
+
+        Change RTCPeerConnection GetStats to use Date timestamp format
+        https://bugs.webkit.org/show_bug.cgi?id=98263
+
+        Reviewed by Yury Semikhatsky.
+
+        * chromium/public/WebRTCStatsResponse.h:
+        (WebRTCStatsResponse):
+
 2012-10-04  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r130377.

Modified: trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h (130382 => 130383)


--- trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h	2012-10-04 11:06:29 UTC (rev 130383)
@@ -52,7 +52,7 @@
     WEBKIT_EXPORT void reset();
 
     WEBKIT_EXPORT size_t addReport();
-    WEBKIT_EXPORT size_t addElement(size_t report, bool isLocal, long timestamp);
+    WEBKIT_EXPORT size_t addElement(size_t report, bool isLocal, double timestamp);
     WEBKIT_EXPORT void addStatistic(size_t report, bool isLocal, size_t element, WebString name, WebString value);
 
 #if WEBKIT_IMPLEMENTATION

Modified: trunk/Source/WebCore/ChangeLog (130382 => 130383)


--- trunk/Source/WebCore/ChangeLog	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/ChangeLog	2012-10-04 11:06:29 UTC (rev 130383)
@@ -1,3 +1,32 @@
+2012-10-04  Harald Alvestrand  <[email protected]>
+
+        Change RTCPeerConnection GetStats to use Date timestamp format
+        https://bugs.webkit.org/show_bug.cgi?id=98263
+
+        Reviewed by Yury Semikhatsky.
+
+        Tested by extension to RTCPeerConnection-stats test.
+
+        * Modules/mediastream/RTCStatsElement.cpp:
+        (WebCore::RTCStatsElement::create):
+        (WebCore::RTCStatsElement::RTCStatsElement):
+        * Modules/mediastream/RTCStatsElement.h: long -> double
+        (RTCStatsElement):
+        (WebCore::RTCStatsElement::timestamp):
+        * Modules/mediastream/RTCStatsElement.idl: long -> Date
+        * Modules/mediastream/RTCStatsReport.cpp:
+        (WebCore::RTCStatsReport::addElement):
+        * Modules/mediastream/RTCStatsReport.h:
+        (RTCStatsReport):
+        * Modules/mediastream/RTCStatsResponse.cpp:
+        (WebCore::RTCStatsResponse::addElement):
+        * Modules/mediastream/RTCStatsResponse.h:
+        (RTCStatsResponse):
+        * platform/chromium/support/WebRTCStatsResponse.cpp:
+        (WebKit::WebRTCStatsResponse::addElement):
+        * platform/mediastream/RTCStatsResponseBase.h:
+        (RTCStatsResponseBase):
+
 2012-10-04  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r130377.

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp	2012-10-04 11:06:29 UTC (rev 130383)
@@ -32,12 +32,12 @@
 
 namespace WebCore {
 
-PassRefPtr<RTCStatsElement> RTCStatsElement::create(long timestamp)
+PassRefPtr<RTCStatsElement> RTCStatsElement::create(double timestamp)
 {
     return adoptRef(new RTCStatsElement(timestamp));
 }
 
-RTCStatsElement::RTCStatsElement(long timestamp)
+RTCStatsElement::RTCStatsElement(double timestamp)
     : m_timestamp(timestamp)
 {
 }

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h	2012-10-04 11:06:29 UTC (rev 130383)
@@ -34,15 +34,15 @@
 
 class RTCStatsElement : public RefCounted<RTCStatsElement> {
 public:
-    static PassRefPtr<RTCStatsElement> create(long timestamp);
-    long timestamp() const { return m_timestamp; }
+    static PassRefPtr<RTCStatsElement> create(double timestamp);
+    double timestamp() const { return m_timestamp; }
     String stat(const String& name) const;
     void addStatistic(const String& name, const String& value);
 
 private:
-    explicit RTCStatsElement(long timestamp);
+    explicit RTCStatsElement(double timestamp);
 
-    long m_timestamp;
+    double m_timestamp;
     HashMap<String, String> m_stats;
 };
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.idl (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.idl	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.idl	2012-10-04 11:06:29 UTC (rev 130383)
@@ -27,7 +27,7 @@
     interface [
         Conditional=MEDIA_STREAM,
     ] RTCStatsElement {
-        readonly attribute long timestamp;
+        readonly attribute Date timestamp;
         DOMString stat(in DOMString name);
     };
 }

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp	2012-10-04 11:06:29 UTC (rev 130383)
@@ -39,7 +39,7 @@
 {
 }
 
-size_t RTCStatsReport::addElement(bool isLocal, long timestamp)
+size_t RTCStatsReport::addElement(bool isLocal, double timestamp)
 {
     if (isLocal) {
         m_local.append(RTCStatsElement::create(timestamp));

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h	2012-10-04 11:06:29 UTC (rev 130383)
@@ -40,7 +40,7 @@
     const Vector<RefPtr<RTCStatsElement> >& local() const { return m_local; }
     const Vector<RefPtr<RTCStatsElement> >& remote() const { return m_remote; }
 
-    size_t addElement(bool isLocal, long timestamp);
+    size_t addElement(bool isLocal, double timestamp);
     void addStatistic(bool isLocal, size_t element, String name, String value);
 
 private:

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp	2012-10-04 11:06:29 UTC (rev 130383)
@@ -45,7 +45,7 @@
     return m_result.size() - 1;
 }
 
-size_t RTCStatsResponse::addElement(size_t report, bool isLocal, long timestamp)
+size_t RTCStatsResponse::addElement(size_t report, bool isLocal, double timestamp)
 {
     ASSERT(report >= 0 && report < m_result.size());
     return m_result[report]->addElement(isLocal, timestamp);

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h (130382 => 130383)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h	2012-10-04 11:06:29 UTC (rev 130383)
@@ -45,7 +45,7 @@
     const Vector<RefPtr<RTCStatsReport> >& result() const { return m_result; };
 
     virtual size_t addReport() OVERRIDE;
-    virtual size_t addElement(size_t report, bool isLocal, long timestamp) OVERRIDE;
+    virtual size_t addElement(size_t report, bool isLocal, double timestamp) OVERRIDE;
     virtual void addStatistic(size_t report, bool isLocal, size_t element, String name, String value) OVERRIDE;
 
 private:

Modified: trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp (130382 => 130383)


--- trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp	2012-10-04 11:06:29 UTC (rev 130383)
@@ -60,7 +60,7 @@
     return m_private->addReport();
 }
 
-size_t WebRTCStatsResponse::addElement(size_t report, bool isLocal, long timestamp)
+size_t WebRTCStatsResponse::addElement(size_t report, bool isLocal, double timestamp)
 {
     return m_private->addElement(report, isLocal, timestamp);
 }

Modified: trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h (130382 => 130383)


--- trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h	2012-10-04 11:06:29 UTC (rev 130383)
@@ -38,7 +38,7 @@
     virtual ~RTCStatsResponseBase() { }
 
     virtual size_t addReport() = 0;
-    virtual size_t addElement(size_t report, bool isLocal, long timestamp) = 0;
+    virtual size_t addElement(size_t report, bool isLocal, double timestamp) = 0;
     virtual void addStatistic(size_t report, bool isLocal, size_t element, String name, String value) = 0;
 };
 

Modified: trunk/Tools/ChangeLog (130382 => 130383)


--- trunk/Tools/ChangeLog	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Tools/ChangeLog	2012-10-04 11:06:29 UTC (rev 130383)
@@ -1,3 +1,13 @@
+2012-10-04  Harald Alvestrand  <[email protected]>
+
+        Change RTCPeerConnection GetStats to use Date timestamp format
+        https://bugs.webkit.org/show_bug.cgi?id=98263
+
+        Reviewed by Yury Semikhatsky.
+
+        * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
+        (MockWebRTCPeerConnectionHandler::getStats):
+
 2012-10-04  Dirk Pranke  <[email protected]>
 
         [NRWT] --skipped option is ignored when --test-list is used

Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp (130382 => 130383)


--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp	2012-10-04 10:43:49 UTC (rev 130382)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp	2012-10-04 11:06:29 UTC (rev 130383)
@@ -43,6 +43,7 @@
 #include <public/WebRTCVoidRequest.h>
 #include <public/WebString.h>
 #include <public/WebVector.h>
+#include <wtf/DateMath.h>
 
 using namespace WebKit;
 
@@ -215,12 +216,13 @@
 void MockWebRTCPeerConnectionHandler::getStats(const WebRTCStatsRequest& request)
 {
     WebRTCStatsResponse response = request.createResponse();
+    double currentDate = WTF::jsCurrentTime();
     for (int i = 0; i < m_streamCount; ++i) {
         size_t reportIndex = response.addReport();
-        size_t elementIndex = response.addElement(reportIndex, true, 12345);
+        size_t elementIndex = response.addElement(reportIndex, true, currentDate);
         response.addStatistic(reportIndex, true, elementIndex, "type", "audio");
         reportIndex = response.addReport();
-        elementIndex = response.addElement(reportIndex, true, 12345);
+        elementIndex = response.addElement(reportIndex, true, currentDate);
         response.addStatistic(reportIndex, true, elementIndex, "type", "video");
     }
     postTask(new RTCStatsRequestSucceededTask(this, request, response));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to