gecko-dev/dom/media/gmp/ChromiumCDMAdapter.h
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00

91 lines
2.1 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ChromiumAdapter_h_
#define ChromiumAdapter_h_
#include "GMPLoader.h"
#include "prlink.h"
#include "GMPUtils.h"
#include "nsTArray.h"
#include "content_decryption_module_ext.h"
#include "nsString.h"
#include "mozilla/Pair.h"
struct GMPPlatformAPI;
namespace mozilla {
#if defined(XP_WIN)
typedef nsString HostFileString;
#else
typedef nsCString HostFileString;
#endif
class HostFile
{
public:
explicit HostFile(const nsCString& aPath);
HostFile(HostFile&& aOther);
~HostFile();
const HostFileString& Path() const { return mPath; }
cdm::PlatformFile TakePlatformFile();
private:
const HostFileString mPath;
cdm::PlatformFile mFile = cdm::kInvalidPlatformFile;
};
struct HostFileData
{
HostFileData(HostFile&& aBinary, HostFile&& aSig)
: mBinary(std::move(aBinary))
, mSig(std::move(aSig))
{
}
HostFileData(HostFileData&& aOther)
: mBinary(std::move(aOther.mBinary))
, mSig(std::move(aOther.mSig))
{
}
~HostFileData() {}
HostFile mBinary;
HostFile mSig;
};
class ChromiumCDMAdapter : public gmp::GMPAdapter
{
public:
explicit ChromiumCDMAdapter(nsTArray<Pair<nsCString, nsCString>>&& aHostPathPairs);
void SetAdaptee(PRLibrary* aLib) override;
// These are called in place of the corresponding GMP API functions.
GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) override;
GMPErr GMPGetAPI(const char* aAPIName,
void* aHostAPI,
void** aPluginAPI,
uint32_t aDecryptorId) override;
void GMPShutdown() override;
static bool Supports(int32_t aModuleVersion,
int32_t aInterfaceVersion,
int32_t aHostVersion);
private:
void PopulateHostFiles(nsTArray<Pair<nsCString, nsCString>>&& aHostFilePaths);
PRLibrary* mLib = nullptr;
nsTArray<HostFileData> mHostFiles;
};
} // namespace mozilla
#endif // ChromiumAdapter_h_