#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/mojo/services/mojo_cdm_file_io.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "media/cdm/cdm_helpers.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
namespace media {
namespace {
ClientStatus;
FileStatus;
StorageStatus;
constexpr int kSizeKBMin = …;
const int64_t kMaxFileSizeKB = …;
constexpr int kSizeKBBuckets = …;
const char* ConvertStorageStatus(StorageStatus status) { … }
const char* ConvertFileStatus(FileStatus status) { … }
}
MojoCdmFileIO::MojoCdmFileIO(Delegate* delegate,
cdm::FileIOClient* client,
mojo::Remote<mojom::CdmStorage> cdm_storage)
: … { … }
MojoCdmFileIO::~MojoCdmFileIO() { … }
void MojoCdmFileIO::Open(const char* file_name, uint32_t file_name_size) { … }
void MojoCdmFileIO::OnFileOpened(
StorageStatus status,
mojo::PendingAssociatedRemote<mojom::CdmFile> cdm_file) { … }
void MojoCdmFileIO::Read() { … }
void MojoCdmFileIO::OnFileRead(FileStatus status,
const std::vector<uint8_t>& data) { … }
void MojoCdmFileIO::Write(const uint8_t* data, uint32_t data_size) { … }
void MojoCdmFileIO::OnFileWritten(FileStatus status) { … }
void MojoCdmFileIO::Close() { … }
void MojoCdmFileIO::OnError(ErrorType error) { … }
void MojoCdmFileIO::NotifyClientOfError(ErrorType error) { … }
}