Bug 110333

Summary: Implement ID for RTCStatsReport object
Product: WebKit Reporter: Harald Alvestrand <hta>
Component: WebKit APIAssignee: Harald Alvestrand <hta>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, berto, cgarcia, dglazkov, eric.carlson, esprehn+autocc, feature-media-reviews, fishd, gyuyoung.kim, jamesr, jansson, jer.noble, jochen, kjellander, ojan.autocc, peter+ews, rakuco, tkent+wkapi, tommyw, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 110332    
Attachments:
Description Flags
Patch
none
Patch
none
This version of the patch should be ready. The previous ones were basically trybot probes.
none
Patch
none
Patch
none
Patch
none
Patch none

Description Harald Alvestrand 2013-02-20 05:42:08 PST
Patch to implement ID support in RTCStatsReport.

- Add the ID property to RTCStatsReport
- Add the get-by-ID named getter to RTCStatsResponse
- Move the actual content of stats from RTCStatsElement to RTCStatsReport

Preserve RTCStatsElement API until Chrome has been updated, but don't bother preserving the local/remote distinction.
Comment 1 Harald Alvestrand 2013-02-20 06:02:39 PST
Created attachment 189300 [details]
Patch
Comment 2 Harald Alvestrand 2013-02-22 02:35:12 PST
Created attachment 189729 [details]
Patch
Comment 3 WebKit Review Bot 2013-02-22 03:48:50 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 4 Harald Alvestrand 2013-02-22 06:28:02 PST
The API update that this patch is the start on is here:

http://dev.w3.org/2011/webrtc/editor/archives/20130222/webrtc.html
Comment 5 Tommy Widenflycht 2013-02-22 06:52:33 PST
Comment on attachment 189729 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=189729&action=review

> Source/WebCore/Modules/mediastream/RTCStatsReport.cpp:57
> +        it != m_stats.end(); ++it) {

One line please

> Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp:60
> +    return m_private->addReport(id, type, timestamp);

Please add ASSERT(m_private) first in these functions. Bettar safe than sorry.
Comment 6 WebKit Review Bot 2013-02-25 17:08:43 PST
Comment on attachment 189729 [details]
Patch

Attachment 189729 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/16760381

New failing tests:
fast/multicol/block-axis-vertical-lr.html
Comment 7 Peter Beverloo (cr-android ews) 2013-02-28 04:49:23 PST
Comment on attachment 189729 [details]
Patch

Attachment 189729 [details] did not pass cr-android-ews (chromium-android):
Output: http://webkit-commit-queue.appspot.com/results/16793281
Comment 8 Harald Alvestrand 2013-03-08 06:00:22 PST
Created attachment 192210 [details]
This version of the patch should be ready. The previous ones were basically trybot probes.
Comment 9 Peter Beverloo (cr-android ews) 2013-03-08 06:14:24 PST
Comment on attachment 192210 [details]
This version of the patch should be ready. The previous ones were basically trybot probes.

Attachment 192210 [details] did not pass cr-android-ews (chromium-android):
Output: http://webkit-commit-queue.appspot.com/results/17110056
Comment 10 EFL EWS Bot 2013-03-08 06:18:50 PST
Comment on attachment 192210 [details]
This version of the patch should be ready. The previous ones were basically trybot probes.

Attachment 192210 [details] did not pass efl-ews (efl):
Output: http://webkit-commit-queue.appspot.com/results/17016174
Comment 11 Harald Alvestrand 2013-03-08 06:24:25 PST
Created attachment 192212 [details]
Patch
Comment 12 EFL EWS Bot 2013-03-08 06:37:50 PST
Comment on attachment 192212 [details]
Patch

Attachment 192212 [details] did not pass efl-ews (efl):
Output: http://webkit-commit-queue.appspot.com/results/17047242
Comment 13 Harald Alvestrand 2013-03-08 06:52:36 PST
Created attachment 192218 [details]
Patch
Comment 14 EFL EWS Bot 2013-03-08 07:00:16 PST
Comment on attachment 192218 [details]
Patch

Attachment 192218 [details] did not pass efl-ews (efl):
Output: http://webkit-commit-queue.appspot.com/results/17077318
Comment 15 Harald Alvestrand 2013-03-08 07:18:42 PST
Created attachment 192224 [details]
Patch
Comment 16 Adam Barth 2013-03-08 14:31:37 PST
Comment on attachment 192224 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=192224&action=review

> Source/WebCore/Modules/mediastream/RTCStatsReport.cpp:37
> -    return adoptRef(new RTCStatsReport());
> +    return adoptRef(new RTCStatsReport("inner fake ID", "inner fake type", 0));

What's up with these strings?  They seems like odd things to use in production code.  Should we use empty or null strings instead?

> Source/WebCore/Modules/mediastream/RTCStatsReport.cpp:45
> +RTCStatsReport::RTCStatsReport(String id, String type, double timestamp)

String -> const String&

Almost all the time you take a String as a parameter to a function, you want to use a const String& to avoid churning the refcount on the underlying StringImpl object.

> Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp:31
> +

This addition seems spurious.
Comment 17 Harald Alvestrand 2013-03-08 15:09:43 PST
Created attachment 192293 [details]
Patch
Comment 18 Adam Barth 2013-03-08 15:13:59 PST
Comment on attachment 192293 [details]
Patch

Thanks.
Comment 19 Harald Alvestrand 2013-03-08 15:19:02 PST
Comment on attachment 192224 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=192224&action=review

Thanks - fixed the comments.

>> Source/WebCore/Modules/mediastream/RTCStatsReport.cpp:37
>> +    return adoptRef(new RTCStatsReport("inner fake ID", "inner fake type", 0));
> 
> What's up with these strings?  They seems like odd things to use in production code.  Should we use empty or null strings instead?

This function is part of the //DEPRECATED stuff that I plan to remove week after next (after landing the Chromium patches that stop all usage of the deprecated interface). The new interface should never have null strings for these, so I want something that's easy to see and not invalid.

>> Source/WebCore/Modules/mediastream/RTCStatsReport.cpp:45
>> +RTCStatsReport::RTCStatsReport(String id, String type, double timestamp)
> 
> String -> const String&
> 
> Almost all the time you take a String as a parameter to a function, you want to use a const String& to avoid churning the refcount on the underlying StringImpl object.

Done!

>> Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp:31
>> +
> 
> This addition seems spurious.

Fixed.
Comment 20 WebKit Review Bot 2013-03-08 15:48:07 PST
Comment on attachment 192293 [details]
Patch

Clearing flags on attachment: 192293

Committed r145279: <http://trac.webkit.org/changeset/145279>
Comment 21 WebKit Review Bot 2013-03-08 15:48:13 PST
All reviewed patches have been landed.  Closing bug.
Comment 22 Alberto Garcia 2013-03-22 07:06:01 PDT
Hey, I can't link the BlackBerry port after this patch.

DerivedSources/WebCore/JSRTCStatsResponse.cpp.o: In function `WebCore::JSRTCStatsResponse::getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned int, JSC::PropertySlot&)':
DerivedSources/WebCore/JSRTCStatsResponse.cpp:182: undefined reference to `WebCore::JSRTCStatsResponse::canGetItemsForName(JSC::ExecState*, WebCore::RTCStatsResponse*, JSC::PropertyName)'

DerivedSources/WebCore/JSRTCStatsResponse.cpp.o: In function `WTF::StringImpl::operator delete(void*)':
Source/WTF/wtf/text/StringImpl.h:135: undefined reference to `WebCore::JSRTCStatsResponse::nameGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName)'

