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/MediaKeySystemAccess.h" | 6 #include "modules/encryptedmedia/MediaKeySystemAccess.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
11 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
13 #include "modules/encryptedmedia/MediaKeys.h" | 13 #include "modules/encryptedmedia/MediaKeys.h" |
14 #include "modules/encryptedmedia/MediaKeysController.h" | 14 #include "modules/encryptedmedia/MediaKeysController.h" |
15 #include "platform/Logging.h" | 15 #include "platform/Logging.h" |
16 #include "platform/Timer.h" | 16 #include "platform/Timer.h" |
| 17 #include "platform/heap/Handle.h" |
17 #include "public/platform/WebContentDecryptionModule.h" | 18 #include "public/platform/WebContentDecryptionModule.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 // This class allows a MediaKeys object to be created asynchronously. | 22 // This class allows a MediaKeys object to be created asynchronously. |
22 class MediaKeysInitializer final : public blink::ScriptPromiseResolver { | 23 class MediaKeysInitializer final : public blink::ScriptPromiseResolver { |
23 WTF_MAKE_NONCOPYABLE(MediaKeysInitializer); | 24 WTF_MAKE_NONCOPYABLE(MediaKeysInitializer); |
24 | 25 |
25 public: | 26 public: |
26 static blink::ScriptPromise create(blink::ScriptState*, const String& keySys
tem); | 27 static blink::ScriptPromise create(blink::ScriptState*, const String& keySys
tem); |
27 virtual ~MediaKeysInitializer(); | 28 virtual ~MediaKeysInitializer(); |
28 | 29 |
29 private: | 30 private: |
30 MediaKeysInitializer(blink::ScriptState*, const String& keySystem); | 31 MediaKeysInitializer(blink::ScriptState*, const String& keySystem); |
31 void timerFired(blink::Timer<MediaKeysInitializer>*); | 32 void timerFired(blink::Timer<MediaKeysInitializer>*); |
32 | 33 |
33 const String m_keySystem; | 34 const String m_keySystem; |
34 blink::Timer<MediaKeysInitializer> m_timer; | 35 blink::Timer<MediaKeysInitializer> m_timer; |
35 }; | 36 }; |
36 | 37 |
37 blink::ScriptPromise MediaKeysInitializer::create(blink::ScriptState* scriptStat
e, const String& keySystem) | 38 blink::ScriptPromise MediaKeysInitializer::create(blink::ScriptState* scriptStat
e, const String& keySystem) |
38 { | 39 { |
39 RefPtr<MediaKeysInitializer> initializer = adoptRef(new MediaKeysInitializer
(scriptState, keySystem)); | 40 RefPtrWillBeRawPtr<MediaKeysInitializer> initializer = blink::adoptRefWillBe
Noop(new MediaKeysInitializer(scriptState, keySystem)); |
40 initializer->suspendIfNeeded(); | 41 initializer->suspendIfNeeded(); |
41 initializer->keepAliveWhilePending(); | 42 initializer->keepAliveWhilePending(); |
42 return initializer->promise(); | 43 return initializer->promise(); |
43 } | 44 } |
44 | 45 |
45 MediaKeysInitializer::MediaKeysInitializer(blink::ScriptState* scriptState, cons
t String& keySystem) | 46 MediaKeysInitializer::MediaKeysInitializer(blink::ScriptState* scriptState, cons
t String& keySystem) |
46 : blink::ScriptPromiseResolver(scriptState) | 47 : blink::ScriptPromiseResolver(scriptState) |
47 , m_keySystem(keySystem) | 48 , m_keySystem(keySystem) |
48 , m_timer(this, &MediaKeysInitializer::timerFired) | 49 , m_timer(this, &MediaKeysInitializer::timerFired) |
49 { | 50 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // 2. Asynchronously create and initialize the MediaKeys object. | 113 // 2. Asynchronously create and initialize the MediaKeys object. |
113 // 3. Return promise. | 114 // 3. Return promise. |
114 return MediaKeysInitializer::create(scriptState, m_keySystem); | 115 return MediaKeysInitializer::create(scriptState, m_keySystem); |
115 } | 116 } |
116 | 117 |
117 void MediaKeySystemAccess::trace(Visitor*) | 118 void MediaKeySystemAccess::trace(Visitor*) |
118 { | 119 { |
119 } | 120 } |
120 | 121 |
121 } // namespace blink | 122 } // namespace blink |
OLD | NEW |