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

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

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

Powered by Google App Engine
This is Rietveld 408576698