Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: Source/modules/encryptedmedia/MediaKeySession.h

Issue 641433002: Implement MediaKeySession.load() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: initialize variable for Windows Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
59 // 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.
60 // The WebContentDecryptionModuleSession has the same lifetime as this object. 60 // The WebContentDecryptionModuleSession has the same lifetime as this object.
61 class MediaKeySession final 61 class MediaKeySession final
62 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS ession>, public ActiveDOMObject, public EventTargetWithInlineData 62 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS ession>, public ActiveDOMObject, public EventTargetWithInlineData
63 , private WebContentDecryptionModuleSession::Client { 63 , private WebContentDecryptionModuleSession::Client {
64 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M ediaKeySession>); 64 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M ediaKeySession>);
65 DEFINE_WRAPPERTYPEINFO(); 65 DEFINE_WRAPPERTYPEINFO();
66 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); 66 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession);
67 public: 67 public:
68 static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessi onType); 68 static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessi onType);
69 static bool isValidSessionType(const String& sessionType);
69 virtual ~MediaKeySession(); 70 virtual ~MediaKeySession();
70 71
71 const String& keySystem() const { return m_keySystem; } 72 const String& keySystem() const { return m_keySystem; }
72 String sessionId() const; 73 String sessionId() const;
73 double expiration() const { return m_expiration; } 74 double expiration() const { return m_expiration; }
74 ScriptPromise closed(ScriptState*); 75 ScriptPromise closed(ScriptState*);
75 76
76 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBuffer* initData); 77 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBuffer* initData);
77 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBufferView* initData); 78 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBufferView* initData);
79 ScriptPromise load(ScriptState*, const String& sessionId);
78 80
79 void setError(MediaKeyError*); 81 void setError(MediaKeyError*);
80 MediaKeyError* error() { return m_error.get(); } 82 MediaKeyError* error() { return m_error.get(); }
81 83
82 ScriptPromise update(ScriptState*, ArrayBuffer* response); 84 ScriptPromise update(ScriptState*, ArrayBuffer* response);
83 ScriptPromise update(ScriptState*, ArrayBufferView* response); 85 ScriptPromise update(ScriptState*, ArrayBufferView* response);
84 ScriptPromise close(ScriptState*); 86 ScriptPromise close(ScriptState*);
85 ScriptPromise remove(ScriptState*); 87 ScriptPromise remove(ScriptState*);
86 88
87 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); 89 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>);
88 90
89 // EventTarget 91 // EventTarget
90 virtual const AtomicString& interfaceName() const override; 92 virtual const AtomicString& interfaceName() const override;
91 virtual ExecutionContext* executionContext() const override; 93 virtual ExecutionContext* executionContext() const override;
92 94
93 // ActiveDOMObject 95 // ActiveDOMObject
94 virtual bool hasPendingActivity() const override; 96 virtual bool hasPendingActivity() const override;
95 virtual void stop() override; 97 virtual void stop() override;
96 98
97 virtual void trace(Visitor*) override; 99 virtual void trace(Visitor*) override;
98 100
99 private: 101 private:
100 class PendingAction; 102 class PendingAction;
101 friend class NewSessionResult; 103 friend class NewSessionResult;
104 friend class LoadSessionResult;
102 105
103 MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType); 106 MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType);
104 107
105 void actionTimerFired(Timer<MediaKeySession>*); 108 void actionTimerFired(Timer<MediaKeySession>*);
106 109
107 // WebContentDecryptionModuleSession::Client 110 // WebContentDecryptionModuleSession::Client
108 virtual void message(const unsigned char* message, size_t messageLength, con st WebURL& destinationURL) override; 111 virtual void message(const unsigned char* message, size_t messageLength, con st WebURL& destinationURL) override;
109 virtual void ready() override; 112 virtual void ready() override;
110 virtual void close() override; 113 virtual void close() override;
111 virtual void error(MediaKeyErrorCode, unsigned long systemCode) override; 114 virtual void error(MediaKeyErrorCode, unsigned long systemCode) override;
112 virtual void error(WebContentDecryptionModuleException, unsigned long system Code, const WebString& errorMessage) override; 115 virtual void error(WebContentDecryptionModuleException, unsigned long system Code, const WebString& errorMessage) override;
113 virtual void expirationChanged(double updatedExpiryTimeInMS) override; 116 virtual void expirationChanged(double updatedExpiryTimeInMS) override;
114 117
115 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy pe, PassRefPtr<ArrayBuffer> initData); 118 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy pe, PassRefPtr<ArrayBuffer> initData);
116 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response) ; 119 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response) ;
117 120
118 // Called by NewSessionResult when the new sesison has been created. 121 // Called by NewSessionResult when the new session has been created.
119 void finishGenerateRequest(); 122 void finishGenerateRequest();
120 123
124 // Called by LoadSessionResult when the session has been loaded.
125 void finishLoad();
126
121 String m_keySystem; 127 String m_keySystem;
122 RefPtrWillBeMember<MediaKeyError> m_error; 128 RefPtrWillBeMember<MediaKeyError> m_error;
123 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; 129 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
124 OwnPtr<WebContentDecryptionModuleSession> m_session; 130 OwnPtr<WebContentDecryptionModuleSession> m_session;
125 131
126 // Used to determine if MediaKeys is still active. 132 // Used to determine if MediaKeys is still active.
127 WeakMember<MediaKeys> m_mediaKeys; 133 WeakMember<MediaKeys> m_mediaKeys;
128 134
129 // Session properties. 135 // Session properties.
130 String m_sessionType; 136 String m_sessionType;
131 double m_expiration; 137 double m_expiration;
132 138
133 // Session states. 139 // Session states.
134 bool m_isUninitialized; 140 bool m_isUninitialized;
135 bool m_isCallable; 141 bool m_isCallable;
136 bool m_isClosed; // Is the CDM finished with this session? 142 bool m_isClosed; // Is the CDM finished with this session?
137 143
138 // Keep track of the closed promise. 144 // Keep track of the closed promise.
139 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP trWillBeMember<DOMException> > ClosedPromise; 145 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP trWillBeMember<DOMException> > ClosedPromise;
140 Member<ClosedPromise> m_closedPromise; 146 Member<ClosedPromise> m_closedPromise;
141 147
142 HeapDeque<Member<PendingAction> > m_pendingActions; 148 HeapDeque<Member<PendingAction> > m_pendingActions;
143 Timer<MediaKeySession> m_actionTimer; 149 Timer<MediaKeySession> m_actionTimer;
144 }; 150 };
145 151
146 } // namespace blink 152 } // namespace blink
147 153
148 #endif // MediaKeySession_h 154 #endif // MediaKeySession_h
OLDNEW
« no previous file with comments | « LayoutTests/media/encrypted-media/encrypted-media-v2-syntax.html ('k') | Source/modules/encryptedmedia/MediaKeySession.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698