⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 219977 in webkit


Ignore:
Timestamp:
Jul 27, 2017, 1:13:55 AM (9 years ago)
Author:
zandobersek@gmail.com
Message:

[EME] Allow CDMInstance type traits specialization
​https://bugs.webkit.org/show_bug.cgi?id=174886

Reviewed by Xabier Rodriguez-Calvar.

Allow using the trait-based type casting for the CDMInstance class and its
derivatives. ImplementationType enumeration values are to be used and
returned from the new implementationType() virtual method. This method is
leveraged in the type trait specialization that enables using is<>() and
downcast<>() helpers for CDMInstance objects.

This will allow differentiating between CDMInstance implementations once
the media playback pipeline has to retrieve any key information that's
necessary for playback of encrypted content.

MockCDMInstance class overrides the implementationType() method, returning
the ImplementationType::Mock value. Type trait specializations for this
class aren't added since they're not needed anywhere at this point.

  • platform/encryptedmedia/CDMInstance.h:
  • testing/MockCDMFactory.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r219976 r219977  
     12017-07-27  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [EME] Allow CDMInstance type traits specialization
     4        https://bugs.webkit.org/show_bug.cgi?id=174886
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Allow using the trait-based type casting for the CDMInstance class and its
     9        derivatives. ImplementationType enumeration values are to be used and
     10        returned from the new implementationType() virtual method. This method is
     11        leveraged in the type trait specialization that enables using is<>() and
     12        downcast<>() helpers for CDMInstance objects.
     13
     14        This will allow differentiating between CDMInstance implementations once
     15        the media playback pipeline has to retrieve any key information that's
     16        necessary for playback of encrypted content.
     17
     18        MockCDMInstance class overrides the implementationType() method, returning
     19        the ImplementationType::Mock value. Type trait specializations for this
     20        class aren't added since they're not needed anywhere at this point.
     21
     22        * platform/encryptedmedia/CDMInstance.h:
     23        * testing/MockCDMFactory.h:
     24
    1252017-07-27  Zan Dobersek  <zdobersek@igalia.com>
    226
  • trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h

    r219678 r219977  
    3535#include <wtf/Optional.h>
    3636#include <wtf/RefCounted.h>
     37#include <wtf/TypeCasts.h>
    3738#include <wtf/Vector.h>
    3839
    … …  
    4647public:
    4748    virtual ~CDMInstance() { }
     49
     50    enum class ImplementationType {
     51        Mock,
     52    };
     53
     54    virtual ImplementationType implementationType() const = 0;
    4855
    4956    enum SuccessValue {
    … …  
    9198} // namespace WebCore
    9299
     100#define SPECIALIZE_TYPE_TRAITS_CDM_INSTANCE(ToValueTypeName, ImplementationTypeName) \
     101SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
     102static bool isType(const WebCore::CDMInstance& instance) { return instance.implementationType() == ImplementationTypeName; } \
     103SPECIALIZE_TYPE_TRAITS_END()
     104
    93105#endif
  • trunk/Source/WebCore/testing/MockCDMFactory.h

    r212110 r219977  
    128128
    129129private:
     130    ImplementationType implementationType() const final { return ImplementationType::Mock; }
    130131    SuccessValue initializeWithConfiguration(const MediaKeySystemConfiguration&) final;
    131132    SuccessValue setDistinctiveIdentifiersAllowed(bool) final;
Note: See TracChangeset for help on using the changeset viewer.