OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ | |
6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ | |
7 | |
8 #include "base/containers/scoped_ptr_hash_map.h" | |
9 #include "base/macros.h" | |
10 #include "media/base/cdm_context.h" | |
11 #include "media/base/media_export.h" | |
12 #include "media/mojo/services/mojo_cdm_service.h" | |
13 | |
14 namespace media { | |
15 | |
16 // A class that creates, owns and manages all MojoCdmService instances. | |
17 class MEDIA_EXPORT MojoCdmServiceContext : public CdmContextProvider { | |
18 public: | |
19 MojoCdmServiceContext(); | |
20 ~MojoCdmServiceContext() override; | |
21 | |
22 // Creates a MojoCdmService for |key_system| and weakly bind it to |request|. | |
ddorwin
2015/06/11 19:09:43
nit: binds
xhwang
2015/06/11 20:58:01
Done.
| |
23 // The created MojoCdmService is owned by |this|. The request will be dropped | |
24 // if no MojoCdmService can be created. | |
ddorwin
2015/06/11 19:09:43
Perhaps add:
", resulting in a connection error"
xhwang
2015/06/11 20:58:01
Done.
| |
25 void CreateCdmService( | |
26 const mojo::String& key_system, | |
27 const mojo::String& security_origin, | |
28 int32_t cdm_id, | |
29 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); | |
30 | |
31 // CdmContextProvider implementation. | |
32 // TODO(xhwang): The returned CdmContext can be destroyed at any time if the | |
33 // pipe is disconnected. When implementing SetCdm(), make sure we never | |
ddorwin
2015/06/11 19:09:43
I think the first sentence is documentation, and t
xhwang
2015/06/11 20:58:01
Done.
| |
34 // dereference garbage. For example, use media::PlayerTracker. | |
35 CdmContext* GetCdmContext(int32_t cdm_id) override; | |
36 | |
37 // Called when there is a connection error with |service|. | |
38 void ServiceHadConnectionError(MojoCdmService* service); | |
39 | |
40 private: | |
41 // A map between CDM ID and MojoCdmService. Owns all MojoCdmService created. | |
42 base::ScopedPtrHashMap<int32_t, scoped_ptr<MojoCdmService>> services_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(MojoCdmServiceContext); | |
45 }; | |
46 | |
47 } // namespace media | |
48 | |
49 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ | |
OLD | NEW |