Bug 1352575 (part 5) - Remove PluginModuleParent::mIsStartingAsync. r=jimm.
This allows a bunch of other things to be removed too, including PluginModuleParent::mSurrogateInstances, PluginModuleChromeParent::sInstantiated, and NS_PLUGIN_INIT_PENDING. The patch also removes the AsyncPluginInit crash annotation.
This commit is contained in:
@@ -1104,8 +1104,7 @@ ContentParent::RecvLoadPlugin(const uint32_t& aPluginId,
|
|||||||
Endpoint<PPluginModuleParent>* aEndpoint)
|
Endpoint<PPluginModuleParent>* aEndpoint)
|
||||||
{
|
{
|
||||||
*aRv = NS_OK;
|
*aRv = NS_OK;
|
||||||
if (!mozilla::plugins::SetupBridge(aPluginId, this, false, aRv, aRunID,
|
if (!mozilla::plugins::SetupBridge(aPluginId, this, aRv, aRunID, aEndpoint)) {
|
||||||
aEndpoint)) {
|
|
||||||
return IPC_FAIL_NO_REASON(this);
|
return IPC_FAIL_NO_REASON(this);
|
||||||
}
|
}
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
@@ -1141,7 +1140,7 @@ ContentParent::RecvConnectPluginBridge(const uint32_t& aPluginId,
|
|||||||
// in the first call to SetupBridge in RecvLoadPlugin, so we pass in a dummy
|
// in the first call to SetupBridge in RecvLoadPlugin, so we pass in a dummy
|
||||||
// pointer and just throw it away.
|
// pointer and just throw it away.
|
||||||
uint32_t dummy = 0;
|
uint32_t dummy = 0;
|
||||||
if (!mozilla::plugins::SetupBridge(aPluginId, this, true, aRv, &dummy, aEndpoint)) {
|
if (!mozilla::plugins::SetupBridge(aPluginId, this, aRv, &dummy, aEndpoint)) {
|
||||||
return IPC_FAIL(this, "SetupBridge failed");
|
return IPC_FAIL(this, "SetupBridge failed");
|
||||||
}
|
}
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
|
|||||||
@@ -758,7 +758,6 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
|
|||||||
instanceOwner->Destroy();
|
instanceOwner->Destroy();
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
const bool isAsyncInit = (rv == NS_PLUGIN_INIT_PENDING);
|
|
||||||
|
|
||||||
RefPtr<nsNPAPIPluginInstance> instance;
|
RefPtr<nsNPAPIPluginInstance> instance;
|
||||||
rv = instanceOwner->GetInstance(getter_AddRefs(instance));
|
rv = instanceOwner->GetInstance(getter_AddRefs(instance));
|
||||||
@@ -767,8 +766,7 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Async init plugins will initiate their own widget creation.
|
if (instance) {
|
||||||
if (!isAsyncInit && instance) {
|
|
||||||
CreateWidget(instanceOwner);
|
CreateWidget(instanceOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ PluginAsyncSurrogate::WaitForInit()
|
|||||||
if (mParent->IsChrome()) {
|
if (mParent->IsChrome()) {
|
||||||
PluginProcessParent* process = static_cast<PluginModuleChromeParent*>(mParent)->Process();
|
PluginProcessParent* process = static_cast<PluginModuleChromeParent*>(mParent)->Process();
|
||||||
MOZ_ASSERT(process);
|
MOZ_ASSERT(process);
|
||||||
process->SetCallRunnableImmediately(true);
|
process->SetCallRunnableImmediately();
|
||||||
if (!process->WaitUntilConnected()) {
|
if (!process->WaitUntilConnected()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class PPluginModuleParent;
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentParent,
|
SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentParent,
|
||||||
bool aForceBridgeNow, nsresult* aResult, uint32_t* aRunID,
|
nsresult* aResult, uint32_t* aRunID,
|
||||||
ipc::Endpoint<PPluginModuleParent>* aEndpoint);
|
ipc::Endpoint<PPluginModuleParent>* aEndpoint);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -1775,15 +1775,6 @@ PluginInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
|
|||||||
timer(Module()->GetHistogramKey());
|
timer(Module()->GetHistogramKey());
|
||||||
|
|
||||||
NPError err = NPERR_NO_ERROR;
|
NPError err = NPERR_NO_ERROR;
|
||||||
if (mParent->IsStartingAsync()) {
|
|
||||||
MOZ_ASSERT(mSurrogate);
|
|
||||||
mSurrogate->AsyncCallDeparting();
|
|
||||||
if (SendAsyncNPP_NewStream(bs, NullableString(type), seekable)) {
|
|
||||||
*stype = nsPluginStreamListenerPeer::STREAM_TYPE_UNKNOWN;
|
|
||||||
} else {
|
|
||||||
err = NPERR_GENERIC_ERROR;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bs->SetAlive();
|
bs->SetAlive();
|
||||||
if (!CallNPP_NewStream(bs, NullableString(type), seekable, &err, stype)) {
|
if (!CallNPP_NewStream(bs, NullableString(type), seekable, &err, stype)) {
|
||||||
err = NPERR_GENERIC_ERROR;
|
err = NPERR_GENERIC_ERROR;
|
||||||
@@ -1791,7 +1782,6 @@ PluginInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
|
|||||||
if (NPERR_NO_ERROR != err) {
|
if (NPERR_NO_ERROR != err) {
|
||||||
Unused << PBrowserStreamParent::Send__delete__(bs);
|
Unused << PBrowserStreamParent::Send__delete__(bs);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ static const char kHangUIMinDisplayPref[] = "dom.ipc.plugins.hangUIMinDisplaySec
|
|||||||
bool
|
bool
|
||||||
mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
||||||
dom::ContentParent* aContentParent,
|
dom::ContentParent* aContentParent,
|
||||||
bool aForceBridgeNow,
|
|
||||||
nsresult* rv,
|
nsresult* rv,
|
||||||
uint32_t* runID,
|
uint32_t* runID,
|
||||||
ipc::Endpoint<PPluginModuleParent>* aEndpoint)
|
ipc::Endpoint<PPluginModuleParent>* aEndpoint)
|
||||||
@@ -98,7 +97,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginModuleChromeParent::ClearInstantiationFlag();
|
|
||||||
RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
|
RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
|
||||||
RefPtr<nsNPAPIPlugin> plugin;
|
RefPtr<nsNPAPIPlugin> plugin;
|
||||||
*rv = host->GetPluginForContentProcess(aPluginId, getter_AddRefs(plugin));
|
*rv = host->GetPluginForContentProcess(aPluginId, getter_AddRefs(plugin));
|
||||||
@@ -115,14 +113,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
|||||||
if (NS_FAILED(*rv)) {
|
if (NS_FAILED(*rv)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (chromeParent->IsStartingAsync()) {
|
|
||||||
chromeParent->SetContentParent(aContentParent);
|
|
||||||
}
|
|
||||||
if (!aForceBridgeNow && chromeParent->IsStartingAsync() &&
|
|
||||||
PluginModuleChromeParent::DidInstantiate()) {
|
|
||||||
// We'll handle the bridging asynchronously
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ipc::Endpoint<PPluginModuleParent> parent;
|
ipc::Endpoint<PPluginModuleParent> parent;
|
||||||
ipc::Endpoint<PPluginModuleChild> child;
|
ipc::Endpoint<PPluginModuleChild> child;
|
||||||
@@ -506,14 +496,6 @@ PluginModuleContentParent::OnLoadPluginResult(const uint32_t& aPluginId,
|
|||||||
: NPERR_GENERIC_ERROR);
|
: NPERR_GENERIC_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
PluginModuleChromeParent::SetContentParent(dom::ContentParent* aContentParent)
|
|
||||||
{
|
|
||||||
// mContentParent is to be used ONLY during async plugin init!
|
|
||||||
MOZ_ASSERT(aContentParent && mIsStartingAsync);
|
|
||||||
mContentParent = aContentParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PluginModuleChromeParent::SendAssociatePluginId()
|
PluginModuleChromeParent::SendAssociatePluginId()
|
||||||
{
|
{
|
||||||
@@ -532,7 +514,7 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
|
|||||||
new PluginModuleChromeParent(aFilePath, aPluginId,
|
new PluginModuleChromeParent(aFilePath, aPluginId,
|
||||||
aPluginTag->mSandboxLevel));
|
aPluginTag->mSandboxLevel));
|
||||||
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent));
|
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent));
|
||||||
parent->mSubprocess->SetCallRunnableImmediately(!parent->mIsStartingAsync);
|
parent->mSubprocess->SetCallRunnableImmediately();
|
||||||
TimeStamp launchStart = TimeStamp::Now();
|
TimeStamp launchStart = TimeStamp::Now();
|
||||||
bool launched = parent->mSubprocess->Launch(Move(onLaunchedRunnable),
|
bool launched = parent->mSubprocess->Launch(Move(onLaunchedRunnable),
|
||||||
aPluginTag->mSandboxLevel);
|
aPluginTag->mSandboxLevel);
|
||||||
@@ -545,13 +527,11 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
|
|||||||
uint32_t blocklistState;
|
uint32_t blocklistState;
|
||||||
nsresult rv = aPluginTag->GetBlocklistState(&blocklistState);
|
nsresult rv = aPluginTag->GetBlocklistState(&blocklistState);
|
||||||
parent->mIsBlocklisted = NS_FAILED(rv) || blocklistState != 0;
|
parent->mIsBlocklisted = NS_FAILED(rv) || blocklistState != 0;
|
||||||
if (!parent->mIsStartingAsync) {
|
|
||||||
int32_t launchTimeoutSecs = Preferences::GetInt(kLaunchTimeoutPref, 0);
|
int32_t launchTimeoutSecs = Preferences::GetInt(kLaunchTimeoutPref, 0);
|
||||||
if (!parent->mSubprocess->WaitUntilConnected(launchTimeoutSecs * 1000)) {
|
if (!parent->mSubprocess->WaitUntilConnected(launchTimeoutSecs * 1000)) {
|
||||||
parent->mShutdown = true;
|
parent->mShutdown = true;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
TimeStamp launchEnd = TimeStamp::Now();
|
TimeStamp launchEnd = TimeStamp::Now();
|
||||||
parent->mTimeBlocked = (launchEnd - launchStart);
|
parent->mTimeBlocked = (launchEnd - launchStart);
|
||||||
return parent.forget();
|
return parent.forget();
|
||||||
@@ -646,7 +626,7 @@ PluginModuleChromeParent::WaitForIPCConnection()
|
|||||||
{
|
{
|
||||||
PluginProcessParent* process = Process();
|
PluginProcessParent* process = Process();
|
||||||
MOZ_ASSERT(process);
|
MOZ_ASSERT(process);
|
||||||
process->SetCallRunnableImmediately(true);
|
process->SetCallRunnableImmediately();
|
||||||
if (!process->WaitUntilConnected()) {
|
if (!process->WaitUntilConnected()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -673,11 +653,6 @@ PluginModuleChromeParent::InitCrashReporter()
|
|||||||
GeckoProcessType_Plugin,
|
GeckoProcessType_Plugin,
|
||||||
shmem,
|
shmem,
|
||||||
threadId);
|
threadId);
|
||||||
|
|
||||||
mCrashReporter->AddNote(NS_LITERAL_CSTRING("AsyncPluginInit"),
|
|
||||||
mIsStartingAsync ?
|
|
||||||
NS_LITERAL_CSTRING("1") :
|
|
||||||
NS_LITERAL_CSTRING("0"));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -697,7 +672,6 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
|
|||||||
, mTaskFactory(this)
|
, mTaskFactory(this)
|
||||||
, mSandboxLevel(0)
|
, mSandboxLevel(0)
|
||||||
, mIsFlashPlugin(false)
|
, mIsFlashPlugin(false)
|
||||||
, mIsStartingAsync(false)
|
|
||||||
, mNPInitialized(false)
|
, mNPInitialized(false)
|
||||||
, mIsNPShutdownPending(false)
|
, mIsNPShutdownPending(false)
|
||||||
, mAsyncNewRv(NS_ERROR_NOT_INITIALIZED)
|
, mAsyncNewRv(NS_ERROR_NOT_INITIALIZED)
|
||||||
@@ -705,12 +679,6 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
|
|||||||
, mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
|
, mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if defined(MOZ_CRASHREPORTER)
|
|
||||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"),
|
|
||||||
mIsStartingAsync ?
|
|
||||||
NS_LITERAL_CSTRING("1") :
|
|
||||||
NS_LITERAL_CSTRING("0"));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginModuleParent::~PluginModuleParent()
|
PluginModuleParent::~PluginModuleParent()
|
||||||
@@ -737,8 +705,6 @@ PluginModuleContentParent::~PluginModuleContentParent()
|
|||||||
Preferences::UnregisterCallback(TimeoutChanged, kContentTimeoutPref, this);
|
Preferences::UnregisterCallback(TimeoutChanged, kContentTimeoutPref, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginModuleChromeParent::sInstantiated = false;
|
|
||||||
|
|
||||||
PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
|
PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
|
||||||
uint32_t aPluginId,
|
uint32_t aPluginId,
|
||||||
int32_t aSandboxLevel)
|
int32_t aSandboxLevel)
|
||||||
@@ -763,7 +729,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
|
|||||||
, mContentParent(nullptr)
|
, mContentParent(nullptr)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mSubprocess, "Out of memory!");
|
NS_ASSERTION(mSubprocess, "Out of memory!");
|
||||||
sInstantiated = true;
|
|
||||||
mSandboxLevel = aSandboxLevel;
|
mSandboxLevel = aSandboxLevel;
|
||||||
mRunID = GeckoChildProcessHost::GetUniqueID();
|
mRunID = GeckoChildProcessHost::GetUniqueID();
|
||||||
|
|
||||||
@@ -2176,16 +2141,6 @@ PluginModuleParent::OnInitFailure()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mShutdown = true;
|
mShutdown = true;
|
||||||
|
|
||||||
if (mIsStartingAsync) {
|
|
||||||
/* If we've failed then we need to enumerate any pending NPP_New calls
|
|
||||||
and clean them up. */
|
|
||||||
uint32_t len = mSurrogateInstances.Length();
|
|
||||||
for (uint32_t i = 0; i < len; ++i) {
|
|
||||||
mSurrogateInstances[i]->NotifyAsyncInitFailed();
|
|
||||||
}
|
|
||||||
mSurrogateInstances.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PluginOfflineObserver final : public nsIObserver
|
class PluginOfflineObserver final : public nsIObserver
|
||||||
@@ -2304,16 +2259,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
|
|||||||
}
|
}
|
||||||
|
|
||||||
*error = NPERR_NO_ERROR;
|
*error = NPERR_NO_ERROR;
|
||||||
if (mIsStartingAsync) {
|
|
||||||
if (GetIPCChannel()->CanSend()) {
|
|
||||||
// We're already connected, so we may call this immediately.
|
|
||||||
RecvNP_InitializeResult(*error);
|
|
||||||
} else {
|
|
||||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SetPluginFuncs(pFuncs);
|
SetPluginFuncs(pFuncs);
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -2333,12 +2279,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs*
|
|||||||
mNPNIface = bFuncs;
|
mNPNIface = bFuncs;
|
||||||
mNPPIface = pFuncs;
|
mNPPIface = pFuncs;
|
||||||
|
|
||||||
// NB: This *MUST* be set prior to checking whether the subprocess has
|
|
||||||
// been connected!
|
|
||||||
if (mIsStartingAsync) {
|
|
||||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mSubprocess->IsConnected()) {
|
if (!mSubprocess->IsConnected()) {
|
||||||
// The subprocess isn't connected yet. Defer NP_Initialize until
|
// The subprocess isn't connected yet. Defer NP_Initialize until
|
||||||
// OnProcessLaunched is invoked.
|
// OnProcessLaunched is invoked.
|
||||||
@@ -2350,18 +2290,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs*
|
|||||||
GetSettings(&settings);
|
GetSettings(&settings);
|
||||||
|
|
||||||
TimeStamp callNpInitStart = TimeStamp::Now();
|
TimeStamp callNpInitStart = TimeStamp::Now();
|
||||||
// Asynchronous case
|
|
||||||
if (mIsStartingAsync) {
|
|
||||||
if (!SendAsyncNP_Initialize(settings)) {
|
|
||||||
Close();
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
TimeStamp callNpInitEnd = TimeStamp::Now();
|
|
||||||
mTimeBlocked += (callNpInitEnd - callNpInitStart);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Synchronous case
|
|
||||||
if (!CallNP_Initialize(settings, error)) {
|
if (!CallNP_Initialize(settings, error)) {
|
||||||
Close();
|
Close();
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@@ -2387,9 +2315,6 @@ PluginModuleParent::RecvNP_InitializeResult(const NPError& aError)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetPluginFuncs(mNPPIface);
|
SetPluginFuncs(mNPPIface);
|
||||||
if (mIsStartingAsync) {
|
|
||||||
InitAsyncSurrogates();
|
|
||||||
}
|
|
||||||
|
|
||||||
mNPInitialized = true;
|
mNPInitialized = true;
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
@@ -2404,9 +2329,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
|
|||||||
bool initOk = aError == NPERR_NO_ERROR;
|
bool initOk = aError == NPERR_NO_ERROR;
|
||||||
if (initOk) {
|
if (initOk) {
|
||||||
SetPluginFuncs(mNPPIface);
|
SetPluginFuncs(mNPPIface);
|
||||||
if (mIsStartingAsync && !SendAssociatePluginId()) {
|
|
||||||
initOk = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mNPInitialized = initOk;
|
mNPInitialized = initOk;
|
||||||
bool result = mContentParent->SendLoadPluginResult(mPluginId, initOk);
|
bool result = mContentParent->SendLoadPluginResult(mPluginId, initOk);
|
||||||
@@ -2441,12 +2363,7 @@ nsresult
|
|||||||
PluginModuleContentParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
PluginModuleContentParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
||||||
{
|
{
|
||||||
PLUGIN_LOG_DEBUG_METHOD;
|
PLUGIN_LOG_DEBUG_METHOD;
|
||||||
nsresult rv = PluginModuleParent::NP_Initialize(bFuncs, error);
|
return PluginModuleParent::NP_Initialize(bFuncs, error);
|
||||||
if (mIsStartingAsync && GetIPCChannel()->CanSend()) {
|
|
||||||
// We're already connected, so we may call this immediately.
|
|
||||||
RecvNP_InitializeResult(*error);
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2477,15 +2394,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
|||||||
GetSettings(&settings);
|
GetSettings(&settings);
|
||||||
|
|
||||||
TimeStamp callNpInitStart = TimeStamp::Now();
|
TimeStamp callNpInitStart = TimeStamp::Now();
|
||||||
if (mIsStartingAsync) {
|
|
||||||
if (!SendAsyncNP_Initialize(settings)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
TimeStamp callNpInitEnd = TimeStamp::Now();
|
|
||||||
mTimeBlocked += (callNpInitEnd - callNpInitStart);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CallNP_Initialize(settings, error)) {
|
if (!CallNP_Initialize(settings, error)) {
|
||||||
Close();
|
Close();
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@@ -2504,11 +2412,6 @@ PluginModuleParent::RecvNP_InitializeResult(const NPError& aError)
|
|||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsStartingAsync && mNPPIface) {
|
|
||||||
SetPluginFuncs(mNPPIface);
|
|
||||||
InitAsyncSurrogates();
|
|
||||||
}
|
|
||||||
|
|
||||||
mNPInitialized = true;
|
mNPInitialized = true;
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
@@ -2526,10 +2429,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
|
|||||||
} else if (aError == NPERR_NO_ERROR) {
|
} else if (aError == NPERR_NO_ERROR) {
|
||||||
// Initialization steps for (e10s && !asyncInit) || !e10s
|
// Initialization steps for (e10s && !asyncInit) || !e10s
|
||||||
#if defined XP_WIN
|
#if defined XP_WIN
|
||||||
if (mIsStartingAsync) {
|
|
||||||
SetPluginFuncs(mNPPIface);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the info needed to join the browser process's audio session to the
|
// Send the info needed to join the browser process's audio session to the
|
||||||
// plugin process.
|
// plugin process.
|
||||||
nsID id;
|
nsID id;
|
||||||
@@ -2555,48 +2454,12 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
|
||||||
PluginModuleParent::InitAsyncSurrogates()
|
|
||||||
{
|
|
||||||
if (MaybeRunDeferredShutdown()) {
|
|
||||||
// We've shut down, so the surrogates are no longer valid. Clear
|
|
||||||
// mSurrogateInstances to ensure that these aren't used.
|
|
||||||
mSurrogateInstances.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t len = mSurrogateInstances.Length();
|
|
||||||
for (uint32_t i = 0; i < len; ++i) {
|
|
||||||
NPError err;
|
|
||||||
mAsyncNewRv = mSurrogateInstances[i]->NPP_New(&err);
|
|
||||||
if (NS_FAILED(mAsyncNewRv)) {
|
|
||||||
mSurrogateInstances[i]->NotifyAsyncInitFailed();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mSurrogateInstances.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PluginModuleParent::RemovePendingSurrogate(
|
PluginModuleParent::RemovePendingSurrogate(
|
||||||
const RefPtr<PluginAsyncSurrogate>& aSurrogate)
|
const RefPtr<PluginAsyncSurrogate>& aSurrogate)
|
||||||
{
|
{
|
||||||
return mSurrogateInstances.RemoveElement(aSurrogate);
|
// XXX: this function will be removed soon.
|
||||||
}
|
MOZ_CRASH();
|
||||||
|
|
||||||
bool
|
|
||||||
PluginModuleParent::MaybeRunDeferredShutdown()
|
|
||||||
{
|
|
||||||
if (!mIsStartingAsync || !mIsNPShutdownPending) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
MOZ_ASSERT(!mShutdown);
|
|
||||||
NPError error;
|
|
||||||
if (!DoShutdown(&error)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
mIsNPShutdownPending = false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@@ -2609,14 +2472,6 @@ PluginModuleParent::NP_Shutdown(NPError* error)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're still running an async NP_Initialize then we need to defer
|
|
||||||
shutdown until we've received the result of the NP_Initialize call. */
|
|
||||||
if (mIsStartingAsync && !mNPInitialized) {
|
|
||||||
mIsNPShutdownPending = true;
|
|
||||||
*error = NPERR_NO_ERROR;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DoShutdown(error)) {
|
if (!DoShutdown(error)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -2681,21 +2536,7 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
|
|||||||
NS_ASSERTION(pFuncs, "Null pointer!");
|
NS_ASSERTION(pFuncs, "Null pointer!");
|
||||||
|
|
||||||
*error = NPERR_NO_ERROR;
|
*error = NPERR_NO_ERROR;
|
||||||
if (mIsStartingAsync && !IsChrome()) {
|
|
||||||
mNPPIface = pFuncs;
|
|
||||||
#if defined(XP_MACOSX)
|
|
||||||
if (mNPInitialized) {
|
|
||||||
SetPluginFuncs(pFuncs);
|
SetPluginFuncs(pFuncs);
|
||||||
InitAsyncSurrogates();
|
|
||||||
} else {
|
|
||||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
SetPluginFuncs(pFuncs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -2711,9 +2552,6 @@ PluginModuleChromeParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* erro
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (mIsStartingAsync) {
|
|
||||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
|
||||||
}
|
|
||||||
if (!mSubprocess->IsConnected()) {
|
if (!mSubprocess->IsConnected()) {
|
||||||
mNPPIface = pFuncs;
|
mNPPIface = pFuncs;
|
||||||
mInitOnAsyncConnect = true;
|
mInitOnAsyncConnect = true;
|
||||||
@@ -2752,22 +2590,6 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsStartingAsync) {
|
|
||||||
if (!PluginAsyncSurrogate::Create(this, pluginType, instance,
|
|
||||||
argc, argn, argv)) {
|
|
||||||
*error = NPERR_GENERIC_ERROR;
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mNPInitialized) {
|
|
||||||
RefPtr<PluginAsyncSurrogate> surrogate =
|
|
||||||
PluginAsyncSurrogate::Cast(instance);
|
|
||||||
mSurrogateInstances.AppendElement(surrogate);
|
|
||||||
*error = NPERR_NO_ERROR;
|
|
||||||
return NS_PLUGIN_INIT_PENDING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the instance on the other side
|
// create the instance on the other side
|
||||||
InfallibleTArray<nsCString> names;
|
InfallibleTArray<nsCString> names;
|
||||||
InfallibleTArray<nsCString> values;
|
InfallibleTArray<nsCString> values;
|
||||||
@@ -2777,12 +2599,7 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
|
|||||||
values.AppendElement(NullableString(argv[i]));
|
values.AppendElement(NullableString(argv[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = NPP_NewInternal(pluginType, instance, names, values,
|
return NPP_NewInternal(pluginType, instance, names, values, saved, error);
|
||||||
saved, error);
|
|
||||||
if (NS_FAILED(rv) || !mIsStartingAsync) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
return NS_PLUGIN_INIT_PENDING;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class nsCaseInsensitiveUTF8StringArrayComparator
|
class nsCaseInsensitiveUTF8StringArrayComparator
|
||||||
@@ -2916,10 +2733,6 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the surrogate reference that was in pdata
|
|
||||||
RefPtr<PluginAsyncSurrogate> surrogate(
|
|
||||||
dont_AddRef(PluginAsyncSurrogate::Cast(instance)));
|
|
||||||
// Now replace it with the instance
|
|
||||||
instance->pdata = static_cast<PluginDataResolver*>(parentInstance);
|
instance->pdata = static_cast<PluginDataResolver*>(parentInstance);
|
||||||
|
|
||||||
// Any IPC messages for the PluginInstance actor should be dispatched to the
|
// Any IPC messages for the PluginInstance actor should be dispatched to the
|
||||||
@@ -2947,15 +2760,6 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
|
|||||||
{ // Scope for timer
|
{ // Scope for timer
|
||||||
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGIN_INSTANCE_INIT_MS>
|
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGIN_INSTANCE_INIT_MS>
|
||||||
timer(GetHistogramKey());
|
timer(GetHistogramKey());
|
||||||
if (mIsStartingAsync) {
|
|
||||||
MOZ_ASSERT(surrogate);
|
|
||||||
surrogate->AsyncCallDeparting();
|
|
||||||
if (!SendAsyncNPP_New(parentInstance)) {
|
|
||||||
*error = NPERR_GENERIC_ERROR;
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
*error = NPERR_NO_ERROR;
|
|
||||||
} else {
|
|
||||||
if (!CallSyncNPP_New(parentInstance, error)) {
|
if (!CallSyncNPP_New(parentInstance, error)) {
|
||||||
// if IPC is down, we'll get an immediate "failed" return, but
|
// if IPC is down, we'll get an immediate "failed" return, but
|
||||||
// without *error being set. So make sure that the error
|
// without *error being set. So make sure that the error
|
||||||
@@ -2966,12 +2770,9 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (*error != NPERR_NO_ERROR) {
|
if (*error != NPERR_NO_ERROR) {
|
||||||
if (!mIsStartingAsync) {
|
|
||||||
NPP_Destroy(instance, 0);
|
NPP_Destroy(instance, 0);
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,8 +99,6 @@ public:
|
|||||||
|
|
||||||
bool RemovePendingSurrogate(const RefPtr<PluginAsyncSurrogate>& aSurrogate);
|
bool RemovePendingSurrogate(const RefPtr<PluginAsyncSurrogate>& aSurrogate);
|
||||||
|
|
||||||
/** @return the state of the pref that controls async plugin init */
|
|
||||||
bool IsStartingAsync() const { return mIsStartingAsync; }
|
|
||||||
/** @return whether this modules NP_Initialize has successfully completed
|
/** @return whether this modules NP_Initialize has successfully completed
|
||||||
executing */
|
executing */
|
||||||
bool IsInitialized() const { return mNPInitialized; }
|
bool IsInitialized() const { return mNPInitialized; }
|
||||||
@@ -315,8 +313,6 @@ public:
|
|||||||
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) override;
|
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void InitAsyncSurrogates();
|
|
||||||
|
|
||||||
layers::TextureClientRecycleAllocator* EnsureTextureAllocatorForDirectBitmap();
|
layers::TextureClientRecycleAllocator* EnsureTextureAllocatorForDirectBitmap();
|
||||||
layers::TextureClientRecycleAllocator* EnsureTextureAllocatorForDXGISurface();
|
layers::TextureClientRecycleAllocator* EnsureTextureAllocatorForDXGISurface();
|
||||||
|
|
||||||
@@ -324,7 +320,6 @@ protected:
|
|||||||
void NotifyFlashHang();
|
void NotifyFlashHang();
|
||||||
void NotifyPluginCrashed();
|
void NotifyPluginCrashed();
|
||||||
void OnInitFailure();
|
void OnInitFailure();
|
||||||
bool MaybeRunDeferredShutdown();
|
|
||||||
bool DoShutdown(NPError* error);
|
bool DoShutdown(NPError* error);
|
||||||
|
|
||||||
bool GetSetting(NPNVariable aVariable);
|
bool GetSetting(NPNVariable aVariable);
|
||||||
@@ -357,10 +352,8 @@ protected:
|
|||||||
|
|
||||||
friend class mozilla::plugins::PluginAsyncSurrogate;
|
friend class mozilla::plugins::PluginAsyncSurrogate;
|
||||||
|
|
||||||
bool mIsStartingAsync;
|
|
||||||
bool mNPInitialized;
|
bool mNPInitialized;
|
||||||
bool mIsNPShutdownPending;
|
bool mIsNPShutdownPending;
|
||||||
nsTArray<RefPtr<PluginAsyncSurrogate>> mSurrogateInstances;
|
|
||||||
nsresult mAsyncNewRv;
|
nsresult mAsyncNewRv;
|
||||||
uint32_t mRunID;
|
uint32_t mRunID;
|
||||||
|
|
||||||
@@ -432,14 +425,6 @@ class PluginModuleChromeParent
|
|||||||
static PluginLibrary* LoadModule(const char* aFilePath, uint32_t aPluginId,
|
static PluginLibrary* LoadModule(const char* aFilePath, uint32_t aPluginId,
|
||||||
nsPluginTag* aPluginTag);
|
nsPluginTag* aPluginTag);
|
||||||
|
|
||||||
/**
|
|
||||||
* The following two functions are called by SetupBridge to determine
|
|
||||||
* whether an existing plugin module was reused, or whether a new module
|
|
||||||
* was instantiated by the plugin host.
|
|
||||||
*/
|
|
||||||
static void ClearInstantiationFlag() { sInstantiated = false; }
|
|
||||||
static bool DidInstantiate() { return sInstantiated; }
|
|
||||||
|
|
||||||
virtual ~PluginModuleChromeParent();
|
virtual ~PluginModuleChromeParent();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -540,9 +525,6 @@ class PluginModuleChromeParent
|
|||||||
virtual mozilla::ipc::IPCResult
|
virtual mozilla::ipc::IPCResult
|
||||||
RecvNP_InitializeResult(const NPError& aError) override;
|
RecvNP_InitializeResult(const NPError& aError) override;
|
||||||
|
|
||||||
void
|
|
||||||
SetContentParent(dom::ContentParent* aContentParent);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SendAssociatePluginId();
|
SendAssociatePluginId();
|
||||||
|
|
||||||
@@ -704,7 +686,6 @@ private:
|
|||||||
dom::ContentParent* mContentParent;
|
dom::ContentParent* mContentParent;
|
||||||
nsCOMPtr<nsIObserver> mPluginOfflineObserver;
|
nsCOMPtr<nsIObserver> mPluginOfflineObserver;
|
||||||
bool mIsBlocklisted;
|
bool mIsBlocklisted;
|
||||||
static bool sInstantiated;
|
|
||||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||||
mozilla::SandboxPermissions mSandboxPermissions;
|
mozilla::SandboxPermissions mSandboxPermissions;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ PluginProcessParent::Delete()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PluginProcessParent::SetCallRunnableImmediately(bool aCallImmediately)
|
PluginProcessParent::SetCallRunnableImmediately()
|
||||||
{
|
{
|
||||||
mRunCompleteTaskImmediately = aCallImmediately;
|
mRunCompleteTaskImmediately = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
using mozilla::ipc::GeckoChildProcessHost::GetChannel;
|
using mozilla::ipc::GeckoChildProcessHost::GetChannel;
|
||||||
|
|
||||||
void SetCallRunnableImmediately(bool aCallImmediately);
|
void SetCallRunnableImmediately();
|
||||||
virtual bool WaitUntilConnected(int32_t aTimeoutMs = 0) override;
|
virtual bool WaitUntilConnected(int32_t aTimeoutMs = 0) override;
|
||||||
|
|
||||||
virtual void OnChannelConnected(int32_t peer_pid) override;
|
virtual void OnChannelConnected(int32_t peer_pid) override;
|
||||||
|
|||||||
@@ -465,7 +465,6 @@ with modules["PLUGINS"]:
|
|||||||
errors["NS_ERROR_PLUGIN_BLOCKLISTED"] = FAILURE(1002)
|
errors["NS_ERROR_PLUGIN_BLOCKLISTED"] = FAILURE(1002)
|
||||||
errors["NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED"] = FAILURE(1003)
|
errors["NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED"] = FAILURE(1003)
|
||||||
errors["NS_ERROR_PLUGIN_CLICKTOPLAY"] = FAILURE(1004)
|
errors["NS_ERROR_PLUGIN_CLICKTOPLAY"] = FAILURE(1004)
|
||||||
errors["NS_PLUGIN_INIT_PENDING"] = SUCCESS(1005)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user