Bug 1146955 - Unify pluginID for GMP and runID for NPAPI plugins to use the same internal incrementor. r=jesup, mrbkap.

--HG--
extra : rebase_source : bd7989a043f0b36f23ffc8d35a55a6110b09b163
extra : source : 175040b5d347dcbb31cf63f124f88ba1f53fda61
This commit is contained in:
Mike Conley 2015-04-27 15:09:45 -04:00
parent c0e295b256
commit 91457c2516
7 changed files with 28 additions and 10 deletions

View File

@ -14,6 +14,7 @@
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "mozIGeckoMediaPluginService.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/unused.h"
#include "nsIObserverService.h"
@ -25,6 +26,7 @@
#include "mozilla/dom/CrashReporterParent.h"
using mozilla::dom::CrashReporterParent;
using mozilla::ipc::GeckoChildProcessHost;
#ifdef MOZ_CRASHREPORTER
using CrashReporter::AnnotationTable;
@ -64,9 +66,7 @@ GMPParent::GMPParent()
#endif
{
LOGD("GMPParent ctor");
// Use the parent address to identify it.
// We could use any unique-to-the-parent value.
mPluginId.AppendInt(reinterpret_cast<uint64_t>(this));
mPluginId.AppendInt(GeckoChildProcessHost::GetUniqueID());
}
GMPParent::~GMPParent()

View File

@ -216,6 +216,12 @@ GMPVideoEncoderParent::SetPeriodicKeyFrames(bool aEnable)
return GMPNoErr;
}
const uint32_t
GMPVideoEncoderParent::ParentID()
{
return mPlugin ? mPlugin->GetPluginId() : 0;
}
// Note: Consider keeping ActorDestroy sync'd up when making changes here.
void
GMPVideoEncoderParent::Shutdown()

View File

@ -45,7 +45,7 @@ public:
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) override;
virtual GMPErr SetRates(uint32_t aNewBitRate, uint32_t aFrameRate) override;
virtual GMPErr SetPeriodicKeyFrames(bool aEnable) override;
virtual const uint64_t ParentID() override { return reinterpret_cast<uint64_t>(mPlugin.get()); }
virtual const uint32_t ParentID() override;
// GMPSharedMemManager
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) override

View File

@ -15,6 +15,7 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/PCrashReporterParent.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/plugins/BrowserStreamParent.h"
#include "mozilla/plugins/PluginAsyncSurrogate.h"
@ -58,6 +59,7 @@ using base::KillProcess;
using mozilla::PluginLibrary;
using mozilla::ipc::MessageChannel;
using mozilla::ipc::GeckoChildProcessHost;
using mozilla::dom::PCrashReporterParent;
using mozilla::dom::CrashReporterParent;
@ -658,10 +660,6 @@ PluginModuleContentParent::~PluginModuleContentParent()
Preferences::UnregisterCallback(TimeoutChanged, kContentTimeoutPref, this);
}
// We start the Run IDs at 1 so that we can use 0 as a way of detecting
// errors in retrieving the run ID.
uint32_t PluginModuleChromeParent::sNextRunID = 1;
bool PluginModuleChromeParent::sInstantiated = false;
PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath, uint32_t aPluginId)
@ -693,7 +691,7 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath, uint32
{
NS_ASSERTION(mSubprocess, "Out of memory!");
sInstantiated = true;
mRunID = sNextRunID++;
mRunID = GeckoChildProcessHost::GetUniqueID();
#ifdef MOZ_ENABLE_PROFILER_SPS
InitPluginProfiling();

View File

@ -557,7 +557,6 @@ private:
dom::ContentParent* mContentParent;
nsCOMPtr<nsIObserver> mOfflineObserver;
bool mIsBlocklisted;
static uint32_t sNextRunID;
static bool sInstantiated;
};

View File

@ -254,6 +254,17 @@ uint32_t GeckoChildProcessHost::GetSupportedArchitecturesForProcessType(GeckoPro
return base::GetCurrentProcessArchitecture();
}
// We start the unique IDs at 1 so that 0 can be used to mean that
// a component has no unique ID assigned to it.
uint32_t GeckoChildProcessHost::sNextUniqueID = 1;
/* static */
uint32_t
GeckoChildProcessHost::GetUniqueID()
{
return sNextUniqueID++;
}
void
GeckoChildProcessHost::PrepareLaunch()
{

View File

@ -47,6 +47,8 @@ public:
static uint32_t GetSupportedArchitecturesForProcessType(GeckoProcessType type);
static uint32_t GetUniqueID();
// Block until the IPC channel for our subprocess is initialized,
// but no longer. The child process may or may not have been
// created when this method returns.
@ -196,6 +198,8 @@ private:
//
// FIXME/cjones: this strongly indicates bad design. Shame on us.
std::queue<IPC::Message> mQueue;
static uint32_t sNextUniqueID;
};
#ifdef MOZ_NUWA_PROCESS