Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 // it may outlive any JavaScript references as long as the MediaKeys object is a live. | 60 // it may outlive any JavaScript references as long as the MediaKeys object is a live. |
| 61 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 61 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
| 62 class MediaKeySession final | 62 class MediaKeySession final |
| 63 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession > | 63 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession > |
| 64 , public ActiveScriptWrappable | 64 , public ActiveScriptWrappable |
| 65 , public ActiveDOMObject | 65 , public ActiveDOMObject |
| 66 , private WebContentDecryptionModuleSession::Client { | 66 , private WebContentDecryptionModuleSession::Client { |
| 67 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaKeySession); | 67 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaKeySession); |
| 68 DEFINE_WRAPPERTYPEINFO(); | 68 DEFINE_WRAPPERTYPEINFO(); |
| 69 USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); | 69 USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
| 70 USING_PRE_FINALIZER(MediaKeySession, dispose); | |
| 70 public: | 71 public: |
| 71 static MediaKeySession* create(ScriptState*, MediaKeys*, WebEncryptedMediaSe ssionType); | 72 static MediaKeySession* create(ScriptState*, MediaKeys*, WebEncryptedMediaSe ssionType); |
| 72 ~MediaKeySession() override; | 73 ~MediaKeySession() override; |
| 73 | 74 |
| 74 String sessionId() const; | 75 String sessionId() const; |
| 75 double expiration() const { return m_expiration; } | 76 double expiration() const { return m_expiration; } |
| 76 ScriptPromise closed(ScriptState*); | 77 ScriptPromise closed(ScriptState*); |
| 77 MediaKeyStatusMap* keyStatuses(); | 78 MediaKeyStatusMap* keyStatuses(); |
| 78 | 79 |
| 79 ScriptPromise generateRequest(ScriptState*, const String& initDataType, cons t DOMArrayPiece& initData); | 80 ScriptPromise generateRequest(ScriptState*, const String& initDataType, cons t DOMArrayPiece& initData); |
| 80 ScriptPromise load(ScriptState*, const String& sessionId); | 81 ScriptPromise load(ScriptState*, const String& sessionId); |
| 81 | 82 |
| 82 ScriptPromise update(ScriptState*, const DOMArrayPiece& response); | 83 ScriptPromise update(ScriptState*, const DOMArrayPiece& response); |
| 83 ScriptPromise close(ScriptState*); | 84 ScriptPromise close(ScriptState*); |
| 84 ScriptPromise remove(ScriptState*); | 85 ScriptPromise remove(ScriptState*); |
| 85 | 86 |
| 86 // EventTarget | 87 // EventTarget |
| 87 const AtomicString& interfaceName() const override; | 88 const AtomicString& interfaceName() const override; |
| 88 ExecutionContext* getExecutionContext() const override; | 89 ExecutionContext* getExecutionContext() const override; |
| 89 | 90 |
| 90 // ActiveScriptWrappable | 91 // ActiveScriptWrappable |
| 91 bool hasPendingActivity() const final; | 92 bool hasPendingActivity() const final; |
| 92 | 93 |
| 93 // ActiveDOMObject | 94 // ActiveDOMObject |
| 94 void stop() override; | 95 void stop() override; |
| 95 | 96 |
| 96 // Oilpan: eagerly release owned m_session, which in turn | |
|
sof
2016/04/11 06:23:32
It is worth preserving these EAGERLY_FINALIZE() co
| |
| 97 // drops the client reference back to this MediaKeySession object. | |
| 98 EAGERLY_FINALIZE(); | |
| 99 DECLARE_VIRTUAL_TRACE(); | 97 DECLARE_VIRTUAL_TRACE(); |
| 100 | 98 |
| 101 private: | 99 private: |
| 102 class PendingAction; | 100 class PendingAction; |
| 103 friend class NewSessionResultPromise; | 101 friend class NewSessionResultPromise; |
| 104 friend class LoadSessionResultPromise; | 102 friend class LoadSessionResultPromise; |
| 105 | 103 |
| 106 MediaKeySession(ScriptState*, MediaKeys*, WebEncryptedMediaSessionType); | 104 MediaKeySession(ScriptState*, MediaKeys*, WebEncryptedMediaSessionType); |
| 105 void dispose(); | |
| 107 | 106 |
| 108 void actionTimerFired(Timer<MediaKeySession>*); | 107 void actionTimerFired(Timer<MediaKeySession>*); |
| 109 | 108 |
| 110 // WebContentDecryptionModuleSession::Client | 109 // WebContentDecryptionModuleSession::Client |
| 111 void message(MessageType, const unsigned char* message, size_t messageLength ) override; | 110 void message(MessageType, const unsigned char* message, size_t messageLength ) override; |
| 112 void close() override; | 111 void close() override; |
| 113 void expirationChanged(double updatedExpiryTimeInMS) override; | 112 void expirationChanged(double updatedExpiryTimeInMS) override; |
| 114 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, b ool hasAdditionalUsableKey) override; | 113 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, b ool hasAdditionalUsableKey) override; |
| 115 | 114 |
| 116 // Called by NewSessionResult when the new session has been created. | 115 // Called by NewSessionResult when the new session has been created. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 139 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato r, Member<DOMException>> ClosedPromise; | 138 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato r, Member<DOMException>> ClosedPromise; |
| 140 Member<ClosedPromise> m_closedPromise; | 139 Member<ClosedPromise> m_closedPromise; |
| 141 | 140 |
| 142 HeapDeque<Member<PendingAction>> m_pendingActions; | 141 HeapDeque<Member<PendingAction>> m_pendingActions; |
| 143 Timer<MediaKeySession> m_actionTimer; | 142 Timer<MediaKeySession> m_actionTimer; |
| 144 }; | 143 }; |
| 145 | 144 |
| 146 } // namespace blink | 145 } // namespace blink |
| 147 | 146 |
| 148 #endif // MediaKeySession_h | 147 #endif // MediaKeySession_h |
| OLD | NEW |