/usr/include/thunderbird/GMPParent.h is in thunderbird-dev 1:38.6.0+build1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | /* -*- 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 GMPParent_h_
#define GMPParent_h_
#include "GMPProcessParent.h"
#include "GMPService.h"
#include "GMPAudioDecoderParent.h"
#include "GMPDecryptorParent.h"
#include "GMPVideoDecoderParent.h"
#include "GMPVideoEncoderParent.h"
#include "GMPTimerParent.h"
#include "GMPStorageParent.h"
#include "mozilla/gmp/PGMPParent.h"
#include "nsCOMPtr.h"
#include "nscore.h"
#include "nsISupports.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsIFile.h"
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"
class nsILineInputStream;
class nsIThread;
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
namespace mozilla {
namespace dom {
class PCrashReporterParent;
class CrashReporterParent;
}
}
#endif
namespace mozilla {
namespace gmp {
class GMPCapability
{
public:
nsCString mAPIName;
nsTArray<nsCString> mAPITags;
};
enum GMPState {
GMPStateNotLoaded,
GMPStateLoaded,
GMPStateUnloading,
GMPStateClosing
};
class GMPParent final : public PGMPParent,
public GMPSharedMem
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(GMPParent)
GMPParent();
nsresult Init(GeckoMediaPluginService *aService, nsIFile* aPluginDir);
nsresult CloneFrom(const GMPParent* aOther);
void Crash();
nsresult LoadProcess();
// Called internally to close this if we don't need it
void CloseIfUnused();
// Notify all active de/encoders that we are closing, either because of
// normal shutdown or unexpected shutdown/crash.
void CloseActive(bool aDieWhenUnloaded);
// Tell the plugin to die after shutdown.
void MarkForDeletion();
bool IsMarkedForDeletion();
// Called by the GMPService to forcibly close active de/encoders at shutdown
void Shutdown();
// This must not be called while we're in the middle of abnormal ActorDestroy
void DeleteProcess();
bool SupportsAPI(const nsCString& aAPI, const nsCString& aTag);
nsresult GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD);
void VideoDecoderDestroyed(GMPVideoDecoderParent* aDecoder);
nsresult GetGMPVideoEncoder(GMPVideoEncoderParent** aGMPVE);
void VideoEncoderDestroyed(GMPVideoEncoderParent* aEncoder);
nsresult GetGMPDecryptor(GMPDecryptorParent** aGMPKS);
void DecryptorDestroyed(GMPDecryptorParent* aSession);
nsresult GetGMPAudioDecoder(GMPAudioDecoderParent** aGMPAD);
void AudioDecoderDestroyed(GMPAudioDecoderParent* aDecoder);
GMPState State() const;
nsIThread* GMPThread();
// A GMP can either be a single instance shared across all NodeIds (like
// in the OpenH264 case), or we can require a new plugin instance for every
// NodeIds running the plugin (as in the EME plugin case).
//
// A NodeId is a hash of the ($urlBarOrigin, $ownerDocOrigin) pair.
//
// Plugins are associated with an NodeIds by calling SetNodeId() before
// loading.
//
// If a plugin has no NodeId specified and it is loaded, it is assumed to
// be shared across NodeIds.
// Specifies that a GMP can only work with the specified NodeIds.
void SetNodeId(const nsACString& aNodeId);
const nsACString& GetNodeId() const { return mNodeId; }
const nsCString& GetDisplayName() const;
const nsCString& GetVersion() const;
const nsACString& GetPluginId() const;
// Returns true if a plugin can be or is being used across multiple NodeIds.
bool CanBeSharedCrossNodeIds() const;
// A GMP can be used from a NodeId if it's already been set to work with
// that NodeId, or if it's not been set to work with any NodeId and has
// not yet been loaded (i.e. it's not shared across NodeIds).
bool CanBeUsedFrom(const nsACString& aNodeId) const;
already_AddRefed<nsIFile> GetDirectory() {
return nsCOMPtr<nsIFile>(mDirectory).forget();
}
// GMPSharedMem
virtual void CheckThread() override;
void AbortAsyncShutdown();
// Called when the child process has died.
void ChildTerminated();
private:
~GMPParent();
nsRefPtr<GeckoMediaPluginService> mService;
bool EnsureProcessLoaded();
nsresult ReadGMPMetaData();
#ifdef MOZ_CRASHREPORTER
void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
void GetCrashID(nsString& aResult);
#endif
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual PCrashReporterParent* AllocPCrashReporterParent(const NativeThreadId& aThread) override;
virtual bool DeallocPCrashReporterParent(PCrashReporterParent* aCrashReporter) override;
virtual PGMPVideoDecoderParent* AllocPGMPVideoDecoderParent() override;
virtual bool DeallocPGMPVideoDecoderParent(PGMPVideoDecoderParent* aActor) override;
virtual PGMPVideoEncoderParent* AllocPGMPVideoEncoderParent() override;
virtual bool DeallocPGMPVideoEncoderParent(PGMPVideoEncoderParent* aActor) override;
virtual PGMPDecryptorParent* AllocPGMPDecryptorParent() override;
virtual bool DeallocPGMPDecryptorParent(PGMPDecryptorParent* aActor) override;
virtual PGMPAudioDecoderParent* AllocPGMPAudioDecoderParent() override;
virtual bool DeallocPGMPAudioDecoderParent(PGMPAudioDecoderParent* aActor) override;
virtual bool RecvPGMPStorageConstructor(PGMPStorageParent* actor) override;
virtual PGMPStorageParent* AllocPGMPStorageParent() override;
virtual bool DeallocPGMPStorageParent(PGMPStorageParent* aActor) override;
virtual bool RecvPGMPTimerConstructor(PGMPTimerParent* actor) override;
virtual PGMPTimerParent* AllocPGMPTimerParent() override;
virtual bool DeallocPGMPTimerParent(PGMPTimerParent* aActor) override;
virtual bool RecvAsyncShutdownComplete() override;
virtual bool RecvAsyncShutdownRequired() override;
nsresult EnsureAsyncShutdownTimeoutSet();
GMPState mState;
nsCOMPtr<nsIFile> mDirectory; // plugin directory on disk
nsString mName; // base name of plugin on disk, UTF-16 because used for paths
nsCString mDisplayName; // name of plugin displayed to users
nsCString mDescription; // description of plugin for display to users
nsCString mVersion;
nsCString mPluginId;
nsTArray<nsAutoPtr<GMPCapability>> mCapabilities;
GMPProcessParent* mProcess;
bool mDeleteProcessOnlyOnUnload;
bool mAbnormalShutdownInProgress;
bool mIsBlockingDeletion;
bool mCanDecrypt;
nsTArray<nsRefPtr<GMPVideoDecoderParent>> mVideoDecoders;
nsTArray<nsRefPtr<GMPVideoEncoderParent>> mVideoEncoders;
nsTArray<nsRefPtr<GMPDecryptorParent>> mDecryptors;
nsTArray<nsRefPtr<GMPAudioDecoderParent>> mAudioDecoders;
nsTArray<nsRefPtr<GMPTimerParent>> mTimers;
nsTArray<nsRefPtr<GMPStorageParent>> mStorage;
nsCOMPtr<nsIThread> mGMPThread;
nsCOMPtr<nsITimer> mAsyncShutdownTimeout; // GMP Thread only.
// NodeId the plugin is assigned to, or empty if the the plugin is not
// assigned to a NodeId.
nsAutoCString mNodeId;
bool mAsyncShutdownRequired;
bool mAsyncShutdownInProgress;
};
} // namespace gmp
} // namespace mozilla
#endif // GMPParent_h_
|