Bug 1315850 - Hook up CDM storage. r=gerald
MozReview-Commit-ID: 9gHcMZvmMfg
--- a/dom/media/gmp/ChromiumCDMChild.cpp
+++ b/dom/media/gmp/ChromiumCDMChild.cpp
@@ -1,16 +1,17 @@
/* -*- 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/. */
#include "ChromiumCDMChild.h"
#include "GMPContentChild.h"
#include "WidevineUtils.h"
+#include "WidevineFileIO.h"
#include "WidevineVideoFrame.h"
#include "GMPLog.h"
#include "GMPPlatform.h"
#include "mozilla/Unused.h"
#include "nsPrintfCString.h"
#include "base/time.h"
namespace mozilla {
@@ -218,33 +219,37 @@ ChromiumCDMChild::OnLegacySessionError(c
nsCString(aErrorMessage, aErrorMessageLength));
}
cdm::FileIO*
ChromiumCDMChild::CreateFileIO(cdm::FileIOClient * aClient)
{
MOZ_ASSERT(IsOnMessageLoopThread());
GMP_LOG("ChromiumCDMChild::CreateFileIO()");
- return nullptr;
+ if (!mPersistentStateAllowed) {
+ return nullptr;
+ }
+ return new WidevineFileIO(aClient);
}
bool
ChromiumCDMChild::IsOnMessageLoopThread()
{
return mPlugin && mPlugin->GMPMessageLoop() == MessageLoop::current();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvInit(const bool& aAllowDistinctiveIdentifier,
const bool& aAllowPersistentState)
{
MOZ_ASSERT(IsOnMessageLoopThread());
GMP_LOG("ChromiumCDMChild::RecvInit(distinctiveId=%d, persistentState=%d)",
aAllowDistinctiveIdentifier,
aAllowPersistentState);
+ mPersistentStateAllowed = aAllowPersistentState;
if (mCDM) {
mCDM->Initialize(aAllowDistinctiveIdentifier, aAllowPersistentState);
}
return IPC_OK();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvSetServerCertificate(const uint32_t& aPromiseId,
--- a/dom/media/gmp/ChromiumCDMChild.h
+++ b/dom/media/gmp/ChromiumCDMChild.h
@@ -111,14 +111,15 @@ protected:
GMPContentChild* mPlugin = nullptr;
cdm::ContentDecryptionModule_8* mCDM = nullptr;
typedef SimpleMap<uint64_t> DurationMap;
DurationMap mFrameDurations;
bool mDecoderInitialized = false;
+ bool mPersistentStateAllowed = false;
};
} // namespace gmp
} // namespace mozilla
#endif // ChromiumCDMChild_h_
--- a/dom/media/gmp/widevine-adapter/moz.build
+++ b/dom/media/gmp/widevine-adapter/moz.build
@@ -11,16 +11,17 @@ SOURCES += [
'WidevineFileIO.cpp',
'WidevineUtils.cpp',
'WidevineVideoDecoder.cpp',
'WidevineVideoFrame.cpp',
]
EXPORTS += [
'WidevineDecryptor.h',
+ 'WidevineFileIO.h',
'WidevineUtils.h',
'WidevineVideoFrame.h'
]
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'/dom/media/gmp',