| 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 26 matching lines...) Expand all Loading... |
| 37 #include "public/platform/WebContentDecryptionModuleSession.h" | 37 #include "public/platform/WebContentDecryptionModuleSession.h" |
| 38 #include "public/platform/WebEncryptedMediaTypes.h" | 38 #include "public/platform/WebEncryptedMediaTypes.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class GenericEventQueue; | 42 class GenericEventQueue; |
| 43 class MediaKeys; | 43 class MediaKeys; |
| 44 | 44 |
| 45 // References are held by JS only. However, even if all JS references are | 45 // References are held by JS only. However, even if all JS references are |
| 46 // dropped, it won't be garbage collected until close event received or | 46 // dropped, it won't be garbage collected until close event received or |
| 47 // MediaKeys goes away (as determined by the validity of a WeakPtr). This allows | 47 // MediaKeys goes away (as determined by a WeakMember reference). This allows |
| 48 // the CDM to continue to fire events for this session, as long as the session | 48 // the CDM to continue to fire events for this session, as long as the session |
| 49 // is open. | 49 // is open. |
| 50 // | 50 // |
| 51 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession | 51 // WeakMember<MediaKeys> is used instead of having MediaKeys and MediaKeySession |
| 52 // keep references to each other, and then having to inform the other object | 52 // keep references to each other, and then having to inform the other object |
| 53 // when it gets destroyed. | 53 // when it gets destroyed. When the Oilpan garbage collector determines that |
| 54 // only WeakMember<> references remain to the MediaKeys object, the MediaKeys |
| 55 // object will be finalized and the WeakMember<> references will be cleared |
| 56 // out(zeroed) by the garbage collector. |
| 54 // | 57 // |
| 55 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 58 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
| 56 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 59 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
| 57 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 60 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
| 58 class MediaKeySession final | 61 class MediaKeySession final |
| 59 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession
> | 62 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession
> |
| 60 , public ActiveDOMObject | 63 , public ActiveDOMObject |
| 61 , private WebContentDecryptionModuleSession::Client { | 64 , private WebContentDecryptionModuleSession::Client { |
| 62 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaKeySession>); | 65 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaKeySession>); |
| 63 DEFINE_WRAPPERTYPEINFO(); | 66 DEFINE_WRAPPERTYPEINFO(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato
r, RefPtrWillBeMember<DOMException>> ClosedPromise; | 137 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato
r, RefPtrWillBeMember<DOMException>> ClosedPromise; |
| 135 Member<ClosedPromise> m_closedPromise; | 138 Member<ClosedPromise> m_closedPromise; |
| 136 | 139 |
| 137 HeapDeque<Member<PendingAction>> m_pendingActions; | 140 HeapDeque<Member<PendingAction>> m_pendingActions; |
| 138 Timer<MediaKeySession> m_actionTimer; | 141 Timer<MediaKeySession> m_actionTimer; |
| 139 }; | 142 }; |
| 140 | 143 |
| 141 } // namespace blink | 144 } // namespace blink |
| 142 | 145 |
| 143 #endif // MediaKeySession_h | 146 #endif // MediaKeySession_h |
| OLD | NEW |