Summary: | Make classes used by Media Stream encode/decode friendly | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jer Noble <jer.noble> | ||||||||
Component: | New Bugs | Assignee: | Jer Noble <jer.noble> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | ||||||||||
Priority: | P2 | ||||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 169609 | ||||||||||
Attachments: |
|
Description
Jer Noble
2017-03-13 14:02:00 PDT
Created attachment 304297 [details]
Patch
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. (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! Created attachment 304359 [details]
Patch for landing
Created attachment 304360 [details]
Patch for landing
Committed r213936: <http://trac.webkit.org/changeset/213936> |