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

Side by Side Diff: content/common/media/cdm_host_files.h

Issue 2773283002: media: Simplify CdmHostFile(s) (Closed)
Patch Set: comments addressed Created 3 years, 8 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 | « content/common/media/cdm_host_file.cc ('k') | content/common/media/cdm_host_files.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ 5 #ifndef CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_
6 #define CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ 6 #define CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // files later. 65 // files later.
66 // Only returns false if the CDM returns false (when there's an immediate 66 // Only returns false if the CDM returns false (when there's an immediate
67 // failure). Otherwise always returns true for backward compatibility, e.g. 67 // failure). Otherwise always returns true for backward compatibility, e.g.
68 // when using an old CDM which doesn't implement the verification API. 68 // when using an old CDM which doesn't implement the verification API.
69 bool VerifyFiles(base::NativeLibrary cdm_adapter_library, 69 bool VerifyFiles(base::NativeLibrary cdm_adapter_library,
70 const base::FilePath& cdm_adapter_path); 70 const base::FilePath& cdm_adapter_path);
71 71
72 private: 72 private:
73 #if defined(POSIX_WITH_ZYGOTE) 73 #if defined(POSIX_WITH_ZYGOTE)
74 // Opens all common files and CDM specific files for all registered CDMs. 74 // Opens all common files and CDM specific files for all registered CDMs.
75 bool OpenFilesForAllRegisteredCdms(); 75 void OpenFilesForAllRegisteredCdms();
76 #endif 76 #endif
77 77
78 // Opens all common files and CDM specific files for the CDM adapter 78 // Opens all common files and CDM specific files for the CDM adapter
79 // registered at |cdm_adapter_path|. 79 // registered at |cdm_adapter_path|.
80 bool OpenFiles(const base::FilePath& cdm_adapter_path); 80 void OpenFiles(const base::FilePath& cdm_adapter_path);
81 81
82 // Opens common CDM host files shared by all CDMs. Upon failure, close all 82 // Opens common CDM host files shared by all CDMs.
83 // files opened. 83 void OpenCommonFiles();
84 bool OpenCommonFiles();
85 84
86 // Opens CDM specific files for the CDM adapter registered at 85 // Opens CDM specific files for the CDM adapter registered at
87 // |cdm_adapter_path|. Returns whether all CDM specific files are opened. 86 // |cdm_adapter_path|.
88 // Upon failure, close all files opened. 87 void OpenCdmFiles(const base::FilePath& cdm_adapter_path);
89 bool OpenCdmFiles(const base::FilePath& cdm_adapter_path);
90 88
91 // Fills |cdm_host_files| with common and CDM specific files for 89 // Fills |cdm_host_files| with common and CDM specific files for
92 // |cdm_adapter_path|. The ownership of those files are also transferred. 90 // |cdm_adapter_path|. The ownership of those files are also transferred.
93 // Returns true upon success where the remaining files will be closed. 91 void TakePlatformFiles(const base::FilePath& cdm_adapter_path,
94 // Returns false upon any failure and all files will be closed.
95 bool TakePlatformFiles(const base::FilePath& cdm_adapter_path,
96 std::vector<cdm::HostFile>* cdm_host_files); 92 std::vector<cdm::HostFile>* cdm_host_files);
97 93
98 void CloseAllFiles(); 94 void CloseAllFiles();
99 95
100 using ScopedFileVector = std::vector<std::unique_ptr<CdmHostFile>>; 96 using ScopedFileVector = std::vector<std::unique_ptr<CdmHostFile>>;
101 ScopedFileVector common_files_; 97 ScopedFileVector common_files_;
102 std::map<base::FilePath, ScopedFileVector> cdm_specific_files_map_; 98 std::map<base::FilePath, ScopedFileVector> cdm_specific_files_map_;
103 }; 99 };
104 100
105 // Returns whether the |cdm_adapter_path| corresponds to a known CDM. 101 // Returns whether the |cdm_adapter_path| corresponds to a known CDM.
106 bool IsCdm(const base::FilePath& cdm_adapter_path); 102 bool IsCdm(const base::FilePath& cdm_adapter_path);
107 103
108 } // namespace content 104 } // namespace content
109 105
110 #endif // CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ 106 #endif // CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_
OLDNEW
« no previous file with comments | « content/common/media/cdm_host_file.cc ('k') | content/common/media/cdm_host_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698