Bug 237966 - [iOS] WebAVMediaSelectionOption should implement -mediaType
Summary: [iOS] WebAVMediaSelectionOption should implement -mediaType
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks: 239686
  Show dependency treegraph
 
Reported: 2022-03-16 09:22 PDT by Eric Carlson
Modified: 2022-04-22 21:41 PDT (History)
6 users (show)

See Also:


Attachments
Patch (20.41 KB, patch)
2022-03-16 09:48 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing (20.29 KB, patch)
2022-03-16 10:16 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2022-03-16 09:22:41 PDT
WebAVMediaSelectionOption should implement -mediaType
Comment 1 Eric Carlson 2022-03-16 09:22:49 PDT
rdar://89934589
Comment 2 Eric Carlson 2022-03-16 09:48:27 PDT
Created attachment 454849 [details]
Patch
Comment 3 Jer Noble 2022-03-16 10:06:00 PDT
Comment on attachment 454849 [details]
Patch

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

> Source/WebCore/platform/MediaSelectionOption.h:87
> +template<class Decoder> std::optional<MediaSelectionOption> MediaSelectionOption::decode(Decoder& decoder)
> +{
> +    MediaSelectionOption option;
> +
> +    if (!decoder.decode(option.mediaType))
> +        return { };
> +
> +    if (!decoder.decode(option.displayName))
> +        return { };
> +
> +    if (!decoder.decode(option.legibleType))
> +        return { };
> +
> +    return option;
> +}

Nit: this could be:

template<class Decoder> bool MediaSelectionOption::decode(Decoder& decoder, MediaSelectionOption& option)
{
    return decoder.decode(option.mediaType)
        && decoder.decode(option.displayName)
        && decoder.decode(option.legibleType);
}

Slightly more compact. No hard evidence if this is true or not, but my intuition says it's slightly more efficient as well.
Comment 4 Eric Carlson 2022-03-16 10:16:19 PDT
Created attachment 454852 [details]
Patch for landing
Comment 5 EWS 2022-03-16 13:30:32 PDT
Committed r291361 (248493@main): <https://commits.webkit.org/248493@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454852 [details].