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

Unified Diff: media/mojo/services/mojo_cdm_service_context.h

Issue 1230313010: media: Add ServiceFactory mojo interface and implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 5 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
« no previous file with comments | « media/mojo/services/mojo_cdm_service.cc ('k') | media/mojo/services/mojo_cdm_service_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_cdm_service_context.h
diff --git a/media/mojo/services/mojo_cdm_service_context.h b/media/mojo/services/mojo_cdm_service_context.h
index dc55ad312c7b9d42e5f4523e27fd0c4255d7fddf..f3c2caf233164ff6e9962a43957768d55d1b3312 100644
--- a/media/mojo/services/mojo_cdm_service_context.h
+++ b/media/mojo/services/mojo_cdm_service_context.h
@@ -5,20 +5,25 @@
#ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_
#define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_
-#include "base/containers/scoped_ptr_hash_map.h"
+#include <map>
+
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "media/base/cdm_context.h"
#include "media/base/media_export.h"
-#include "media/mojo/services/mojo_cdm_service.h"
namespace media {
+class MojoCdmService;
+
// A class that creates, owns and manages all MojoCdmService instances.
class MEDIA_EXPORT MojoCdmServiceContext : public CdmContextProvider {
public:
MojoCdmServiceContext();
~MojoCdmServiceContext() override;
+ base::WeakPtr<MojoCdmServiceContext> GetWeakPtr();
+
// Registers The |cdm_service| with |cdm_id|.
void RegisterCdm(int cdm_id, MojoCdmService* cdm_service);
@@ -36,6 +41,9 @@ class MEDIA_EXPORT MojoCdmServiceContext : public CdmContextProvider {
// A map between CDM ID and MojoCdmService.
std::map<int, MojoCdmService*> cdm_services_;
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<MojoCdmServiceContext> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MojoCdmServiceContext);
};
« no previous file with comments | « media/mojo/services/mojo_cdm_service.cc ('k') | media/mojo/services/mojo_cdm_service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698