2014-05-18 03:05:46 +00: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 GMPChild_h_
|
|
|
|
#define GMPChild_h_
|
|
|
|
|
|
|
|
#include "mozilla/gmp/PGMPChild.h"
|
2014-08-05 07:56:05 +00:00
|
|
|
#include "GMPTimerChild.h"
|
2014-08-19 08:56:33 +00:00
|
|
|
#include "GMPStorageChild.h"
|
2014-11-14 08:26:24 +00:00
|
|
|
#include "GMPLoader.h"
|
2014-08-17 21:41:56 +00:00
|
|
|
#include "gmp-async-shutdown.h"
|
2014-05-18 03:05:46 +00:00
|
|
|
#include "gmp-entrypoints.h"
|
|
|
|
#include "prlink.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gmp {
|
|
|
|
|
2015-02-10 10:48:42 +00:00
|
|
|
class GMPContentChild;
|
|
|
|
|
2014-08-17 21:41:56 +00:00
|
|
|
class GMPChild : public PGMPChild
|
|
|
|
, public GMPAsyncShutdownHost
|
2014-05-18 03:05:46 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
GMPChild();
|
|
|
|
virtual ~GMPChild();
|
|
|
|
|
2015-08-04 04:06:32 +00:00
|
|
|
bool Init(const nsAString& aPluginPath,
|
|
|
|
const nsAString& aVoucherPath,
|
2015-04-01 08:40:35 +00:00
|
|
|
base::ProcessId aParentPid,
|
2014-05-18 03:05:46 +00:00
|
|
|
MessageLoop* aIOLoop,
|
|
|
|
IPC::Channel* aChannel);
|
2014-10-09 15:45:22 +00:00
|
|
|
#ifdef XP_WIN
|
2015-08-04 04:06:32 +00:00
|
|
|
bool PreLoadLibraries(const nsAString& aPluginPath);
|
2014-10-09 15:45:22 +00:00
|
|
|
#endif
|
2014-05-18 03:05:46 +00:00
|
|
|
MessageLoop* GMPMessageLoop();
|
|
|
|
|
2014-08-05 07:56:05 +00:00
|
|
|
// Main thread only.
|
|
|
|
GMPTimerChild* GetGMPTimers();
|
2014-08-19 08:56:33 +00:00
|
|
|
GMPStorageChild* GetGMPStorage();
|
2014-08-05 07:56:05 +00:00
|
|
|
|
2014-08-17 21:41:56 +00:00
|
|
|
// GMPAsyncShutdownHost
|
2015-03-21 16:28:04 +00:00
|
|
|
void ShutdownComplete() override;
|
2014-08-17 21:41:56 +00:00
|
|
|
|
2014-10-24 02:19:16 +00:00
|
|
|
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
2015-04-03 16:51:41 +00:00
|
|
|
bool SetMacSandboxInfo();
|
2014-10-24 02:19:16 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-14 08:26:24 +00:00
|
|
|
private:
|
2015-02-10 10:48:42 +00:00
|
|
|
friend class GMPContentChild;
|
2014-11-14 08:26:24 +00:00
|
|
|
|
2015-08-04 04:06:50 +00:00
|
|
|
bool PreLoadPluginVoucher();
|
2014-12-05 08:43:41 +00:00
|
|
|
void PreLoadSandboxVoucher();
|
2014-11-14 08:39:39 +00:00
|
|
|
|
2015-07-16 23:09:49 +00:00
|
|
|
bool GetUTF8LibPath(nsACString& aOutLibPath);
|
2014-11-14 08:26:24 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool RecvSetNodeId(const nsCString& aNodeId) override;
|
2015-09-01 05:31:48 +00:00
|
|
|
virtual bool AnswerStartPlugin() override;
|
2014-10-12 22:53:44 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PCrashReporterChild* AllocPCrashReporterChild(const NativeThreadId& aThread) override;
|
|
|
|
virtual bool DeallocPCrashReporterChild(PCrashReporterChild*) override;
|
2014-07-27 23:20:34 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PGMPTimerChild* AllocPGMPTimerChild() override;
|
|
|
|
virtual bool DeallocPGMPTimerChild(PGMPTimerChild* aActor) override;
|
2014-08-05 07:56:05 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PGMPStorageChild* AllocPGMPStorageChild() override;
|
|
|
|
virtual bool DeallocPGMPStorageChild(PGMPStorageChild* aActor) override;
|
2014-08-19 08:56:33 +00:00
|
|
|
|
2015-02-10 10:48:42 +00:00
|
|
|
virtual PGMPContentChild* AllocPGMPContentChild(Transport* aTransport,
|
|
|
|
ProcessId aOtherPid) override;
|
|
|
|
void GMPContentChildActorDestroy(GMPContentChild* aGMPContentChild);
|
|
|
|
|
2015-09-29 17:56:07 +00:00
|
|
|
virtual bool RecvCrashPluginNow(const GMPCrashReason& aReason) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool RecvBeginAsyncShutdown() override;
|
2015-02-10 10:48:42 +00:00
|
|
|
virtual bool RecvCloseActive() override;
|
2014-07-30 21:40:43 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
virtual void ProcessingError(Result aCode, const char* aReason) override;
|
2014-05-18 03:05:46 +00:00
|
|
|
|
2014-11-14 08:26:24 +00:00
|
|
|
GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI);
|
|
|
|
|
2015-02-10 10:48:42 +00:00
|
|
|
nsTArray<UniquePtr<GMPContentChild>> mGMPContentChildren;
|
|
|
|
|
2014-08-17 21:41:56 +00:00
|
|
|
GMPAsyncShutdown* mAsyncShutdown;
|
2014-08-05 07:56:05 +00:00
|
|
|
nsRefPtr<GMPTimerChild> mTimerChild;
|
2014-08-19 08:56:33 +00:00
|
|
|
nsRefPtr<GMPStorageChild> mStorage;
|
2014-08-05 07:56:05 +00:00
|
|
|
|
2014-05-18 03:05:46 +00:00
|
|
|
MessageLoop* mGMPMessageLoop;
|
2015-08-04 04:06:32 +00:00
|
|
|
nsString mPluginPath;
|
|
|
|
nsString mSandboxVoucherPath;
|
|
|
|
nsCString mNodeId;
|
2014-11-14 08:26:24 +00:00
|
|
|
GMPLoader* mGMPLoader;
|
2014-11-14 08:39:39 +00:00
|
|
|
nsTArray<uint8_t> mPluginVoucher;
|
2014-12-05 08:43:41 +00:00
|
|
|
nsTArray<uint8_t> mSandboxVoucher;
|
2014-05-18 03:05:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gmp
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // GMPChild_h_
|