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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class WebContentDecryptionModule; | 44 class WebContentDecryptionModule; |
45 } | 45 } |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 class HTMLMediaElement; | 49 class HTMLMediaElement; |
50 class ExceptionState; | 50 class ExceptionState; |
51 | 51 |
52 // References are held by JS and HTMLMediaElement. | 52 // References are held by JS and HTMLMediaElement. |
53 // The WebContentDecryptionModule has the same lifetime as this object. | 53 // The WebContentDecryptionModule has the same lifetime as this object. |
54 class MediaKeys : public RefCountedWillBeGarbageCollectedFinalized<MediaKeys>, p
ublic ContextLifecycleObserver, public ScriptWrappable { | 54 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { |
55 public: | 55 public: |
56 static PassRefPtrWillBeRawPtr<MediaKeys> create(ExecutionContext*, const Str
ing& keySystem, ExceptionState&); | 56 static MediaKeys* create(ExecutionContext*, const String& keySystem, Excepti
onState&); |
57 ~MediaKeys(); | 57 ~MediaKeys(); |
58 | 58 |
59 const String& keySystem() const { return m_keySystem; } | 59 const String& keySystem() const { return m_keySystem; } |
60 | 60 |
61 PassRefPtrWillBeRawPtr<MediaKeySession> createSession(ExecutionContext*, con
st String& contentType, Uint8Array* initData, ExceptionState&); | 61 MediaKeySession* createSession(ExecutionContext*, const String& contentType,
Uint8Array* initData, ExceptionState&); |
62 | 62 |
63 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); | 63 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); |
64 | 64 |
65 void setMediaElement(HTMLMediaElement*); | 65 void setMediaElement(HTMLMediaElement*); |
66 | 66 |
67 blink::WebContentDecryptionModule* contentDecryptionModule(); | 67 blink::WebContentDecryptionModule* contentDecryptionModule(); |
68 | 68 |
69 void trace(Visitor*); | 69 void trace(Visitor*); |
70 | 70 |
71 // ContextLifecycleObserver | 71 // ContextLifecycleObserver |
72 virtual void contextDestroyed() OVERRIDE; | 72 virtual void contextDestroyed() OVERRIDE; |
73 | 73 |
74 protected: | 74 protected: |
75 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); | 75 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); |
76 void initializeNewSessionTimerFired(Timer<MediaKeys>*); | 76 void initializeNewSessionTimerFired(Timer<MediaKeys>*); |
77 | 77 |
78 HTMLMediaElement* m_mediaElement; | 78 HTMLMediaElement* m_mediaElement; |
79 const String m_keySystem; | 79 const String m_keySystem; |
80 OwnPtr<blink::WebContentDecryptionModule> m_cdm; | 80 OwnPtr<blink::WebContentDecryptionModule> m_cdm; |
81 | 81 |
82 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. | 82 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. |
83 struct InitializeNewSessionData { | 83 struct InitializeNewSessionData { |
84 ALLOW_ONLY_INLINE_ALLOCATION(); | 84 ALLOW_ONLY_INLINE_ALLOCATION(); |
85 public: | 85 public: |
86 InitializeNewSessionData(PassRefPtrWillBeRawPtr<MediaKeySession> session
, const String& contentType, PassRefPtr<Uint8Array> initData) | 86 InitializeNewSessionData(MediaKeySession* session, const String& content
Type, PassRefPtr<Uint8Array> initData) |
87 : session(session) | 87 : session(session) |
88 , contentType(contentType) | 88 , contentType(contentType) |
89 , initData(initData) { } | 89 , initData(initData) { } |
90 | 90 |
91 void trace(Visitor*); | 91 void trace(Visitor*); |
92 | 92 |
93 RefPtrWillBeMember<MediaKeySession> session; | 93 Member<MediaKeySession> session; |
94 String contentType; | 94 String contentType; |
95 RefPtr<Uint8Array> initData; | 95 RefPtr<Uint8Array> initData; |
96 }; | 96 }; |
97 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | 97 HeapDeque<InitializeNewSessionData> m_pendingInitializeNewSessionData; |
98 Timer<MediaKeys> m_initializeNewSessionTimer; | 98 Timer<MediaKeys> m_initializeNewSessionTimer; |
99 | |
100 #if !ENABLE(OILPAN) | |
101 WeakPtrFactory<MediaKeys> m_weakFactory; | |
102 #endif | |
103 }; | 99 }; |
104 | 100 |
105 } | 101 } |
106 | 102 |
107 #endif // MediaKeys_h | 103 #endif // MediaKeys_h |
OLD | NEW |