mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
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. --HG-- extra : rebase_source : cadb1d215fd93051c9032ea0a1fb6f1d2fb80c6d
This commit is contained in:
parent
86c372f589
commit
c67ffb04c6
@ -1104,8 +1104,7 @@ ContentParent::RecvLoadPlugin(const uint32_t& aPluginId,
|
||||
Endpoint<PPluginModuleParent>* aEndpoint)
|
||||
{
|
||||
*aRv = NS_OK;
|
||||
if (!mozilla::plugins::SetupBridge(aPluginId, this, false, aRv, aRunID,
|
||||
aEndpoint)) {
|
||||
if (!mozilla::plugins::SetupBridge(aPluginId, this, aRv, aRunID, aEndpoint)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
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
|
||||
// pointer and just throw it away.
|
||||
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_OK();
|
||||
|
@ -758,7 +758,6 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
|
||||
instanceOwner->Destroy();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
const bool isAsyncInit = (rv == NS_PLUGIN_INIT_PENDING);
|
||||
|
||||
RefPtr<nsNPAPIPluginInstance> instance;
|
||||
rv = instanceOwner->GetInstance(getter_AddRefs(instance));
|
||||
@ -767,8 +766,7 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Async init plugins will initiate their own widget creation.
|
||||
if (!isAsyncInit && instance) {
|
||||
if (instance) {
|
||||
CreateWidget(instanceOwner);
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ PluginAsyncSurrogate::WaitForInit()
|
||||
if (mParent->IsChrome()) {
|
||||
PluginProcessParent* process = static_cast<PluginModuleChromeParent*>(mParent)->Process();
|
||||
MOZ_ASSERT(process);
|
||||
process->SetCallRunnableImmediately(true);
|
||||
process->SetCallRunnableImmediately();
|
||||
if (!process->WaitUntilConnected()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class PPluginModuleParent;
|
||||
|
||||
bool
|
||||
SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentParent,
|
||||
bool aForceBridgeNow, nsresult* aResult, uint32_t* aRunID,
|
||||
nsresult* aResult, uint32_t* aRunID,
|
||||
ipc::Endpoint<PPluginModuleParent>* aEndpoint);
|
||||
|
||||
nsresult
|
||||
|
@ -1775,22 +1775,12 @@ PluginInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
|
||||
timer(Module()->GetHistogramKey());
|
||||
|
||||
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();
|
||||
if (!CallNPP_NewStream(bs, NullableString(type), seekable, &err, stype)) {
|
||||
err = NPERR_GENERIC_ERROR;
|
||||
}
|
||||
if (NPERR_NO_ERROR != err) {
|
||||
Unused << PBrowserStreamParent::Send__delete__(bs);
|
||||
}
|
||||
bs->SetAlive();
|
||||
if (!CallNPP_NewStream(bs, NullableString(type), seekable, &err, stype)) {
|
||||
err = NPERR_GENERIC_ERROR;
|
||||
}
|
||||
if (NPERR_NO_ERROR != err) {
|
||||
Unused << PBrowserStreamParent::Send__delete__(bs);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -88,7 +88,6 @@ static const char kHangUIMinDisplayPref[] = "dom.ipc.plugins.hangUIMinDisplaySec
|
||||
bool
|
||||
mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
||||
dom::ContentParent* aContentParent,
|
||||
bool aForceBridgeNow,
|
||||
nsresult* rv,
|
||||
uint32_t* runID,
|
||||
ipc::Endpoint<PPluginModuleParent>* aEndpoint)
|
||||
@ -98,7 +97,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
||||
return false;
|
||||
}
|
||||
|
||||
PluginModuleChromeParent::ClearInstantiationFlag();
|
||||
RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
|
||||
RefPtr<nsNPAPIPlugin> plugin;
|
||||
*rv = host->GetPluginForContentProcess(aPluginId, getter_AddRefs(plugin));
|
||||
@ -115,14 +113,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId,
|
||||
if (NS_FAILED(*rv)) {
|
||||
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<PPluginModuleChild> child;
|
||||
@ -506,14 +496,6 @@ PluginModuleContentParent::OnLoadPluginResult(const uint32_t& aPluginId,
|
||||
: 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
|
||||
PluginModuleChromeParent::SendAssociatePluginId()
|
||||
{
|
||||
@ -532,7 +514,7 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
|
||||
new PluginModuleChromeParent(aFilePath, aPluginId,
|
||||
aPluginTag->mSandboxLevel));
|
||||
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent));
|
||||
parent->mSubprocess->SetCallRunnableImmediately(!parent->mIsStartingAsync);
|
||||
parent->mSubprocess->SetCallRunnableImmediately();
|
||||
TimeStamp launchStart = TimeStamp::Now();
|
||||
bool launched = parent->mSubprocess->Launch(Move(onLaunchedRunnable),
|
||||
aPluginTag->mSandboxLevel);
|
||||
@ -545,12 +527,10 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
|
||||
uint32_t blocklistState;
|
||||
nsresult rv = aPluginTag->GetBlocklistState(&blocklistState);
|
||||
parent->mIsBlocklisted = NS_FAILED(rv) || blocklistState != 0;
|
||||
if (!parent->mIsStartingAsync) {
|
||||
int32_t launchTimeoutSecs = Preferences::GetInt(kLaunchTimeoutPref, 0);
|
||||
if (!parent->mSubprocess->WaitUntilConnected(launchTimeoutSecs * 1000)) {
|
||||
parent->mShutdown = true;
|
||||
return nullptr;
|
||||
}
|
||||
int32_t launchTimeoutSecs = Preferences::GetInt(kLaunchTimeoutPref, 0);
|
||||
if (!parent->mSubprocess->WaitUntilConnected(launchTimeoutSecs * 1000)) {
|
||||
parent->mShutdown = true;
|
||||
return nullptr;
|
||||
}
|
||||
TimeStamp launchEnd = TimeStamp::Now();
|
||||
parent->mTimeBlocked = (launchEnd - launchStart);
|
||||
@ -646,7 +626,7 @@ PluginModuleChromeParent::WaitForIPCConnection()
|
||||
{
|
||||
PluginProcessParent* process = Process();
|
||||
MOZ_ASSERT(process);
|
||||
process->SetCallRunnableImmediately(true);
|
||||
process->SetCallRunnableImmediately();
|
||||
if (!process->WaitUntilConnected()) {
|
||||
return false;
|
||||
}
|
||||
@ -673,11 +653,6 @@ PluginModuleChromeParent::InitCrashReporter()
|
||||
GeckoProcessType_Plugin,
|
||||
shmem,
|
||||
threadId);
|
||||
|
||||
mCrashReporter->AddNote(NS_LITERAL_CSTRING("AsyncPluginInit"),
|
||||
mIsStartingAsync ?
|
||||
NS_LITERAL_CSTRING("1") :
|
||||
NS_LITERAL_CSTRING("0"));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -697,7 +672,6 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
|
||||
, mTaskFactory(this)
|
||||
, mSandboxLevel(0)
|
||||
, mIsFlashPlugin(false)
|
||||
, mIsStartingAsync(false)
|
||||
, mNPInitialized(false)
|
||||
, mIsNPShutdownPending(false)
|
||||
, mAsyncNewRv(NS_ERROR_NOT_INITIALIZED)
|
||||
@ -705,12 +679,6 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
|
||||
, mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
|
||||
#endif
|
||||
{
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"),
|
||||
mIsStartingAsync ?
|
||||
NS_LITERAL_CSTRING("1") :
|
||||
NS_LITERAL_CSTRING("0"));
|
||||
#endif
|
||||
}
|
||||
|
||||
PluginModuleParent::~PluginModuleParent()
|
||||
@ -737,8 +705,6 @@ PluginModuleContentParent::~PluginModuleContentParent()
|
||||
Preferences::UnregisterCallback(TimeoutChanged, kContentTimeoutPref, this);
|
||||
}
|
||||
|
||||
bool PluginModuleChromeParent::sInstantiated = false;
|
||||
|
||||
PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
|
||||
uint32_t aPluginId,
|
||||
int32_t aSandboxLevel)
|
||||
@ -763,7 +729,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
|
||||
, mContentParent(nullptr)
|
||||
{
|
||||
NS_ASSERTION(mSubprocess, "Out of memory!");
|
||||
sInstantiated = true;
|
||||
mSandboxLevel = aSandboxLevel;
|
||||
mRunID = GeckoChildProcessHost::GetUniqueID();
|
||||
|
||||
@ -2176,16 +2141,6 @@ PluginModuleParent::OnInitFailure()
|
||||
}
|
||||
|
||||
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
|
||||
@ -2304,16 +2259,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
|
||||
}
|
||||
|
||||
*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;
|
||||
}
|
||||
@ -2333,12 +2279,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs*
|
||||
mNPNIface = bFuncs;
|
||||
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()) {
|
||||
// The subprocess isn't connected yet. Defer NP_Initialize until
|
||||
// OnProcessLaunched is invoked.
|
||||
@ -2350,18 +2290,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs*
|
||||
GetSettings(&settings);
|
||||
|
||||
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)) {
|
||||
Close();
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2387,9 +2315,6 @@ PluginModuleParent::RecvNP_InitializeResult(const NPError& aError)
|
||||
}
|
||||
|
||||
SetPluginFuncs(mNPPIface);
|
||||
if (mIsStartingAsync) {
|
||||
InitAsyncSurrogates();
|
||||
}
|
||||
|
||||
mNPInitialized = true;
|
||||
return IPC_OK();
|
||||
@ -2404,9 +2329,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
|
||||
bool initOk = aError == NPERR_NO_ERROR;
|
||||
if (initOk) {
|
||||
SetPluginFuncs(mNPPIface);
|
||||
if (mIsStartingAsync && !SendAssociatePluginId()) {
|
||||
initOk = false;
|
||||
}
|
||||
}
|
||||
mNPInitialized = initOk;
|
||||
bool result = mContentParent->SendLoadPluginResult(mPluginId, initOk);
|
||||
@ -2441,12 +2363,7 @@ nsresult
|
||||
PluginModuleContentParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_METHOD;
|
||||
nsresult rv = PluginModuleParent::NP_Initialize(bFuncs, error);
|
||||
if (mIsStartingAsync && GetIPCChannel()->CanSend()) {
|
||||
// We're already connected, so we may call this immediately.
|
||||
RecvNP_InitializeResult(*error);
|
||||
}
|
||||
return rv;
|
||||
return PluginModuleParent::NP_Initialize(bFuncs, error);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -2477,15 +2394,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
||||
GetSettings(&settings);
|
||||
|
||||
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)) {
|
||||
Close();
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2504,11 +2412,6 @@ PluginModuleParent::RecvNP_InitializeResult(const NPError& aError)
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
if (mIsStartingAsync && mNPPIface) {
|
||||
SetPluginFuncs(mNPPIface);
|
||||
InitAsyncSurrogates();
|
||||
}
|
||||
|
||||
mNPInitialized = true;
|
||||
return IPC_OK();
|
||||
}
|
||||
@ -2526,10 +2429,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
|
||||
} else if (aError == NPERR_NO_ERROR) {
|
||||
// Initialization steps for (e10s && !asyncInit) || !e10s
|
||||
#if defined XP_WIN
|
||||
if (mIsStartingAsync) {
|
||||
SetPluginFuncs(mNPPIface);
|
||||
}
|
||||
|
||||
// Send the info needed to join the browser process's audio session to the
|
||||
// plugin process.
|
||||
nsID id;
|
||||
@ -2555,48 +2454,12 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
|
||||
|
||||
#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
|
||||
PluginModuleParent::RemovePendingSurrogate(
|
||||
const RefPtr<PluginAsyncSurrogate>& aSurrogate)
|
||||
{
|
||||
return mSurrogateInstances.RemoveElement(aSurrogate);
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleParent::MaybeRunDeferredShutdown()
|
||||
{
|
||||
if (!mIsStartingAsync || !mIsNPShutdownPending) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!mShutdown);
|
||||
NPError error;
|
||||
if (!DoShutdown(&error)) {
|
||||
return false;
|
||||
}
|
||||
mIsNPShutdownPending = false;
|
||||
return true;
|
||||
// XXX: this function will be removed soon.
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -2609,14 +2472,6 @@ PluginModuleParent::NP_Shutdown(NPError* error)
|
||||
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)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -2681,21 +2536,7 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
|
||||
NS_ASSERTION(pFuncs, "Null pointer!");
|
||||
|
||||
*error = NPERR_NO_ERROR;
|
||||
if (mIsStartingAsync && !IsChrome()) {
|
||||
mNPPIface = pFuncs;
|
||||
#if defined(XP_MACOSX)
|
||||
if (mNPInitialized) {
|
||||
SetPluginFuncs(pFuncs);
|
||||
InitAsyncSurrogates();
|
||||
} else {
|
||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
||||
}
|
||||
#else
|
||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
||||
#endif
|
||||
} else {
|
||||
SetPluginFuncs(pFuncs);
|
||||
}
|
||||
SetPluginFuncs(pFuncs);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2711,9 +2552,6 @@ PluginModuleChromeParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* erro
|
||||
return NS_OK;
|
||||
}
|
||||
#else
|
||||
if (mIsStartingAsync) {
|
||||
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
|
||||
}
|
||||
if (!mSubprocess->IsConnected()) {
|
||||
mNPPIface = pFuncs;
|
||||
mInitOnAsyncConnect = true;
|
||||
@ -2752,22 +2590,6 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
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
|
||||
InfallibleTArray<nsCString> names;
|
||||
InfallibleTArray<nsCString> values;
|
||||
@ -2777,12 +2599,7 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
values.AppendElement(NullableString(argv[i]));
|
||||
}
|
||||
|
||||
nsresult rv = NPP_NewInternal(pluginType, instance, names, values,
|
||||
saved, error);
|
||||
if (NS_FAILED(rv) || !mIsStartingAsync) {
|
||||
return rv;
|
||||
}
|
||||
return NS_PLUGIN_INIT_PENDING;
|
||||
return NPP_NewInternal(pluginType, instance, names, values, saved, error);
|
||||
}
|
||||
|
||||
class nsCaseInsensitiveUTF8StringArrayComparator
|
||||
@ -2916,10 +2733,6 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
|
||||
#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);
|
||||
|
||||
// Any IPC messages for the PluginInstance actor should be dispatched to the
|
||||
@ -2947,31 +2760,19 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
|
||||
{ // Scope for timer
|
||||
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGIN_INSTANCE_INIT_MS>
|
||||
timer(GetHistogramKey());
|
||||
if (mIsStartingAsync) {
|
||||
MOZ_ASSERT(surrogate);
|
||||
surrogate->AsyncCallDeparting();
|
||||
if (!SendAsyncNPP_New(parentInstance)) {
|
||||
if (!CallSyncNPP_New(parentInstance, error)) {
|
||||
// if IPC is down, we'll get an immediate "failed" return, but
|
||||
// without *error being set. So make sure that the error
|
||||
// condition is signaled to nsNPAPIPluginInstance
|
||||
if (NPERR_NO_ERROR == *error) {
|
||||
*error = NPERR_GENERIC_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*error = NPERR_NO_ERROR;
|
||||
} else {
|
||||
if (!CallSyncNPP_New(parentInstance, error)) {
|
||||
// if IPC is down, we'll get an immediate "failed" return, but
|
||||
// without *error being set. So make sure that the error
|
||||
// condition is signaled to nsNPAPIPluginInstance
|
||||
if (NPERR_NO_ERROR == *error) {
|
||||
*error = NPERR_GENERIC_ERROR;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (*error != NPERR_NO_ERROR) {
|
||||
if (!mIsStartingAsync) {
|
||||
NPP_Destroy(instance, 0);
|
||||
}
|
||||
NPP_Destroy(instance, 0);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,6 @@ public:
|
||||
|
||||
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
|
||||
executing */
|
||||
bool IsInitialized() const { return mNPInitialized; }
|
||||
@ -315,8 +313,6 @@ public:
|
||||
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) override;
|
||||
#endif
|
||||
|
||||
void InitAsyncSurrogates();
|
||||
|
||||
layers::TextureClientRecycleAllocator* EnsureTextureAllocatorForDirectBitmap();
|
||||
layers::TextureClientRecycleAllocator* EnsureTextureAllocatorForDXGISurface();
|
||||
|
||||
@ -324,7 +320,6 @@ protected:
|
||||
void NotifyFlashHang();
|
||||
void NotifyPluginCrashed();
|
||||
void OnInitFailure();
|
||||
bool MaybeRunDeferredShutdown();
|
||||
bool DoShutdown(NPError* error);
|
||||
|
||||
bool GetSetting(NPNVariable aVariable);
|
||||
@ -357,10 +352,8 @@ protected:
|
||||
|
||||
friend class mozilla::plugins::PluginAsyncSurrogate;
|
||||
|
||||
bool mIsStartingAsync;
|
||||
bool mNPInitialized;
|
||||
bool mIsNPShutdownPending;
|
||||
nsTArray<RefPtr<PluginAsyncSurrogate>> mSurrogateInstances;
|
||||
nsresult mAsyncNewRv;
|
||||
uint32_t mRunID;
|
||||
|
||||
@ -432,14 +425,6 @@ class PluginModuleChromeParent
|
||||
static PluginLibrary* LoadModule(const char* aFilePath, uint32_t aPluginId,
|
||||
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();
|
||||
|
||||
/*
|
||||
@ -540,9 +525,6 @@ class PluginModuleChromeParent
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvNP_InitializeResult(const NPError& aError) override;
|
||||
|
||||
void
|
||||
SetContentParent(dom::ContentParent* aContentParent);
|
||||
|
||||
bool
|
||||
SendAssociatePluginId();
|
||||
|
||||
@ -704,7 +686,6 @@ private:
|
||||
dom::ContentParent* mContentParent;
|
||||
nsCOMPtr<nsIObserver> mPluginOfflineObserver;
|
||||
bool mIsBlocklisted;
|
||||
static bool sInstantiated;
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
mozilla::SandboxPermissions mSandboxPermissions;
|
||||
#endif
|
||||
|
@ -131,9 +131,9 @@ PluginProcessParent::Delete()
|
||||
}
|
||||
|
||||
void
|
||||
PluginProcessParent::SetCallRunnableImmediately(bool aCallImmediately)
|
||||
PluginProcessParent::SetCallRunnableImmediately()
|
||||
{
|
||||
mRunCompleteTaskImmediately = aCallImmediately;
|
||||
mRunCompleteTaskImmediately = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
|
||||
using mozilla::ipc::GeckoChildProcessHost::GetChannel;
|
||||
|
||||
void SetCallRunnableImmediately(bool aCallImmediately);
|
||||
void SetCallRunnableImmediately();
|
||||
virtual bool WaitUntilConnected(int32_t aTimeoutMs = 0) 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_TIME_RANGE_NOT_SUPPORTED"] = FAILURE(1003)
|
||||
errors["NS_ERROR_PLUGIN_CLICKTOPLAY"] = FAILURE(1004)
|
||||
errors["NS_PLUGIN_INIT_PENDING"] = SUCCESS(1005)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user