Bug 169567 - Make classes used by Media Stream encode/decode friendly
Summary: Make classes used by Media Stream encode/decode friendly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks: 169609
  Show dependency treegraph
 
Reported: 2017-03-13 14:02 PDT by Jer Noble
Modified: 2017-03-14 13:50 PDT (History)
0 users

See Also:


Attachments
Patch (15.72 KB, patch)
2017-03-13 14:04 PDT, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff
Patch for landing (16.60 KB, patch)
2017-03-13 23:54 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch for landing (16.32 KB, patch)
2017-03-14 00:01 PDT, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2017-03-13 14:02:00 PDT
Make classes used by Media Stream encode/decode friendly
Comment 1 Jer Noble 2017-03-13 14:04:03 PDT
Created attachment 304297 [details]
Patch
Comment 2 Eric Carlson 2017-03-13 15:43:56 PDT
Comment on attachment 304297 [details]
Patch

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

> Source/WebCore/Modules/mediastream/MediaConstraintsImpl.h:70
> +template<class Encoder>
> +void MediaConstraintsData::encode(Encoder& encoder) const
> +{
> +    encoder << mandatoryConstraints << advancedConstraints << isValid;
> +}
> +
> +template<class Decoder>
> +bool MediaConstraintsData::decode(Decoder& decoder, MediaConstraintsData& data)
> +{
> +    return decoder.decode(data.mandatoryConstraints)
> +        && decoder.decode(data.advancedConstraints)
> +        && decoder.decode(data.isValid);
> +}

These are nice, but we already have an encoder and decoder in WebCoreArgumentCoders. Why don't you either delete those or replace them with these?

> Source/WebCore/platform/mediastream/CaptureDevice.h:92
> +void CaptureDevice::encode(Encoder& encoder) const
> +{
> +    encoder << m_persistentId
> +        << m_label
> +        << m_groupId
> +        << m_enabled;
> +    encoder.encodeEnum(m_type);
> +}
> +
> +template<class Decoder>
> +bool CaptureDevice::decode(Decoder& decoder, CaptureDevice& device)
> +{
> +    return decoder.decode(device.m_persistentId)
> +        && decoder.decode(device.m_label)
> +        && decoder.decode(device.m_groupId)
> +        && decoder.decode(device.m_enabled)
> +        && decoder.decodeEnum(device.m_type);
> +}

Ditto.
Comment 3 Jer Noble 2017-03-13 23:49:04 PDT
(In reply to comment #2)
> Comment on attachment 304297 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=304297&action=review
> 
> > Source/WebCore/Modules/mediastream/MediaConstraintsImpl.h:70
> > +template<class Encoder>
> > +void MediaConstraintsData::encode(Encoder& encoder) const
> > +{
> > +    encoder << mandatoryConstraints << advancedConstraints << isValid;
> > +}
> > +
> > +template<class Decoder>
> > +bool MediaConstraintsData::decode(Decoder& decoder, MediaConstraintsData& data)
> > +{
> > +    return decoder.decode(data.mandatoryConstraints)
> > +        && decoder.decode(data.advancedConstraints)
> > +        && decoder.decode(data.isValid);
> > +}
> 
> These are nice, but we already have an encoder and decoder in
> WebCoreArgumentCoders. Why don't you either delete those or replace them
> with these?
> 
> > Source/WebCore/platform/mediastream/CaptureDevice.h:92
> > +void CaptureDevice::encode(Encoder& encoder) const
> > +{
> > +    encoder << m_persistentId
> > +        << m_label
> > +        << m_groupId
> > +        << m_enabled;
> > +    encoder.encodeEnum(m_type);
> > +}
> > +
> > +template<class Decoder>
> > +bool CaptureDevice::decode(Decoder& decoder, CaptureDevice& device)
> > +{
> > +    return decoder.decode(device.m_persistentId)
> > +        && decoder.decode(device.m_label)
> > +        && decoder.decode(device.m_groupId)
> > +        && decoder.decode(device.m_enabled)
> > +        && decoder.decodeEnum(device.m_type);
> > +}
> 
> Ditto.

Good point!
Comment 4 Jer Noble 2017-03-13 23:54:36 PDT
Created attachment 304359 [details]
Patch for landing
Comment 5 Jer Noble 2017-03-14 00:01:07 PDT
Created attachment 304360 [details]
Patch for landing
Comment 6 Jer Noble 2017-03-14 13:50:59 PDT
Committed r213936: <http://trac.webkit.org/changeset/213936>