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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h

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 /* 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 "bindings/core/v8/ScriptWrappable.h" 31 #include "bindings/core/v8/ScriptWrappable.h"
32 #include "core/dom/ActiveDOMObject.h" 32 #include "core/dom/ActiveDOMObject.h"
33 #include "core/dom/DOMArrayPiece.h" 33 #include "core/dom/DOMArrayPiece.h"
34 #include "platform/Timer.h" 34 #include "platform/Timer.h"
35 #include "public/platform/WebContentDecryptionModule.h" 35 #include "public/platform/WebContentDecryptionModule.h"
36 #include "public/platform/WebEncryptedMediaTypes.h" 36 #include "public/platform/WebEncryptedMediaTypes.h"
37 #include "public/platform/WebString.h" 37 #include "public/platform/WebString.h"
38 #include "public/platform/WebVector.h" 38 #include "public/platform/WebVector.h"
39 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
40 #include "wtf/text/WTFString.h" 40 #include "wtf/text/WTFString.h"
41 #include <memory>
42 41
43 namespace blink { 42 namespace blink {
44 43
45 class ExceptionState; 44 class ExceptionState;
46 class ExecutionContext; 45 class ExecutionContext;
47 class HTMLMediaElement; 46 class HTMLMediaElement;
48 class MediaKeySession; 47 class MediaKeySession;
49 class ScriptState; 48 class ScriptState;
50 class WebContentDecryptionModule; 49 class WebContentDecryptionModule;
51 50
52 // References are held by JS and HTMLMediaElement. 51 // References are held by JS and HTMLMediaElement.
53 // The WebContentDecryptionModule has the same lifetime as this object. 52 // The WebContentDecryptionModule has the same lifetime as this object.
54 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ActiveScri ptWrappable, public ActiveDOMObject, public ScriptWrappable { 53 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ActiveScri ptWrappable, public ActiveDOMObject, public ScriptWrappable {
55 USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); 54 USING_GARBAGE_COLLECTED_MIXIN(MediaKeys);
56 DEFINE_WRAPPERTYPEINFO(); 55 DEFINE_WRAPPERTYPEINFO();
57 public: 56 public:
58 static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMedi aSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule >); 57 static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMedi aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>);
59 ~MediaKeys() override; 58 ~MediaKeys() override;
60 59
61 MediaKeySession* createSession(ScriptState*, const String& sessionTypeString , ExceptionState&); 60 MediaKeySession* createSession(ScriptState*, const String& sessionTypeString , ExceptionState&);
62 61
63 ScriptPromise setServerCertificate(ScriptState*, const DOMArrayPiece& server Certificate); 62 ScriptPromise setServerCertificate(ScriptState*, const DOMArrayPiece& server Certificate);
64 63
65 // Indicates that the provided HTMLMediaElement wants to use this object. 64 // Indicates that the provided HTMLMediaElement wants to use this object.
66 // Returns true if no other HTMLMediaElement currently references this 65 // Returns true if no other HTMLMediaElement currently references this
67 // object, false otherwise. If true, will take a weak reference to 66 // object, false otherwise. If true, will take a weak reference to
68 // HTMLMediaElement and expects the reservation to be accepted/cancelled 67 // HTMLMediaElement and expects the reservation to be accepted/cancelled
(...skipping 16 matching lines...) Expand all
85 // ActiveDOMObject implementation. 84 // ActiveDOMObject implementation.
86 // FIXME: This class could derive from ContextLifecycleObserver 85 // FIXME: This class could derive from ContextLifecycleObserver
87 // again (http://crbug.com/483722). 86 // again (http://crbug.com/483722).
88 void contextDestroyed() override; 87 void contextDestroyed() override;
89 void stop() override; 88 void stop() override;
90 89
91 // ActiveScriptWrappable implementation. 90 // ActiveScriptWrappable implementation.
92 bool hasPendingActivity() const final; 91 bool hasPendingActivity() const final;
93 92
94 private: 93 private:
95 MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule>); 94 MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>);
96 class PendingAction; 95 class PendingAction;
97 96
98 bool sessionTypeSupported(WebEncryptedMediaSessionType); 97 bool sessionTypeSupported(WebEncryptedMediaSessionType);
99 void timerFired(Timer<MediaKeys>*); 98 void timerFired(Timer<MediaKeys>*);
100 99
101 const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; 100 const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes;
102 std::unique_ptr<WebContentDecryptionModule> m_cdm; 101 OwnPtr<WebContentDecryptionModule> m_cdm;
103 102
104 // Keep track of the HTMLMediaElement that references this object. Keeping 103 // Keep track of the HTMLMediaElement that references this object. Keeping
105 // a WeakMember so that HTMLMediaElement's lifetime isn't dependent on 104 // a WeakMember so that HTMLMediaElement's lifetime isn't dependent on
106 // this object. 105 // this object.
107 // Note that the referenced HTMLMediaElement must be destroyed 106 // Note that the referenced HTMLMediaElement must be destroyed
108 // before this object. This is due to WebMediaPlayerImpl (owned by 107 // before this object. This is due to WebMediaPlayerImpl (owned by
109 // HTMLMediaElement) possibly having a pointer to Decryptor created 108 // HTMLMediaElement) possibly having a pointer to Decryptor created
110 // by WebContentDecryptionModuleImpl (owned by this object). 109 // by WebContentDecryptionModuleImpl (owned by this object).
111 WeakMember<HTMLMediaElement> m_mediaElement; 110 WeakMember<HTMLMediaElement> m_mediaElement;
112 111
113 // Keep track of whether this object has been reserved by HTMLMediaElement 112 // Keep track of whether this object has been reserved by HTMLMediaElement
114 // (i.e. a setMediaKeys operation is in progress). Destruction of this 113 // (i.e. a setMediaKeys operation is in progress). Destruction of this
115 // object will be prevented until the setMediaKeys() completes. 114 // object will be prevented until the setMediaKeys() completes.
116 bool m_reservedForMediaElement; 115 bool m_reservedForMediaElement;
117 116
118 HeapDeque<Member<PendingAction>> m_pendingActions; 117 HeapDeque<Member<PendingAction>> m_pendingActions;
119 Timer<MediaKeys> m_timer; 118 Timer<MediaKeys> m_timer;
120 }; 119 };
121 120
122 } // namespace blink 121 } // namespace blink
123 122
124 #endif // MediaKeys_h 123 #endif // MediaKeys_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698