| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" | 6 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 private: | 56 private: |
| 57 SetMediaKeysHandler(ScriptState*, HTMLMediaElement&, MediaKeys*); | 57 SetMediaKeysHandler(ScriptState*, HTMLMediaElement&, MediaKeys*); |
| 58 void timerFired(Timer<SetMediaKeysHandler>*); | 58 void timerFired(Timer<SetMediaKeysHandler>*); |
| 59 | 59 |
| 60 void clearExistingMediaKeys(); | 60 void clearExistingMediaKeys(); |
| 61 void setNewMediaKeys(); | 61 void setNewMediaKeys(); |
| 62 void finish(); | 62 void finish(); |
| 63 | 63 |
| 64 void reportSetFailed(ExceptionCode, const String& errorMessage); | 64 void reportSetFailed(ExceptionCode, const String& errorMessage); |
| 65 | 65 |
| 66 RawPtrWillBeMember<HTMLMediaElement> m_element; | 66 // Keep media element alive until promise is fulfilled |
| 67 RefPtrWillBePersistent<HTMLMediaElement> m_element; |
| 67 Persistent<MediaKeys> m_newMediaKeys; | 68 Persistent<MediaKeys> m_newMediaKeys; |
| 68 Timer<SetMediaKeysHandler> m_timer; | 69 Timer<SetMediaKeysHandler> m_timer; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 typedef Function<void()> SuccessCallback; | 72 typedef Function<void()> SuccessCallback; |
| 72 typedef Function<void(ExceptionCode, const String&)> FailureCallback; | 73 typedef Function<void(ExceptionCode, const String&)> FailureCallback; |
| 73 | 74 |
| 74 // Represents the result used when setContentDecryptionModule() is called. | 75 // Represents the result used when setContentDecryptionModule() is called. |
| 75 // Calls |success| if result is resolved, |failure| is result is rejected. | 76 // Calls |success| if result is resolved, |failure| is result is rejected. |
| 76 class SetContentDecryptionModuleResult FINAL : public ContentDecryptionModuleRes
ult { | 77 class SetContentDecryptionModuleResult FINAL : public ContentDecryptionModuleRes
ult { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 return thisElement.contentDecryptionModule(); | 541 return thisElement.contentDecryptionModule(); |
| 541 } | 542 } |
| 542 | 543 |
| 543 void HTMLMediaElementEncryptedMedia::trace(Visitor* visitor) | 544 void HTMLMediaElementEncryptedMedia::trace(Visitor* visitor) |
| 544 { | 545 { |
| 545 visitor->trace(m_mediaKeys); | 546 visitor->trace(m_mediaKeys); |
| 546 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); | 547 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); |
| 547 } | 548 } |
| 548 | 549 |
| 549 } // namespace blink | 550 } // namespace blink |
| OLD | NEW |