Bug 166749 - Add support for MediaKeySystemAccess.createMediaKeys()
Summary: Add support for MediaKeySystemAccess.createMediaKeys()
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-05 18:00 PST by Jer Noble
Modified: 2019-06-16 21:26 PDT (History)
4 users (show)

See Also:


Attachments
Patch (31.59 KB, patch)
2017-01-05 18:10 PST, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff
Patch for landing (31.50 KB, patch)
2017-01-05 20:59 PST, 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-01-05 18:00:56 PST
Add support for MediaKeySystemAccess.createMediaKeys()
Comment 1 Jer Noble 2017-01-05 18:10:20 PST
Created attachment 298158 [details]
Patch
Comment 2 Eric Carlson 2017-01-05 18:42:21 PST
Comment on attachment 298158 [details]
Patch

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

> Source/WebCore/Modules/encryptedmedia/CDMInstance.h:35
> +struct MediaKeysRestrictions;

Nit: "MediaKeysRestrictions" is unnecessary.

> Source/WebCore/Modules/encryptedmedia/CDMPrivate.h:40
> +

Nit: extra blank line.
Comment 3 Jer Noble 2017-01-05 20:59:28 PST
Created attachment 298170 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2017-01-06 10:49:29 PST
Comment on attachment 298170 [details]
Patch for landing

Clearing flags on attachment: 298170

Committed r210445: <http://trac.webkit.org/changeset/210445>
Comment 5 Darin Adler 2017-01-06 13:50:15 PST
Comment on attachment 298170 [details]
Patch for landing

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

Some post-landing comments.

> Source/WebCore/Modules/encryptedmedia/CDMInstance.h:43
> +    enum SuccessValue {
> +        Failed,
> +        Succeeded,
> +    };

One liner maybe? I don’t see a reason to spread this over four lines.

I am not sure this idiom is great. Is there some less wordy way we could do this? I might just prefer a success boolean rather than a special type, even though it would require a comment defining the meaning of the boolean.

> Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp:77
> +        std::unique_ptr<CDMInstance> instance = m_implementation->createInstance();

auto would be good here

> Source/WebCore/testing/MockCDMFactory.cpp:127
> +    return std::unique_ptr<CDMInstance>(new MockCDMInstance(m_weakPtrFactory.createWeakPtr()));

Can we find a way to use make_unique instead of new here? I know there are possibly privacy reason to not do that.

> Source/WebCore/testing/MockCDMFactory.cpp:167
> +    MockCDMFactory* factory = m_cdm ? m_cdm->factory() : nullptr;

auto*

> Source/WebCore/testing/MockCDMFactory.h:78
>      MockCDM(WeakPtr<MockCDMFactory>);

Should take a const WeakPtr<MockCDMFactory>& for better efficiency. Should probably be marked explicit, too.

> Source/WebCore/testing/MockCDMFactory.h:102
> +    MockCDMInstance(WeakPtr<MockCDM>);

Should take a const WeakPtr<MockCDM>& for better efficiency. Should probably be marked explicit, too.
Comment 6 Jer Noble 2017-01-06 14:38:07 PST
(In reply to comment #5)
> Comment on attachment 298170 [details]
> Patch for landing
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=298170&action=review
> 
> Some post-landing comments.
> 
> > Source/WebCore/Modules/encryptedmedia/CDMInstance.h:43
> > +    enum SuccessValue {
> > +        Failed,
> > +        Succeeded,
> > +    };
> 
> One liner maybe? I don’t see a reason to spread this over four lines.
> 
> I am not sure this idiom is great. Is there some less wordy way we could do
> this? I might just prefer a success boolean rather than a special type, even
> though it would require a comment defining the meaning of the boolean.

Eh, the usefulness of this idiom is that it makes sense in the calling context. The boolean return value idiom would need a comment everywhere it's called to be as clear.

I think this is better than a boolean return, but maybe not as good as it good be.

> > Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp:77
> > +        std::unique_ptr<CDMInstance> instance = m_implementation->createInstance();
> 
> auto would be good here

Ok.

> > Source/WebCore/testing/MockCDMFactory.cpp:127
> > +    return std::unique_ptr<CDMInstance>(new MockCDMInstance(m_weakPtrFactory.createWeakPtr()));
> 
> Can we find a way to use make_unique instead of new here? I know there are
> possibly privacy reason to not do that.

This issue is that the compiler can't find a good way to cast a unique_ptr<MockCDMInstance> to a unique_ptr<CDMInstance>.

> > Source/WebCore/testing/MockCDMFactory.cpp:167
> > +    MockCDMFactory* factory = m_cdm ? m_cdm->factory() : nullptr;
> 
> auto*

Ok.

> > Source/WebCore/testing/MockCDMFactory.h:78
> >      MockCDM(WeakPtr<MockCDMFactory>);
> 
> Should take a const WeakPtr<MockCDMFactory>& for better efficiency. Should
> probably be marked explicit, too.

Not a WeakPtr<MockCDMFactory>&&?

> > Source/WebCore/testing/MockCDMFactory.h:102
> > +    MockCDMInstance(WeakPtr<MockCDM>);
> 
> Should take a const WeakPtr<MockCDM>& for better efficiency. Should probably
> be marked explicit, too.