Bug 767638 - Rename InitializeEmbedded* plugin functions to just Initialize*. r=josh

This commit is contained in:
John Schoenick 2012-12-12 16:12:41 -08:00
parent 89e20b4b21
commit a054279c3b
5 changed files with 36 additions and 57 deletions

View File

@ -552,8 +552,8 @@ nsObjectLoadingContent::MakePluginListener()
nsCOMPtr<nsIStreamListener> finalListener;
rv = mInstanceOwner->GetInstance(getter_AddRefs(inst));
NS_ENSURE_SUCCESS(rv, false);
rv = pluginHost->NewEmbeddedPluginStreamListener(mURI, inst,
getter_AddRefs(finalListener));
rv = pluginHost->NewPluginStreamListener(mURI, inst,
getter_AddRefs(finalListener));
NS_ENSURE_SUCCESS(rv, false);
mFinalListener = finalListener;
return true;
@ -740,9 +740,9 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
appShell->SuspendNative();
}
rv = pluginHost->InstantiateEmbeddedPluginInstance(mContentType.get(),
mURI.get(), this,
getter_AddRefs(mInstanceOwner));
rv = pluginHost->InstantiatePluginInstance(mContentType.get(),
mURI.get(), this,
getter_AddRefs(mInstanceOwner));
if (appShell) {
appShell->ResumeNative();

View File

@ -901,9 +901,9 @@ nsPluginHost::GetPluginTempDir(nsIFile **aDir)
}
nsresult
nsPluginHost::InstantiateEmbeddedPluginInstance(const char *aMimeType, nsIURI* aURL,
nsObjectLoadingContent *aContent,
nsPluginInstanceOwner** aOwner)
nsPluginHost::InstantiatePluginInstance(const char *aMimeType, nsIURI* aURL,
nsObjectLoadingContent *aContent,
nsPluginInstanceOwner** aOwner)
{
NS_ENSURE_ARG_POINTER(aOwner);
@ -913,7 +913,7 @@ nsPluginHost::InstantiateEmbeddedPluginInstance(const char *aMimeType, nsIURI* a
aURL->GetAsciiSpec(urlSpec);
PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL,
("nsPluginHost::InstantiateEmbeddedPlugin Begin mime=%s, url=%s\n",
("nsPluginHost::InstantiatePlugin Begin mime=%s, url=%s\n",
aMimeType, urlSpec.get()));
PR_LogFlush();
@ -985,7 +985,7 @@ nsPluginHost::InstantiateEmbeddedPluginInstance(const char *aMimeType, nsIURI* a
if (aURL != nullptr) aURL->GetAsciiSpec(urlSpec2);
PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL,
("nsPluginHost::InstantiateEmbeddedPlugin Finished mime=%s, rv=%d, url=%s\n",
("nsPluginHost::InstantiatePlugin Finished mime=%s, rv=%d, url=%s\n",
aMimeType, rv, urlSpec2.get()));
PR_LogFlush();
@ -3194,15 +3194,15 @@ nsPluginHost::StopPluginInstance(nsNPAPIPluginInstance* aInstance)
return NS_OK;
}
nsresult nsPluginHost::NewEmbeddedPluginStreamListener(nsIURI* aURI,
nsNPAPIPluginInstance* aInstance,
nsIStreamListener **aStreamListener)
nsresult nsPluginHost::NewPluginStreamListener(nsIURI* aURI,
nsNPAPIPluginInstance* aInstance,
nsIStreamListener **aStreamListener)
{
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aStreamListener);
nsRefPtr<nsPluginStreamListenerPeer> listener = new nsPluginStreamListenerPeer();
nsresult rv = listener->InitializeEmbedded(aURI, aInstance);
nsresult rv = listener->Initialize(aURI, aInstance, nullptr);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -184,18 +184,18 @@ public:
// The last argument should be false if we already have an in-flight stream
// and don't need to set up a new stream.
nsresult InstantiateEmbeddedPluginInstance(const char *aMimeType, nsIURI* aURL,
nsObjectLoadingContent *aContent,
nsPluginInstanceOwner** aOwner);
nsresult InstantiatePluginInstance(const char *aMimeType, nsIURI* aURL,
nsObjectLoadingContent *aContent,
nsPluginInstanceOwner** aOwner);
// Does not accept NULL and should never fail.
nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin);
nsresult GetPlugin(const char *aMimeType, nsNPAPIPlugin** aPlugin);
nsresult NewEmbeddedPluginStreamListener(nsIURI* aURL,
nsNPAPIPluginInstance* aInstance,
nsIStreamListener **aStreamListener);
nsresult NewPluginStreamListener(nsIURI* aURL,
nsNPAPIPluginInstance* aInstance,
nsIStreamListener **aStreamListener);
private:
nsresult

View File

@ -314,46 +314,18 @@ nsPluginStreamListenerPeer::~nsPluginStreamListenerPeer()
mPluginInstance->FileCachedStreamListeners()->RemoveElement(this);
}
// Called as a result of GetURL and PostURL
// Called as a result of GetURL and PostURL, or by the host in the case of the
// initial plugin stream.
nsresult nsPluginStreamListenerPeer::Initialize(nsIURI *aURL,
nsNPAPIPluginInstance *aInstance,
nsNPAPIPluginStreamListener* aListener)
{
#ifdef PLUGIN_LOGGING
nsAutoCString urlSpec;
if (aURL != nullptr) aURL->GetAsciiSpec(urlSpec);
if (aURL != nullptr) aURL->GetSpec(urlSpec);
PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL,
("nsPluginStreamListenerPeer::Initialize instance=%p, url=%s\n", aInstance, urlSpec.get()));
PR_LogFlush();
#endif
mURL = aURL;
mPluginInstance = aInstance;
mPStreamListener = aListener;
mPStreamListener->SetStreamListenerPeer(this);
mPendingRequests = 1;
mDataForwardToRequest = new nsHashtable(16, false);
if (!mDataForwardToRequest)
return NS_ERROR_FAILURE;
return NS_OK;
}
nsresult nsPluginStreamListenerPeer::InitializeEmbedded(nsIURI *aURL,
nsNPAPIPluginInstance* aInstance)
{
#ifdef PLUGIN_LOGGING
nsAutoCString urlSpec;
aURL->GetSpec(urlSpec);
PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL,
("nsPluginStreamListenerPeer::InitializeEmbedded url=%s\n", urlSpec.get()));
PR_LogFlush();
#endif
@ -365,9 +337,18 @@ nsresult nsPluginStreamListenerPeer::InitializeEmbedded(nsIURI *aURL,
mURL = aURL;
NS_ASSERTION(mPluginInstance == nullptr, "nsPluginStreamListenerPeer::InitializeEmbedded mPluginInstance != nullptr");
NS_ASSERTION(mPluginInstance == nullptr,
"nsPluginStreamListenerPeer::Initialize mPluginInstance != nullptr");
mPluginInstance = aInstance;
// If the plugin did not request this stream, e.g. the initial stream, we wont
// have a nsNPAPIPluginStreamListener yet - this will be handled by
// SetUpStreamListener
if (aListener) {
mPStreamListener = aListener;
mPStreamListener->SetStreamListenerPeer(this);
}
mPendingRequests = 1;
mDataForwardToRequest = new nsHashtable(16, false);

View File

@ -67,14 +67,12 @@ public:
bool UseExistingPluginCacheFile(nsPluginStreamListenerPeer* psi);
// Called by GetURL and PostURL (via NewStream)
// Called by GetURL and PostURL (via NewStream) or by the host in the case of
// the initial plugin stream.
nsresult Initialize(nsIURI *aURL,
nsNPAPIPluginInstance *aInstance,
nsNPAPIPluginStreamListener *aListener);
nsresult InitializeEmbedded(nsIURI *aURL,
nsNPAPIPluginInstance* aInstance);
nsresult OnFileAvailable(nsIFile* aFile);
nsresult ServeStreamAsFile(nsIRequest *request, nsISupports *ctxt);