Changeset 130768 in webkit


Ignore:
Timestamp:
Oct 9, 2012 8:56:07 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/Platform: Change PeerConnection getStats function to single value local / remote
elements in RTCStatsReport.
https://bugs.webkit.org/show_bug.cgi?id=98753

Patch by Harald Alvestrand <hta@google.com> on 2012-10-09
Reviewed by Adam Barth.

  • chromium/public/WebRTCStatsResponse.h:

(WebRTCStatsResponse):

Source/WebCore: Change PeerConnection getStats function to single value local / remote
elements in RTCStatsReport.

https://bugs.webkit.org/show_bug.cgi?id=98753

Patch by Harald Alvestrand <hta@google.com> on 2012-10-09
Reviewed by Adam Barth.

IDL of RTCStatsReport has been changed to make local/remote
single valued RTCStatsElement attributes.
The RTCStatsReport argument to index the list of RTCStatsElement
in the local and remote functions has been removed.

Tested by modifications to RTCPeerConnection-stats.html

  • Modules/mediastream/RTCStatsReport.cpp:

(WebCore::RTCStatsReport::addElement):
(WebCore::RTCStatsReport::addStatistic):

  • Modules/mediastream/RTCStatsReport.h:

(WebCore::RTCStatsReport::local):
(WebCore::RTCStatsReport::remote):
(RTCStatsReport):

  • Modules/mediastream/RTCStatsReport.idl:
  • Modules/mediastream/RTCStatsResponse.cpp:

(WebCore::RTCStatsResponse::addElement):
(WebCore::RTCStatsResponse::addStatistic):

  • Modules/mediastream/RTCStatsResponse.h:

(RTCStatsResponse):

  • platform/chromium/support/WebRTCStatsResponse.cpp:

(WebKit::WebRTCStatsResponse::addElement):
(WebKit::WebRTCStatsResponse::addStatistic):

  • platform/mediastream/RTCStatsResponseBase.h:

(RTCStatsResponseBase):

Tools: Change PeerConnection getStats function to single value local / remote
elements in RTCStatsReport.
https://bugs.webkit.org/show_bug.cgi?id=98753

Patch by Harald Alvestrand <hta@google.com> on 2012-10-09
Reviewed by Adam Barth.

  • DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:

(MockWebRTCPeerConnectionHandler::getStats):

LayoutTests: Change PeerConnection getStats function to single value local / remote
elements in RTCStatsReport.
https://bugs.webkit.org/show_bug.cgi?id=98753

