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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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"
11 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" 11 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h"
12 #include "modules/encryptedmedia/EncryptedMediaUtils.h" 12 #include "modules/encryptedmedia/EncryptedMediaUtils.h"
13 #include "modules/encryptedmedia/MediaKeySession.h" 13 #include "modules/encryptedmedia/MediaKeySession.h"
14 #include "modules/encryptedmedia/MediaKeys.h" 14 #include "modules/encryptedmedia/MediaKeys.h"
15 #include "modules/encryptedmedia/MediaKeysController.h" 15 #include "modules/encryptedmedia/MediaKeysController.h"
16 #include "platform/Logging.h" 16 #include "platform/Logging.h"
17 #include "platform/Timer.h" 17 #include "platform/Timer.h"
18 #include "public/platform/WebContentDecryptionModule.h" 18 #include "public/platform/WebContentDecryptionModule.h"
19 #include "public/platform/WebEncryptedMediaTypes.h" 19 #include "public/platform/WebEncryptedMediaTypes.h"
20 #include "public/platform/WebMediaKeySystemConfiguration.h" 20 #include "public/platform/WebMediaKeySystemConfiguration.h"
21 #include "wtf/PtrUtil.h"
22 #include <memory>
21 23
22 namespace blink { 24 namespace blink {
23 25
24 namespace { 26 namespace {
25 27
26 // This class wraps the promise resolver used when creating MediaKeys 28 // This class wraps the promise resolver used when creating MediaKeys
27 // and is passed to Chromium to fullfill the promise. This implementation of 29 // and is passed to Chromium to fullfill the promise. This implementation of
28 // completeWithCdm() will resolve the promise with a new MediaKeys object, 30 // completeWithCdm() will resolve the promise with a new MediaKeys object,
29 // while completeWithError() will reject the promise with an exception. 31 // while completeWithError() will reject the promise with an exception.
30 // All other complete methods are not expected to be called, and will 32 // All other complete methods are not expected to be called, and will
(...skipping 10 matching lines...) Expand all
41 43
42 ~NewCdmResultPromise() override 44 ~NewCdmResultPromise() override
43 { 45 {
44 } 46 }
45 47
46 // ContentDecryptionModuleResult implementation. 48 // ContentDecryptionModuleResult implementation.
47 void completeWithContentDecryptionModule(WebContentDecryptionModule* cdm) ov erride 49 void completeWithContentDecryptionModule(WebContentDecryptionModule* cdm) ov erride
48 { 50 {
49 // NOTE: Continued from step 2.8 of createMediaKeys(). 51 // NOTE: Continued from step 2.8 of createMediaKeys().
50 // 2.9. Let media keys be a new MediaKeys object. 52 // 2.9. Let media keys be a new MediaKeys object.
51 MediaKeys* mediaKeys = MediaKeys::create(getExecutionContext(), m_suppor tedSessionTypes, adoptPtr(cdm)); 53 MediaKeys* mediaKeys = MediaKeys::create(getExecutionContext(), m_suppor tedSessionTypes, wrapUnique(cdm));
52 54
53 // 2.10. Resolve promise with media keys. 55 // 2.10. Resolve promise with media keys.
54 resolve(mediaKeys); 56 resolve(mediaKeys);
55 } 57 }
56 58
57 private: 59 private:
58 WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; 60 WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes;
59 }; 61 };
60 62
61 // These methods are the inverses of those with the same names in 63 // These methods are the inverses of those with the same names in
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 static Vector<String> convertSessionTypes(const WebVector<WebEncryptedMediaSessi onType>& sessionTypes) 100 static Vector<String> convertSessionTypes(const WebVector<WebEncryptedMediaSessi onType>& sessionTypes)
99 { 101 {
100 Vector<String> result(sessionTypes.size()); 102 Vector<String> result(sessionTypes.size());
101 for (size_t i = 0; i < sessionTypes.size(); i++) 103 for (size_t i = 0; i < sessionTypes.size(); i++)
102 result[i] = EncryptedMediaUtils::convertFromSessionType(sessionTypes[i]) ; 104 result[i] = EncryptedMediaUtils::convertFromSessionType(sessionTypes[i]) ;
103 return result; 105 return result;
104 } 106 }
105 107
106 } // namespace 108 } // namespace
107 109
108 MediaKeySystemAccess::MediaKeySystemAccess(const String& keySystem, PassOwnPtr<W ebContentDecryptionModuleAccess> access) 110 MediaKeySystemAccess::MediaKeySystemAccess(const String& keySystem, std::unique_ ptr<WebContentDecryptionModuleAccess> access)
109 : m_keySystem(keySystem) 111 : m_keySystem(keySystem)
110 , m_access(std::move(access)) 112 , m_access(std::move(access))
111 { 113 {
112 } 114 }
113 115
114 MediaKeySystemAccess::~MediaKeySystemAccess() 116 MediaKeySystemAccess::~MediaKeySystemAccess()
115 { 117 {
116 } 118 }
117 119
118 void MediaKeySystemAccess::getConfiguration(MediaKeySystemConfiguration& result) 120 void MediaKeySystemAccess::getConfiguration(MediaKeySystemConfiguration& result)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 163
162 // 3. Return promise. 164 // 3. Return promise.
163 return promise; 165 return promise;
164 } 166 }
165 167
166 DEFINE_TRACE(MediaKeySystemAccess) 168 DEFINE_TRACE(MediaKeySystemAccess)
167 { 169 {
168 } 170 }
169 171
170 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698