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

Side by Side Diff: media/mojo/services/mojo_cdm_service_context.cc

Issue 840473002: media: Support creation and SetCdm() for mojo based CDM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/mojo/services/mojo_cdm_service_context.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9
10 namespace media {
11
12 MojoCdmServiceContext::MojoCdmServiceContext() {
13 }
14
15 MojoCdmServiceContext::~MojoCdmServiceContext() {
16 }
17
18 MojoCdmService* MojoCdmServiceContext::Create(
19 const mojo::String& key_system,
20 const mojo::String& security_origin,
21 int32_t cdm_id) {
22 DVLOG(1) << __FUNCTION__ << ": " << key_system;
23 // TODO(xhwang): How to use |security_origin| here?
24 MojoCdmService* cdm_service = MojoCdmService::Create(this, key_system);
25 if (cdm_service)
26 services_.add(cdm_id, make_scoped_ptr(cdm_service));
27 return cdm_service;
28 }
29
30 CdmContext* MojoCdmServiceContext::GetCdmContext(int32_t cdm_id) {
31 MojoCdmService* service = services_.get(cdm_id);
32 return service ? service->GetCdmContext() : nullptr;
33 }
34
35 void MojoCdmServiceContext::ServiceHadConnectionError(MojoCdmService* service) {
36 for (auto it = services_.begin(); it != services_.end(); ++it) {
37 if (it->second == service) {
38 services_.erase(it); // This destroys the |service|.
39 return;
40 }
41 }
42
43 NOTREACHED() << "Service " << service << " not found.";
44 }
45
46 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698