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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 public: | 57 public: |
58 static PassRefPtr<MediaKeySession> create(ExecutionContext*, ContentDecrypti
onModule*, MediaKeys*); | 58 static PassRefPtr<MediaKeySession> create(ExecutionContext*, ContentDecrypti
onModule*, MediaKeys*); |
59 virtual ~MediaKeySession(); | 59 virtual ~MediaKeySession(); |
60 | 60 |
61 const String& keySystem() const { return m_keySystem; } | 61 const String& keySystem() const { return m_keySystem; } |
62 String sessionId() const; | 62 String sessionId() const; |
63 | 63 |
64 void setError(MediaKeyError*); | 64 void setError(MediaKeyError*); |
65 MediaKeyError* error() { return m_error.get(); } | 65 MediaKeyError* error() { return m_error.get(); } |
66 | 66 |
67 void initializeNewSession(const String& mimeType, Uint8Array* initData); | 67 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); |
68 void update(Uint8Array* response, ExceptionState&); | 68 void update(Uint8Array* response, ExceptionState&); |
69 void release(ExceptionState&); | 69 void release(ExceptionState&); |
70 | 70 |
71 void enqueueEvent(PassRefPtr<Event>); | 71 void enqueueEvent(PassRefPtr<Event>); |
72 | 72 |
73 virtual const AtomicString& interfaceName() const OVERRIDE; | 73 virtual const AtomicString& interfaceName() const OVERRIDE; |
74 virtual ExecutionContext* executionContext() const OVERRIDE; | 74 virtual ExecutionContext* executionContext() const OVERRIDE; |
75 | 75 |
76 private: | 76 private: |
77 MediaKeySession(ExecutionContext*, ContentDecryptionModule*, MediaKeys*); | 77 MediaKeySession(ExecutionContext*, ContentDecryptionModule*, MediaKeys*); |
78 void initializeNewSessionTimerFired(Timer<MediaKeySession>*); | |
79 void updateTimerFired(Timer<MediaKeySession>*); | 78 void updateTimerFired(Timer<MediaKeySession>*); |
80 | 79 |
81 // ContentDecryptionModuleSessionClient | 80 // ContentDecryptionModuleSessionClient |
82 virtual void message(const unsigned char* message, size_t messageLength, con
st KURL& destinationURL) OVERRIDE; | 81 virtual void message(const unsigned char* message, size_t messageLength, con
st KURL& destinationURL) OVERRIDE; |
83 virtual void ready() OVERRIDE; | 82 virtual void ready() OVERRIDE; |
84 virtual void close() OVERRIDE; | 83 virtual void close() OVERRIDE; |
85 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 84 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
86 | 85 |
87 String m_keySystem; | 86 String m_keySystem; |
88 RefPtr<MediaKeyError> m_error; | 87 RefPtr<MediaKeyError> m_error; |
89 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 88 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
90 OwnPtr<ContentDecryptionModuleSession> m_session; | 89 OwnPtr<ContentDecryptionModuleSession> m_session; |
91 // Used to remove the reference from the parent MediaKeys when close()'d. | 90 // Used to remove the reference from the parent MediaKeys when close()'d. |
92 MediaKeys* m_keys; | 91 MediaKeys* m_keys; |
93 | 92 |
94 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. | 93 Deque<RefPtr<Uint8Array> > m_pendingUpdates; |
95 // FIXME: Move the queue and timer to MediaKeys. | |
96 struct InitializeNewSessionData { | |
97 InitializeNewSessionData(const String& mimeType, Uint8Array* initData) :
mimeType(mimeType), initData(initData) { } | |
98 String mimeType; | |
99 RefPtr<Uint8Array> initData; | |
100 }; | |
101 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | |
102 Timer<MediaKeySession> m_initializeNewSessionTimer; | |
103 | |
104 Deque<RefPtr<Uint8Array> > m_pendingKeys; | |
105 Timer<MediaKeySession> m_updateTimer; | 94 Timer<MediaKeySession> m_updateTimer; |
106 }; | 95 }; |
107 | 96 |
108 } | 97 } |
109 | 98 |
110 #endif // MediaKeySession_h | 99 #endif // MediaKeySession_h |
OLD | NEW |