...
Comment 23 Harald Alvestrand 2013-03-22 08:00:34 PDT
This looks like a reaction to the use of the "NamedGetter" control in RTCStatsResponse.idl.

In Chrome, it was enough to add the namedItem function in the IDL and implement it to have this function correctly. Can you check if you have the NamedGetter in any other IDL function that you currently compile, and if so, what functions there have to be to support it?

(dom/NodeList and html/HTMLCollection have the same shape to their interfaces)
Comment 24 Alberto Garcia 2013-03-22 09:28:18 PDT
(In reply to comment #23)
> Can you check if you have the NamedGetter in any other IDL function that you currently compile, and if so, what functions there have to be to support it?

> (dom/NodeList and html/HTMLCollection have the same shape to their interfaces)

In those cases, JSNodeList::nameGetter() and JSNodeList::canGetItemsForName() are defined in Source/WebCore/bindings/js/

But there's no such implementation for RTCStatsResponse.
Comment 25 Carlos Garcia Campos 2013-03-26 05:03:40 PDT
(In reply to comment #22)
> Hey, I can't link the BlackBerry port after this patch.
> 
> DerivedSources/WebCore/JSRTCStatsResponse.cpp.o: In function `WebCore::JSRTCStatsResponse::getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned int, JSC::PropertySlot&)':
> DerivedSources/WebCore/JSRTCStatsResponse.cpp:182: undefined reference to `WebCore::JSRTCStatsResponse::canGetItemsForName(JSC::ExecState*, WebCore::RTCStatsResponse*, JSC::PropertyName)'
> 
> DerivedSources/WebCore/JSRTCStatsResponse.cpp.o: In function `WTF::StringImpl::operator delete(void*)':
> Source/WTF/wtf/text/StringImpl.h:135: undefined reference to `WebCore::JSRTCStatsResponse::nameGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName)'
> 
> ...

I don't think this is a BlackBerry specific build failure, but any port using JSC and building with media stream enabled would fail to build. I've opened a new bug:

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