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

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

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

Powered by Google App Engine
This is Rietveld 408576698