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

Side by Side Diff: Source/modules/encryptedmedia/MediaKeys.cpp

Issue 687533004: Simplify use of ContentDecryptionModuleResult with promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 #include "modules/encryptedmedia/MediaKeys.h" 27 #include "modules/encryptedmedia/MediaKeys.h"
28 28
29 #include "bindings/core/v8/ScriptState.h" 29 #include "bindings/core/v8/ScriptState.h"
30 #include "core/dom/DOMArrayBuffer.h" 30 #include "core/dom/DOMArrayBuffer.h"
31 #include "core/dom/DOMArrayBufferView.h" 31 #include "core/dom/DOMArrayBufferView.h"
32 #include "core/dom/DOMException.h" 32 #include "core/dom/DOMException.h"
33 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
34 #include "core/dom/ExecutionContext.h" 34 #include "core/dom/ExecutionContext.h"
35 #include "modules/encryptedmedia/MediaKeySession.h" 35 #include "modules/encryptedmedia/MediaKeySession.h"
36 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" 36 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResultPromise.h"
37 #include "platform/ContentType.h" 37 #include "platform/ContentType.h"
38 #include "platform/Logging.h" 38 #include "platform/Logging.h"
39 #include "platform/MIMETypeRegistry.h" 39 #include "platform/MIMETypeRegistry.h"
40 #include "platform/Timer.h" 40 #include "platform/Timer.h"
41 #include "public/platform/WebContentDecryptionModule.h" 41 #include "public/platform/WebContentDecryptionModule.h"
42 #include "wtf/RefPtr.h" 42 #include "wtf/RefPtr.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S tring& contentType) 46 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S tring& contentType)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // 2. If the keySystem does not support server certificates, return a 158 // 2. If the keySystem does not support server certificates, return a
159 // promise rejected with a new DOMException whose name is 159 // promise rejected with a new DOMException whose name is
160 // "NotSupportedError". 160 // "NotSupportedError".
161 // (Let the CDM decide whether to support this or not.) 161 // (Let the CDM decide whether to support this or not.)
162 162
163 // 3. Let certificate be a copy of the contents of the serverCertificate 163 // 3. Let certificate be a copy of the contents of the serverCertificate
164 // parameter. 164 // parameter.
165 // (Done in caller.) 165 // (Done in caller.)
166 166
167 // 4. Let promise be a new promise. 167 // 4. Let promise be a new promise.
168 SimpleContentDecryptionModuleResult* result = new SimpleContentDecryptionMod uleResult(scriptState); 168 SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryp tionModuleResultPromise(scriptState);
169 ScriptPromise promise = result->promise(); 169 ScriptPromise promise = result->promise();
170 170
171 // 5. Run the following steps asynchronously (documented in timerFired()). 171 // 5. Run the following steps asynchronously (documented in timerFired()).
172 m_pendingActions.append(PendingAction::CreatePendingSetServerCertificate(res ult, serverCertificate)); 172 m_pendingActions.append(PendingAction::CreatePendingSetServerCertificate(res ult, serverCertificate));
173 if (!m_timer.isActive()) 173 if (!m_timer.isActive())
174 m_timer.startOneShot(0, FROM_HERE); 174 m_timer.startOneShot(0, FROM_HERE);
175 175
176 // 6. Return promise. 176 // 6. Return promise.
177 return promise; 177 return promise;
178 } 178 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 void MediaKeys::contextDestroyed() 237 void MediaKeys::contextDestroyed()
238 { 238 {
239 ContextLifecycleObserver::contextDestroyed(); 239 ContextLifecycleObserver::contextDestroyed();
240 240
241 // We don't need the CDM anymore. 241 // We don't need the CDM anymore.
242 m_cdm.clear(); 242 m_cdm.clear();
243 } 243 }
244 244
245 } // namespace blink 245 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698