2015-02-10 13:49:03 +03:00
|
|
|
/* -*- 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 GMPServiceChild_h_
|
|
|
|
#define GMPServiceChild_h_
|
|
|
|
|
|
|
|
#include "GMPService.h"
|
|
|
|
#include "base/process.h"
|
|
|
|
#include "mozilla/ipc/Transport.h"
|
|
|
|
#include "mozilla/gmp/PGMPServiceChild.h"
|
2015-05-29 05:07:22 +03:00
|
|
|
#include "nsRefPtrHashtable.h"
|
2016-11-01 06:25:19 +03:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2015-02-10 13:49:03 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gmp {
|
|
|
|
|
|
|
|
class GMPContentParent;
|
|
|
|
class GMPServiceChild;
|
2015-05-29 05:07:22 +03:00
|
|
|
|
2015-02-10 13:49:03 +03:00
|
|
|
class GeckoMediaPluginServiceChild : public GeckoMediaPluginService
|
|
|
|
{
|
|
|
|
friend class GMPServiceChild;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static already_AddRefed<GeckoMediaPluginServiceChild> GetSingleton();
|
|
|
|
|
2016-11-02 01:57:14 +03:00
|
|
|
NS_IMETHOD HasPluginForAPI(const nsACString& aAPI,
|
|
|
|
nsTArray<nsCString>* aTags,
|
|
|
|
bool *aRetVal) override;
|
2015-02-10 13:49:03 +03:00
|
|
|
NS_IMETHOD GetNodeId(const nsAString& aOrigin,
|
|
|
|
const nsAString& aTopLevelOrigin,
|
2015-11-27 00:53:31 +03:00
|
|
|
const nsAString& aGMPName,
|
2015-02-10 13:49:03 +03:00
|
|
|
UniquePtr<GetNodeIdCallback>&& aCallback) override;
|
|
|
|
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
void SetServiceChild(UniquePtr<GMPServiceChild>&& aServiceChild);
|
|
|
|
|
|
|
|
void RemoveGMPContentParent(GMPContentParent* aGMPContentParent);
|
|
|
|
|
2016-11-01 06:25:19 +03:00
|
|
|
static void UpdateGMPCapabilities(nsTArray<mozilla::dom::GMPCapabilityData>&& aCapabilities);
|
|
|
|
|
2017-04-03 02:08:06 +03:00
|
|
|
void BeginShutdown();
|
|
|
|
|
2015-02-10 13:49:03 +03:00
|
|
|
protected:
|
2016-05-06 14:36:22 +03:00
|
|
|
void InitializePlugins(AbstractThread*) override
|
2015-02-10 13:49:03 +03:00
|
|
|
{
|
|
|
|
// Nothing to do here.
|
|
|
|
}
|
2016-11-09 05:52:22 +03:00
|
|
|
|
2016-11-25 00:30:38 +03:00
|
|
|
virtual RefPtr<GetGMPContentParentPromise> GetContentParent(
|
|
|
|
GMPCrashHelper* aHelper,
|
|
|
|
const nsACString& aNodeIdString,
|
|
|
|
const nsCString& aAPI,
|
|
|
|
const nsTArray<nsCString>& aTags) override;
|
|
|
|
|
|
|
|
RefPtr<GetGMPContentParentPromise> GetContentParent(
|
|
|
|
GMPCrashHelper* aHelper,
|
|
|
|
const NodeId& aNodeId,
|
|
|
|
const nsCString& aAPI,
|
|
|
|
const nsTArray<nsCString>& aTags) override;
|
2015-02-10 13:49:03 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class OpenPGMPServiceChild;
|
|
|
|
|
2016-11-09 05:52:22 +03:00
|
|
|
typedef MozPromise<GMPServiceChild*, nsresult, /* IsExclusive = */ true> GetServiceChildPromise;
|
|
|
|
RefPtr<GetServiceChildPromise> GetServiceChild();
|
2015-02-10 13:49:03 +03:00
|
|
|
|
2016-11-09 05:52:22 +03:00
|
|
|
nsTArray<MozPromiseHolder<GetServiceChildPromise>> mGetServiceChildPromises;
|
2015-02-10 13:49:03 +03:00
|
|
|
UniquePtr<GMPServiceChild> mServiceChild;
|
|
|
|
};
|
|
|
|
|
|
|
|
class GMPServiceChild : public PGMPServiceChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit GMPServiceChild();
|
|
|
|
virtual ~GMPServiceChild();
|
|
|
|
|
2017-01-05 23:55:27 +03:00
|
|
|
already_AddRefed<GMPContentParent> GetBridgedGMPContentParent(ProcessId aOtherPid,
|
|
|
|
ipc::Endpoint<PGMPContentParent>&& endpoint);
|
2015-02-10 13:49:03 +03:00
|
|
|
|
|
|
|
void RemoveGMPContentParent(GMPContentParent* aGMPContentParent);
|
|
|
|
|
|
|
|
void GetAlreadyBridgedTo(nsTArray<ProcessId>& aAlreadyBridgedTo);
|
|
|
|
|
2017-01-05 23:55:57 +03:00
|
|
|
static bool Create(Endpoint<PGMPServiceChild>&& aGMPService);
|
2015-02-10 13:49:03 +03:00
|
|
|
|
2017-04-03 02:08:06 +03:00
|
|
|
ipc::IPCResult RecvBeginShutdown() override;
|
|
|
|
|
|
|
|
bool HaveContentParents() const;
|
|
|
|
|
2015-02-10 13:49:03 +03:00
|
|
|
private:
|
|
|
|
nsRefPtrHashtable<nsUint64HashKey, GMPContentParent> mContentParents;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gmp
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // GMPServiceChild_h_
|