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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp

Issue 2407013002: EME: Improve promise lifetime (Closed)
Patch Set: remove m_contextDestroyed Created 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/encryptedmedia/MediaKeySystemAccess.h" 5 #include "modules/encryptedmedia/MediaKeySystemAccess.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 27 matching lines...) Expand all
38 ScriptState* scriptState, 38 ScriptState* scriptState,
39 const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes) 39 const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes)
40 : ContentDecryptionModuleResultPromise(scriptState), 40 : ContentDecryptionModuleResultPromise(scriptState),
41 m_supportedSessionTypes(supportedSessionTypes) {} 41 m_supportedSessionTypes(supportedSessionTypes) {}
42 42
43 ~NewCdmResultPromise() override {} 43 ~NewCdmResultPromise() override {}
44 44
45 // ContentDecryptionModuleResult implementation. 45 // ContentDecryptionModuleResult implementation.
46 void completeWithContentDecryptionModule( 46 void completeWithContentDecryptionModule(
47 WebContentDecryptionModule* cdm) override { 47 WebContentDecryptionModule* cdm) override {
48 // NOTE: Continued from step 2.8 of createMediaKeys(). 48 // NOTE: Continued from step 2.8 of createMediaKeys().
xhwang 2016/10/13 19:29:59 empty line here since this is not specific to l.49
jrummell 2016/10/14 00:03:32 Done.
49 if (!isValidToFulfillPromise())
50 return;
xhwang 2016/10/13 19:29:59 ditto
jrummell 2016/10/14 00:03:32 We don't want to create the MediaKeys object if we
51
49 // 2.9. Let media keys be a new MediaKeys object. 52 // 2.9. Let media keys be a new MediaKeys object.
50 MediaKeys* mediaKeys = MediaKeys::create( 53 MediaKeys* mediaKeys = MediaKeys::create(
51 getExecutionContext(), m_supportedSessionTypes, wrapUnique(cdm)); 54 getExecutionContext(), m_supportedSessionTypes, wrapUnique(cdm));
52 55
53 // 2.10. Resolve promise with media keys. 56 // 2.10. Resolve promise with media keys.
54 resolve(mediaKeys); 57 resolve(mediaKeys);
55 } 58 }
56 59
57 private: 60 private:
58 WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; 61 WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // (Done if completeWithException() called). 163 // (Done if completeWithException() called).
161 m_access->createContentDecryptionModule(helper->result()); 164 m_access->createContentDecryptionModule(helper->result());
162 165
163 // 3. Return promise. 166 // 3. Return promise.
164 return promise; 167 return promise;
165 } 168 }
166 169
167 DEFINE_TRACE(MediaKeySystemAccess) {} 170 DEFINE_TRACE(MediaKeySystemAccess) {}
168 171
169 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698