| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession | 59 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession |
| 60 // keep references to each other, and then having to inform the other object | 60 // keep references to each other, and then having to inform the other object |
| 61 // when it gets destroyed. | 61 // when it gets destroyed. |
| 62 // | 62 // |
| 63 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 63 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
| 64 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 64 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
| 65 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 65 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
| 66 class MediaKeySession FINAL | 66 class MediaKeySession FINAL |
| 67 : public RefCountedWillBeRefCountedGarbageCollected<MediaKeySession>, public
ActiveDOMObject, public ScriptWrappable, public EventTargetWithInlineData | 67 : public RefCountedWillBeRefCountedGarbageCollected<MediaKeySession>, public
ActiveDOMObject, public ScriptWrappable, public EventTargetWithInlineData |
| 68 , private blink::WebContentDecryptionModuleSession::Client { | 68 , private blink::WebContentDecryptionModuleSession::Client { |
| 69 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<M
ediaKeySession>); | 69 REFCOUNTED_EVENT_TARGET(MediaKeySession); |
| 70 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
| 70 public: | 71 public: |
| 71 static PassRefPtrWillBeRawPtr<MediaKeySession> create(ExecutionContext*, bli
nk::WebContentDecryptionModule*, WeakPtrWillBeRawPtr<MediaKeys>); | 72 static PassRefPtrWillBeRawPtr<MediaKeySession> create(ExecutionContext*, bli
nk::WebContentDecryptionModule*, WeakPtrWillBeRawPtr<MediaKeys>); |
| 72 virtual ~MediaKeySession(); | 73 virtual ~MediaKeySession(); |
| 73 | 74 |
| 74 const String& keySystem() const { return m_keySystem; } | 75 const String& keySystem() const { return m_keySystem; } |
| 75 String sessionId() const; | 76 String sessionId() const; |
| 76 | 77 |
| 77 void setError(MediaKeyError*); | 78 void setError(MediaKeyError*); |
| 78 MediaKeyError* error() { return m_error.get(); } | 79 MediaKeyError* error() { return m_error.get(); } |
| 79 | 80 |
| 80 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); | 81 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); |
| 81 void update(Uint8Array* response, ExceptionState&); | 82 void update(Uint8Array* response, ExceptionState&); |
| 82 void release(ExceptionState&); | 83 void release(ExceptionState&); |
| 83 | 84 |
| 84 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 85 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
| 85 | 86 |
| 86 // EventTarget | 87 // EventTarget |
| 87 virtual const AtomicString& interfaceName() const OVERRIDE; | 88 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 88 virtual ExecutionContext* executionContext() const OVERRIDE; | 89 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 89 | 90 |
| 90 // ActiveDOMObject | 91 // ActiveDOMObject |
| 91 virtual bool hasPendingActivity() const OVERRIDE; | 92 virtual bool hasPendingActivity() const OVERRIDE; |
| 92 virtual void stop() OVERRIDE; | 93 virtual void stop() OVERRIDE; |
| 93 | 94 |
| 94 void trace(Visitor*); | 95 virtual void trace(Visitor*) OVERRIDE; |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 // A struct holding the pending action. | 98 // A struct holding the pending action. |
| 98 struct PendingAction { | 99 struct PendingAction { |
| 99 enum Type { | 100 enum Type { |
| 100 Update, | 101 Update, |
| 101 Release | 102 Release |
| 102 }; | 103 }; |
| 103 const Type type; | 104 const Type type; |
| 104 const RefPtr<Uint8Array> data; | 105 const RefPtr<Uint8Array> data; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 131 // Is the CDM finished with this session? | 132 // Is the CDM finished with this session? |
| 132 bool m_isClosed; | 133 bool m_isClosed; |
| 133 | 134 |
| 134 Deque<OwnPtr<PendingAction> > m_pendingActions; | 135 Deque<OwnPtr<PendingAction> > m_pendingActions; |
| 135 Timer<MediaKeySession> m_actionTimer; | 136 Timer<MediaKeySession> m_actionTimer; |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 } | 139 } |
| 139 | 140 |
| 140 #endif // MediaKeySession_h | 141 #endif // MediaKeySession_h |
| OLD | NEW |