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

Unified Diff: media/cdm/cdm_manager.h

Issue 2857953006: Extract CdmManager from MojoCdmService. (Closed)
Patch Set: Switch to component(). Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/cdm/cdm_manager.h
diff --git a/media/cdm/cdm_manager.h b/media/cdm/cdm_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..75f5e7ba4b7e05ebae7dc50773bea8312af94ecf
--- /dev/null
+++ b/media/cdm/cdm_manager.h
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_CDM_CDM_MANAGER_H_
+#define MEDIA_CDM_CDM_MANAGER_H_
+
+#include <map>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+class ContentDecryptionModule;
+
+// Provides a singleton registry of CDM instances. This is used to share
+// ContentDecryptionModules between the MojoMediaService and
+// AndroidVideoDecodeAccelerator, and should be removed along with AVDA in the
+// future. (MojoCdmServiceContext serves the same purpose for Media Mojo
+// services, but scoped to a single InterfaceFactory.)
+class MEDIA_EXPORT CdmManager {
+ public:
+ CdmManager();
+ ~CdmManager();
+
+ static CdmManager* GetInstance();
+
+ // Returns the CDM associated with |cdm_id|. Can be called on any thread.
+ scoped_refptr<ContentDecryptionModule> GetCdm(int cdm_id);
+
+ // Registers the |cdm| for |cdm_id|.
+ void RegisterCdm(int cdm_id, scoped_refptr<ContentDecryptionModule> cdm);
+
+ // Unregisters the CDM associated with |cdm_id|.
+ void UnregisterCdm(int cdm_id);
+
+ private:
+ base::Lock lock_;
+ std::map<int, scoped_refptr<ContentDecryptionModule>> cdm_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(CdmManager);
+};
+
+} // namespace media
+
+#endif // MEDIA_CDM_CDM_MANAGER_H_
« media/BUILD.gn ('K') | « media/BUILD.gn ('k') | media/cdm/cdm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698