Patch by Harald Alvestrand <hta@google.com> on 2012-10-09
Reviewed by Adam Barth.

  • fast/mediastream/RTCPeerConnection-stats-expected.txt:
  • fast/mediastream/RTCPeerConnection-stats.html:
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130767 r130768  
     12012-10-09  Harald Alvestrand  <hta@google.com>
     2
     3        Change PeerConnection getStats function to single value local / remote
     4        elements in RTCStatsReport.
     5        https://bugs.webkit.org/show_bug.cgi?id=98753
     6
     7        Reviewed by Adam Barth.
     8
     9        * fast/mediastream/RTCPeerConnection-stats-expected.txt:
     10        * fast/mediastream/RTCPeerConnection-stats.html:
     11
    1122012-10-09  Adam Barth  <abarth@webkit.org>
    213
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt

    r130383 r130768  
    1414PASS statsHandler2 was called
    1515PASS result.length is >= 2
    16 PASS local.length is 1
    1716PASS timestamp is >= startTime
    18 PASS local[0].stat("type") is "audio"
     17PASS local.stat("type") is "audio"
    1918PASS successfullyParsed is true
    2019
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html

    r130383 r130768  
    4949    result = status.result();
    5050    shouldBeGreaterThanOrEqual('result.length', '2');
    51     local = result[0].local();
    52     shouldBe('local.length', '1');
    53     timestamp = local[0].timestamp;
     51    local = result[0].local;
     52    timestamp = local.timestamp;
    5453    shouldBeGreaterThanOrEqual('timestamp', 'startTime');
    55     shouldBe('local[0].stat("type")', '"audio"');
     54    shouldBe('local.stat("type")', '"audio"');
    5655    finishJSTest();
    5756}
  • trunk/Source/Platform/ChangeLog

    r130383 r130768  
     12012-10-09  Harald Alvestrand  <hta@google.com>
     2
     3        Change PeerConnection getStats function to single value local / remote
     4        elements in RTCStatsReport.
     5        https://bugs.webkit.org/show_bug.cgi?id=98753
     6
     7        Reviewed by Adam Barth.
     8
     9        * chromium/public/WebRTCStatsResponse.h:
     10        (WebRTCStatsResponse):
     11
    1122012-10-04  Harald Alvestrand  <hta@google.com>
    213
  • trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h

    r130383 r130768  
    5353
    5454    WEBKIT_EXPORT size_t addReport();
    55     WEBKIT_EXPORT size_t addElement(size_t report, bool isLocal, double timestamp);
    56     WEBKIT_EXPORT void addStatistic(size_t report, bool isLocal, size_t element, WebString name, WebString value);
     55    WEBKIT_EXPORT void addElement(size_t report, bool isLocal, double timestamp);
     56    WEBKIT_EXPORT void addStatistic(size_t report, bool isLocal, WebString name, WebString value);
    5757
    5858#if WEBKIT_IMPLEMENTATION
  • trunk/Source/WebCore/ChangeLog

    r130763 r130768  
     12012-10-09  Harald Alvestrand  <hta@google.com>
     2
     3        Change PeerConnection getStats function to single value local / remote
     4        elements in RTCStatsReport.
     5
     6        https://bugs.webkit.org/show_bug.cgi?id=98753
     7
     8        Reviewed by Adam Barth.
     9
     10        IDL of RTCStatsReport has been changed to make local/remote
     11        single valued RTCStatsElement attributes.
     12        The RTCStatsReport argument to index the list of RTCStatsElement
     13        in the local and remote functions has been removed.
     14
     15        Tested by modifications to RTCPeerConnection-stats.html
     16
     17        * Modules/mediastream/RTCStatsReport.cpp:
     18        (WebCore::RTCStatsReport::addElement):
     19        (WebCore::RTCStatsReport::addStatistic):
     20        * Modules/mediastream/RTCStatsReport.h:
     21        (WebCore::RTCStatsReport::local):
     22        (WebCore::RTCStatsReport::remote):
     23        (RTCStatsReport):
     24        * Modules/mediastream/RTCStatsReport.idl:
     25        * Modules/mediastream/RTCStatsResponse.cpp:
     26        (WebCore::RTCStatsResponse::addElement):
     27        (WebCore::RTCStatsResponse::addStatistic):
     28        * Modules/mediastream/RTCStatsResponse.h:
     29        (RTCStatsResponse):
     30        * platform/chromium/support/WebRTCStatsResponse.cpp:
     31        (WebKit::WebRTCStatsResponse::addElement):
     32        (WebKit::WebRTCStatsResponse::addStatistic):
     33        * platform/mediastream/RTCStatsResponseBase.h:
     34        (RTCStatsResponseBase):
     35
    1362012-10-09  Antonio Gomes  <agomes@rim.com>
    237
  • trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp

    r130383 r130768  
    4040}
    4141
    42 size_t RTCStatsReport::addElement(bool isLocal, double timestamp)
     42void RTCStatsReport::addElement(bool isLocal, double timestamp)
    4343{
    4444    if (isLocal) {
    45         m_local.append(RTCStatsElement::create(timestamp));
    46         return m_local.size() - 1;
     45        ASSERT(!m_local);
     46        m_local = RTCStatsElement::create(timestamp);
    4747    }
    48     m_remote.append(RTCStatsElement::create(timestamp));
    49     return m_remote.size() - 1;
     48    ASSERT(!m_remote);
     49    m_remote = RTCStatsElement::create(timestamp);
    5050}
    5151
    52 void RTCStatsReport::addStatistic(bool isLocal, size_t element, String name, String value)
     52void RTCStatsReport::addStatistic(bool isLocal, String name, String value)
    5353{
    5454    if (isLocal) {
    55         ASSERT(element >= 0 && element < m_local.size());
    56         m_local[element]->addStatistic(name, value);
     55        ASSERT(m_local);
     56        m_local->addStatistic(name, value);
    5757    } else {
    58         ASSERT(element >= 0 && element < m_remote.size());
    59         m_remote[element]->addStatistic(name, value);
     58        ASSERT(m_remote);
     59        m_remote->addStatistic(name, value);
    6060    }
    6161}
  • trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h

    r130383 r130768  
    3838    static PassRefPtr<RTCStatsReport> create();
    3939
    40     const Vector<RefPtr<RTCStatsElement> >& local() const { return m_local; }
    41     const Vector<RefPtr<RTCStatsElement> >& remote() const { return m_remote; }
     40    const PassRefPtr<RTCStatsElement> local() const { return m_local.get(); }
     41    const PassRefPtr<RTCStatsElement> remote() const { return m_remote.get(); }
    4242
    43     size_t addElement(bool isLocal, double timestamp);
    44     void addStatistic(bool isLocal, size_t element, String name, String value);
     43    void addElement(bool isLocal, double timestamp);
     44    void addStatistic(bool isLocal, String name, String value);
    4545
    4646private:
    4747    RTCStatsReport();
    4848
    49     Vector<RefPtr<RTCStatsElement> > m_local;
    50     Vector<RefPtr<RTCStatsElement> > m_remote;
     49    RefPtr<RTCStatsElement> m_local;
     50    RefPtr<RTCStatsElement> m_remote;
    5151};
    5252
  • trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl

    r129908 r130768  
    2828        Conditional=MEDIA_STREAM
    2929    ] RTCStatsReport {
    30         sequence<RTCStatsElement> local();
    31         sequence<RTCStatsElement> remote();
     30        readonly attribute RTCStatsElement local;
     31        readonly attribute RTCStatsElement remote;
    3232    };
    3333}
  • trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp

    r130383 r130768  
    4646}
    4747
    48 size_t RTCStatsResponse::addElement(size_t report, bool isLocal, double timestamp)
     48void RTCStatsResponse::addElement(size_t report, bool isLocal, double timestamp)
    4949{
    5050    ASSERT(report >= 0 && report < m_result.size());
    51     return m_result[report]->addElement(isLocal, timestamp);
     51    m_result[report]->addElement(isLocal, timestamp);
    5252}
    5353
    54 void RTCStatsResponse::addStatistic(size_t report, bool isLocal, size_t element, String name, String value)
     54void RTCStatsResponse::addStatistic(size_t report, bool isLocal, String name, String value)
    5555{
    5656    ASSERT(report >= 0 && report < m_result.size());
    57     return m_result[report]->addStatistic(isLocal, element, name, value);
     57    m_result[report]->addStatistic(isLocal, name, value);
    5858}
    5959
  • trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h

    r130383 r130768  
    4646
    4747    virtual size_t addReport() OVERRIDE;
    48     virtual size_t addElement(size_t report, bool isLocal, double timestamp) OVERRIDE;
    49     virtual void addStatistic(size_t report, bool isLocal, size_t element, String name, String value) OVERRIDE;
     48    virtual void addElement(size_t report, bool isLocal, double timestamp) OVERRIDE;
     49    virtual void addStatistic(size_t report, bool isLocal, String name, String value) OVERRIDE;
    5050
    5151private:
  • trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp

    r130383 r130768  
    6161}
    6262
    63 size_t WebRTCStatsResponse::addElement(size_t report, bool isLocal, double timestamp)
     63void WebRTCStatsResponse::addElement(size_t report, bool isLocal, double timestamp)
    6464{
    65     return m_private->addElement(report, isLocal, timestamp);
     65    m_private->addElement(report, isLocal, timestamp);
    6666}
    6767
    68 void WebRTCStatsResponse::addStatistic(size_t report, bool isLocal, size_t element, WebString name, WebString value)
     68void WebRTCStatsResponse::addStatistic(size_t report, bool isLocal, WebString name, WebString value)
    6969{
    70     m_private->addStatistic(report, isLocal, element, name, value);
     70    m_private->addStatistic(report, isLocal, name, value);
    7171}
    7272
  • trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h

    r130383 r130768  
    3939
    4040    virtual size_t addReport() = 0;
    41     virtual size_t addElement(size_t report, bool isLocal, double timestamp) = 0;
    42     virtual void addStatistic(size_t report, bool isLocal, size_t element, String name, String value) = 0;
     41    virtual void addElement(size_t report, bool isLocal, double timestamp) = 0;
     42    virtual void addStatistic(size_t report, bool isLocal, String name, String value) = 0;
    4343};
    4444
     
    4848
    4949#endif // RTCStatsResponseBase_h
     50
  • trunk/Tools/ChangeLog

    r130765 r130768  
     12012-10-09  Harald Alvestrand  <hta@google.com>
     2
     3        Change PeerConnection getStats function to single value local / remote
     4        elements in RTCStatsReport.
     5        https://bugs.webkit.org/show_bug.cgi?id=98753
     6
     7        Reviewed by Adam Barth.
     8
     9        * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
     10        (MockWebRTCPeerConnectionHandler::getStats):
     11
    1122012-10-09  Sadrul Habib Chowdhury  <sadrul@chromium.org>
    213
  • trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp

    r130383 r130768  
    220220    for (int i = 0; i < m_streamCount; ++i) {
    221221        size_t reportIndex = response.addReport();
    222         size_t elementIndex = response.addElement(reportIndex, true, currentDate);
    223         response.addStatistic(reportIndex, true, elementIndex, "type", "audio");
     222        response.addElement(reportIndex, true, currentDate);
     223        response.addStatistic(reportIndex, true, "type", "audio");
    224224        reportIndex = response.addReport();
    225         elementIndex = response.addElement(reportIndex, true, currentDate);
    226         response.addStatistic(reportIndex, true, elementIndex, "type", "video");
     225        response.addElement(reportIndex, true, currentDate);
     226        response.addStatistic(reportIndex, true, "type", "video");
    227227    }
    228228    postTask(new RTCStatsRequestSucceededTask(this, request, response));
Note: See TracChangeset for help on using the changeset viewer.