| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class WebContentDecryptionModule; | 45 class WebContentDecryptionModule; |
| 46 } | 46 } |
| 47 | 47 |
| 48 namespace WebCore { | 48 namespace WebCore { |
| 49 | 49 |
| 50 class HTMLMediaElement; | 50 class HTMLMediaElement; |
| 51 class ExceptionState; | 51 class ExceptionState; |
| 52 | 52 |
| 53 // References are held by JS and HTMLMediaElement. | 53 // References are held by JS and HTMLMediaElement. |
| 54 // The WebContentDecryptionModule has the same lifetime as this object. | 54 // The WebContentDecryptionModule has the same lifetime as this object. |
| 55 class MediaKeys : public RefCountedWillBeGarbageCollectedFinalized<MediaKeys>, p
ublic ContextLifecycleObserver, public ScriptWrappable { | 55 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { |
| 56 public: | 56 public: |
| 57 static PassRefPtrWillBeRawPtr<MediaKeys> create(ExecutionContext*, const Str
ing& keySystem, ExceptionState&); | 57 static MediaKeys* create(ExecutionContext*, const String& keySystem, Excepti
onState&); |
| 58 ~MediaKeys(); | 58 ~MediaKeys(); |
| 59 | 59 |
| 60 const String& keySystem() const { return m_keySystem; } | 60 const String& keySystem() const { return m_keySystem; } |
| 61 | 61 |
| 62 PassRefPtrWillBeRawPtr<MediaKeySession> createSession(ExecutionContext*, con
st String& contentType, Uint8Array* initData, ExceptionState&); | 62 MediaKeySession* createSession(ExecutionContext*, const String& contentType,
Uint8Array* initData, ExceptionState&); |
| 63 | 63 |
| 64 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); | 64 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); |
| 65 | 65 |
| 66 void setMediaElement(HTMLMediaElement*); | 66 void setMediaElement(HTMLMediaElement*); |
| 67 | 67 |
| 68 blink::WebContentDecryptionModule* contentDecryptionModule(); | 68 blink::WebContentDecryptionModule* contentDecryptionModule(); |
| 69 | 69 |
| 70 void trace(Visitor*); | 70 void trace(Visitor*); |
| 71 | 71 |
| 72 // ContextLifecycleObserver | 72 // ContextLifecycleObserver |
| 73 virtual void contextDestroyed() OVERRIDE; | 73 virtual void contextDestroyed() OVERRIDE; |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); | 76 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); |
| 77 void initializeNewSessionTimerFired(Timer<MediaKeys>*); | 77 void initializeNewSessionTimerFired(Timer<MediaKeys>*); |
| 78 | 78 |
| 79 HTMLMediaElement* m_mediaElement; | 79 HTMLMediaElement* m_mediaElement; |
| 80 const String m_keySystem; | 80 const String m_keySystem; |
| 81 OwnPtr<blink::WebContentDecryptionModule> m_cdm; | 81 OwnPtr<blink::WebContentDecryptionModule> m_cdm; |
| 82 | 82 |
| 83 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. | 83 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. |
| 84 struct InitializeNewSessionData { | 84 struct InitializeNewSessionData { |
| 85 ALLOW_ONLY_INLINE_ALLOCATION(); | 85 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 86 public: | 86 public: |
| 87 InitializeNewSessionData(PassRefPtrWillBeRawPtr<MediaKeySession> session
, const String& contentType, PassRefPtr<Uint8Array> initData) | 87 InitializeNewSessionData(MediaKeySession* session, const String& content
Type, PassRefPtr<Uint8Array> initData) |
| 88 : session(session) | 88 : session(session) |
| 89 , contentType(contentType) | 89 , contentType(contentType) |
| 90 , initData(initData) { } | 90 , initData(initData) { } |
| 91 | 91 |
| 92 void trace(Visitor*); | 92 void trace(Visitor*); |
| 93 | 93 |
| 94 RefPtrWillBeMember<MediaKeySession> session; | 94 Member<MediaKeySession> session; |
| 95 String contentType; | 95 String contentType; |
| 96 RefPtr<Uint8Array> initData; | 96 RefPtr<Uint8Array> initData; |
| 97 }; | 97 }; |
| 98 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | 98 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; |
| 99 Timer<MediaKeys> m_initializeNewSessionTimer; | 99 Timer<MediaKeys> m_initializeNewSessionTimer; |
| 100 | 100 |
| 101 #if !ENABLE(OILPAN) | 101 #if !ENABLE(OILPAN) |
| 102 WeakPtrFactory<MediaKeys> m_weakFactory; | 102 WeakPtrFactory<MediaKeys> m_weakFactory; |
| 103 #endif | 103 #endif |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } | 106 } |
| 107 | 107 |
| 108 #endif // MediaKeys_h | 108 #endif // MediaKeys_h |
| OLD | NEW |