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

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

Issue 1165633004: media: Add MojoCdmServiceContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 6 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
« no previous file with comments | « media/mojo/services/mojo_cdm_service_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #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 void MojoCdmServiceContext::CreateCdmService(
19 const mojo::String& key_system,
20 const mojo::String& security_origin,
21 int32_t cdm_id,
22 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request) {
23 DVLOG(1) << __FUNCTION__ << ": " << key_system;
24
25 // TODO(xhwang): pass |security_origin| down because CdmFactory needs it.
26 scopted_ptr<MojoCdmService> cdm_service =
27 MojoCdmService::Create(key_system, this, request.Pass());
28 if (cdm_service)
29 services_.add(cdm_id, cdm_service.Pass());
30 }
31
32 CdmContext* MojoCdmServiceContext::GetCdmContext(int32_t cdm_id) {
33 MojoCdmService* service = services_.get(cdm_id);
34 if (!service) {
35 LOG(ERROR) << "CDM context not found: " << cdm_id;
36 return nullptr;
37 }
38
39 return service->GetCdmContext();
40 }
41
42 void MojoCdmServiceContext::ServiceHadConnectionError(MojoCdmService* service) {
43 for (auto it = services_.begin(); it != services_.end(); ++it) {
44 if (it->second == service) {
45 services_.erase(it); // This destroys the |service|.
46 return;
47 }
48 }
49
50 NOTREACHED() << "Service " << service << " not found.";
51 }
52
53 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_service_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698