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

Side by Side Diff: media/mojo/clients/mojo_cdm.h

Issue 2592913002: [eme] Break mojo connection during call (Closed)
Patch Set: changes Created 3 years, 11 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 #ifndef MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_CDM_H_
6 #define MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ 6 #define MEDIA_MOJO_CLIENTS_MOJO_CDM_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "media/base/cdm_context.h" 18 #include "media/base/cdm_context.h"
19 #include "media/base/cdm_initialized_promise.h" 19 #include "media/base/cdm_initialized_promise.h"
20 #include "media/base/cdm_promise_adapter.h"
20 #include "media/base/cdm_session_tracker.h" 21 #include "media/base/cdm_session_tracker.h"
21 #include "media/base/content_decryption_module.h" 22 #include "media/base/content_decryption_module.h"
22 #include "media/mojo/interfaces/content_decryption_module.mojom.h" 23 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
23 #include "mojo/public/cpp/bindings/binding.h" 24 #include "mojo/public/cpp/bindings/binding.h"
24 25
25 namespace base { 26 namespace base {
26 class SingleThreadTaskRunner; 27 class SingleThreadTaskRunner;
27 } 28 }
28 29
29 namespace media { 30 namespace media {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 107
107 // Callback for InitializeCdm. 108 // Callback for InitializeCdm.
108 void OnCdmInitialized(mojom::CdmPromiseResultPtr result, 109 void OnCdmInitialized(mojom::CdmPromiseResultPtr result,
109 int cdm_id, 110 int cdm_id,
110 mojom::DecryptorPtr decryptor); 111 mojom::DecryptorPtr decryptor);
111 112
112 // Callback when new decryption key is available. 113 // Callback when new decryption key is available.
113 void OnKeyAdded(); 114 void OnKeyAdded();
114 115
115 // Callbacks to handle CDM promises. 116 // Callbacks to handle CDM promises.
116 void OnSimpleCdmPromiseResult(std::unique_ptr<SimpleCdmPromise> promise, 117 void OnSimpleCdmPromiseResult(uint32_t promise_id,
117 mojom::CdmPromiseResultPtr result); 118 mojom::CdmPromiseResultPtr result);
118 void OnNewSessionCdmPromiseResult( 119 void OnNewSessionCdmPromiseResult(uint32_t promise_id,
119 std::unique_ptr<NewSessionCdmPromise> promise, 120 mojom::CdmPromiseResultPtr result,
120 mojom::CdmPromiseResultPtr result, 121 const std::string& session_id);
121 const std::string& session_id);
122 122
123 base::ThreadChecker thread_checker_; 123 base::ThreadChecker thread_checker_;
124 124
125 mojom::ContentDecryptionModulePtr remote_cdm_; 125 mojom::ContentDecryptionModulePtr remote_cdm_;
126 mojo::Binding<ContentDecryptionModuleClient> binding_; 126 mojo::Binding<ContentDecryptionModuleClient> binding_;
127 127
128 // Protects |cdm_id_|, |decryptor_ptr_|, |decryptor_| and 128 // Protects |cdm_id_|, |decryptor_ptr_|, |decryptor_| and
129 // |decryptor_task_runner_| which could be accessed from other threads. 129 // |decryptor_task_runner_| which could be accessed from other threads.
130 // See CdmContext implementation above. 130 // See CdmContext implementation above.
131 mutable base::Lock lock_; 131 mutable base::Lock lock_;
(...skipping 18 matching lines...) Expand all
150 SessionClosedCB session_closed_cb_; 150 SessionClosedCB session_closed_cb_;
151 SessionKeysChangeCB session_keys_change_cb_; 151 SessionKeysChangeCB session_keys_change_cb_;
152 SessionExpirationUpdateCB session_expiration_update_cb_; 152 SessionExpirationUpdateCB session_expiration_update_cb_;
153 153
154 // Pending promise for InitializeCdm(). 154 // Pending promise for InitializeCdm().
155 std::unique_ptr<CdmInitializedPromise> pending_init_promise_; 155 std::unique_ptr<CdmInitializedPromise> pending_init_promise_;
156 156
157 // Keep track of current sessions. 157 // Keep track of current sessions.
158 CdmSessionTracker cdm_session_tracker_; 158 CdmSessionTracker cdm_session_tracker_;
159 159
160 // Keep track of outstanding promises.
161 CdmPromiseAdapter cdm_promise_adapter_;
162
160 // This must be the last member. 163 // This must be the last member.
161 base::WeakPtrFactory<MojoCdm> weak_factory_; 164 base::WeakPtrFactory<MojoCdm> weak_factory_;
162 165
163 DISALLOW_COPY_AND_ASSIGN(MojoCdm); 166 DISALLOW_COPY_AND_ASSIGN(MojoCdm);
164 }; 167 };
165 168
166 } // namespace media 169 } // namespace media
167 170
168 #endif // MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ 171 #endif // MEDIA_MOJO_CLIENTS_MOJO_CDM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698