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

Side by Side Diff: Source/modules/encryptedmedia/MediaKeySession.h

Issue 466813003: Cleanup namespace usage in Source/core/modules/[battery/* to indexeddb/*] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 18 matching lines...) Expand all
29 #include "bindings/core/v8/ScriptPromiseProperty.h" 29 #include "bindings/core/v8/ScriptPromiseProperty.h"
30 #include "core/dom/ActiveDOMObject.h" 30 #include "core/dom/ActiveDOMObject.h"
31 #include "core/dom/DOMException.h" 31 #include "core/dom/DOMException.h"
32 #include "modules/EventTargetModules.h" 32 #include "modules/EventTargetModules.h"
33 #include "platform/Timer.h" 33 #include "platform/Timer.h"
34 #include "platform/heap/Handle.h" 34 #include "platform/heap/Handle.h"
35 #include "public/platform/WebContentDecryptionModuleSession.h" 35 #include "public/platform/WebContentDecryptionModuleSession.h"
36 #include "wtf/Forward.h" 36 #include "wtf/Forward.h"
37 37
38 namespace blink { 38 namespace blink {
39 class WebContentDecryptionModule;
40 class WebString;
41 }
42
43 namespace blink {
44 39
45 class ScriptPromise; 40 class ScriptPromise;
46 class ScriptState; 41 class ScriptState;
47 class GenericEventQueue; 42 class GenericEventQueue;
48 class MediaKeyError; 43 class MediaKeyError;
49 class MediaKeys; 44 class MediaKeys;
45 class WebContentDecryptionModule;
46 class WebString;
50 47
51 // References are held by JS only. However, even if all JS references are 48 // References are held by JS only. However, even if all JS references are
52 // dropped, it won't be garbage collected until close event received or 49 // dropped, it won't be garbage collected until close event received or
53 // MediaKeys goes away (as determined by the validity of a WeakPtr). This allows 50 // MediaKeys goes away (as determined by the validity of a WeakPtr). This allows
54 // the CDM to continue to fire events for this session, as long as the session 51 // the CDM to continue to fire events for this session, as long as the session
55 // is open. 52 // is open.
56 // 53 //
57 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession 54 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession
58 // keep references to each other, and then having to inform the other object 55 // keep references to each other, and then having to inform the other object
59 // when it gets destroyed. 56 // when it gets destroyed.
60 // 57 //
61 // Because this object controls the lifetime of the WebContentDecryptionModuleSe ssion, 58 // Because this object controls the lifetime of the WebContentDecryptionModuleSe ssion,
62 // it may outlive any JavaScript references as long as the MediaKeys object is a live. 59 // it may outlive any JavaScript references as long as the MediaKeys object is a live.
63 // The WebContentDecryptionModuleSession has the same lifetime as this object. 60 // The WebContentDecryptionModuleSession has the same lifetime as this object.
64 class MediaKeySession FINAL 61 class MediaKeySession FINAL
65 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS ession>, public ActiveDOMObject, public EventTargetWithInlineData 62 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS ession>, public ActiveDOMObject, public EventTargetWithInlineData
66 , private blink::WebContentDecryptionModuleSession::Client { 63 , private WebContentDecryptionModuleSession::Client {
67 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M ediaKeySession>); 64 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M ediaKeySession>);
68 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); 65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession);
69 public: 66 public:
70 static ScriptPromise create(ScriptState*, MediaKeys*, const String& initData Type, PassRefPtr<ArrayBuffer> initData, const String& sessionType); 67 static ScriptPromise create(ScriptState*, MediaKeys*, const String& initData Type, PassRefPtr<ArrayBuffer> initData, const String& sessionType);
71 virtual ~MediaKeySession(); 68 virtual ~MediaKeySession();
72 69
73 const String& keySystem() const { return m_keySystem; } 70 const String& keySystem() const { return m_keySystem; }
74 String sessionId() const; 71 String sessionId() const;
75 ScriptPromise closed(ScriptState*); 72 ScriptPromise closed(ScriptState*);
76 73
(...skipping 13 matching lines...) Expand all
90 // ActiveDOMObject 87 // ActiveDOMObject
91 virtual bool hasPendingActivity() const OVERRIDE; 88 virtual bool hasPendingActivity() const OVERRIDE;
92 virtual void stop() OVERRIDE; 89 virtual void stop() OVERRIDE;
93 90
94 virtual void trace(Visitor*) OVERRIDE; 91 virtual void trace(Visitor*) OVERRIDE;
95 92
96 private: 93 private:
97 class PendingAction; 94 class PendingAction;
98 friend class MediaKeySessionInitializer; 95 friend class MediaKeySessionInitializer;
99 96
100 MediaKeySession(ExecutionContext*, MediaKeys*, PassOwnPtr<blink::WebContentD ecryptionModuleSession>); 97 MediaKeySession(ExecutionContext*, MediaKeys*, PassOwnPtr<WebContentDecrypti onModuleSession>);
101 void actionTimerFired(Timer<MediaKeySession>*); 98 void actionTimerFired(Timer<MediaKeySession>*);
102 99
103 // blink::WebContentDecryptionModuleSession::Client 100 // WebContentDecryptionModuleSession::Client
104 virtual void message(const unsigned char* message, size_t messageLength, con st blink::WebURL& destinationURL) OVERRIDE; 101 virtual void message(const unsigned char* message, size_t messageLength, con st WebURL& destinationURL) OVERRIDE;
105 virtual void ready() OVERRIDE; 102 virtual void ready() OVERRIDE;
106 virtual void close() OVERRIDE; 103 virtual void close() OVERRIDE;
107 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; 104 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE;
108 virtual void error(blink::WebContentDecryptionModuleException, unsigned long systemCode, const blink::WebString& errorMessage) OVERRIDE; 105 virtual void error(WebContentDecryptionModuleException, unsigned long system Code, const WebString& errorMessage) OVERRIDE;
109 106
110 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response) ; 107 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response) ;
111 108
112 String m_keySystem; 109 String m_keySystem;
113 RefPtrWillBeMember<MediaKeyError> m_error; 110 RefPtrWillBeMember<MediaKeyError> m_error;
114 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; 111 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
115 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; 112 OwnPtr<WebContentDecryptionModuleSession> m_session;
116 113
117 // Used to determine if MediaKeys is still active. 114 // Used to determine if MediaKeys is still active.
118 WeakMember<MediaKeys> m_keys; 115 WeakMember<MediaKeys> m_keys;
119 116
120 // Is the CDM finished with this session? 117 // Is the CDM finished with this session?
121 bool m_isClosed; 118 bool m_isClosed;
122 119
123 // Keep track of the closed promise. 120 // Keep track of the closed promise.
124 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP trWillBeMember<DOMException> > ClosedPromise; 121 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP trWillBeMember<DOMException> > ClosedPromise;
125 Member<ClosedPromise> m_closedPromise; 122 Member<ClosedPromise> m_closedPromise;
126 123
127 HeapDeque<Member<PendingAction> > m_pendingActions; 124 HeapDeque<Member<PendingAction> > m_pendingActions;
128 Timer<MediaKeySession> m_actionTimer; 125 Timer<MediaKeySession> m_actionTimer;
129 }; 126 };
130 127
131 } 128 } // namespace blink
132 129
133 #endif // MediaKeySession_h 130 #endif // MediaKeySession_h
OLDNEW
« no previous file with comments | « Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h ('k') | Source/modules/encryptedmedia/MediaKeysClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698