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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.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 /* 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 20 matching lines...) Expand all
31 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
32 #include "core/dom/ExecutionContext.h" 32 #include "core/dom/ExecutionContext.h"
33 #include "core/html/HTMLMediaElement.h" 33 #include "core/html/HTMLMediaElement.h"
34 #include "modules/encryptedmedia/EncryptedMediaUtils.h" 34 #include "modules/encryptedmedia/EncryptedMediaUtils.h"
35 #include "modules/encryptedmedia/MediaKeySession.h" 35 #include "modules/encryptedmedia/MediaKeySession.h"
36 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResultPromise.h" 36 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResultPromise.h"
37 #include "platform/Logging.h" 37 #include "platform/Logging.h"
38 #include "platform/Timer.h" 38 #include "platform/Timer.h"
39 #include "public/platform/WebContentDecryptionModule.h" 39 #include "public/platform/WebContentDecryptionModule.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 #include <memory>
41 42
42 #define MEDIA_KEYS_LOG_LEVEL 3 43 #define MEDIA_KEYS_LOG_LEVEL 3
43 44
44 namespace blink { 45 namespace blink {
45 46
46 // A class holding a pending action. 47 // A class holding a pending action.
47 class MediaKeys::PendingAction final : public GarbageCollected<MediaKeys::Pendin gAction> { 48 class MediaKeys::PendingAction final : public GarbageCollected<MediaKeys::Pendin gAction> {
48 public: 49 public:
49 const Persistent<ContentDecryptionModuleResult> result() const 50 const Persistent<ContentDecryptionModuleResult> result() const
50 { 51 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // false." So convert any NOTSUPPORTEDERROR into resolving with false. 110 // false." So convert any NOTSUPPORTEDERROR into resolving with false.
110 if (exceptionCode == WebContentDecryptionModuleExceptionNotSupportedErro r) { 111 if (exceptionCode == WebContentDecryptionModuleExceptionNotSupportedErro r) {
111 resolve(false); 112 resolve(false);
112 return; 113 return;
113 } 114 }
114 115
115 ContentDecryptionModuleResultPromise::completeWithError(exceptionCode, s ystemCode, errorMessage); 116 ContentDecryptionModuleResultPromise::completeWithError(exceptionCode, s ystemCode, errorMessage);
116 } 117 }
117 }; 118 };
118 119
119 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry ptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionMod ule> cdm) 120 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry ptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecrypti onModule> cdm)
120 { 121 {
121 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::mo ve(cdm)); 122 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::mo ve(cdm));
122 mediaKeys->suspendIfNeeded(); 123 mediaKeys->suspendIfNeeded();
123 return mediaKeys; 124 return mediaKeys;
124 } 125 }
125 126
126 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm ) 127 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi aSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule > cdm)
127 : ActiveScriptWrappable(this) 128 : ActiveScriptWrappable(this)
128 , ActiveDOMObject(context) 129 , ActiveDOMObject(context)
129 , m_supportedSessionTypes(supportedSessionTypes) 130 , m_supportedSessionTypes(supportedSessionTypes)
130 , m_cdm(std::move(cdm)) 131 , m_cdm(std::move(cdm))
131 , m_mediaElement(nullptr) 132 , m_mediaElement(nullptr)
132 , m_reservedForMediaElement(false) 133 , m_reservedForMediaElement(false)
133 , m_timer(this, &MediaKeys::timerFired) 134 , m_timer(this, &MediaKeys::timerFired)
134 { 135 {
135 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 136 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")";
136 } 137 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 void MediaKeys::stop() 301 void MediaKeys::stop()
301 { 302 {
302 ActiveDOMObject::stop(); 303 ActiveDOMObject::stop();
303 304
304 if (m_timer.isActive()) 305 if (m_timer.isActive())
305 m_timer.stop(); 306 m_timer.stop();
306 m_pendingActions.clear(); 307 m_pendingActions.clear();
307 } 308 }
308 309
309 } // namespace blink 310 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698