mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 784131 - nsObjectLoadingcontent: Minor cleanup around mPendingInstantiateEvent. r=josh
This commit is contained in:
parent
413b2e3042
commit
661df28246
@ -128,7 +128,8 @@ nsAsyncInstantiateEvent::Run()
|
||||
nsObjectLoadingContent *objLC =
|
||||
static_cast<nsObjectLoadingContent *>(mContent.get());
|
||||
|
||||
// do nothing if we've been revoked
|
||||
// If objLC is no longer tracking this event, we've been canceled or
|
||||
// superceded
|
||||
if (objLC->mPendingInstantiateEvent != this) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2369,27 +2370,25 @@ nsObjectLoadingContent::SyncStartPluginInstance()
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::AsyncStartPluginInstance()
|
||||
{
|
||||
// OK to have an instance already.
|
||||
if (mInstanceOwner) {
|
||||
// OK to have an instance already or a pending spawn.
|
||||
if (mInstanceOwner || mPendingInstantiateEvent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
nsIDocument* doc = thisContent->OwnerDoc();
|
||||
if (doc->IsStaticDocument() || doc->IsBeingUsedAsImage()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We always start plugins on a runnable.
|
||||
// We don't want a script blocker on the stack during instantiation.
|
||||
nsCOMPtr<nsIRunnable> event = new nsAsyncInstantiateEvent(this);
|
||||
if (!event) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult rv = NS_DispatchToCurrentThread(event);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Remember this event. This is a weak reference that will be cleared
|
||||
// when the event runs.
|
||||
// Track pending events
|
||||
mPendingInstantiateEvent = event;
|
||||
}
|
||||
|
||||
|
@ -449,8 +449,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
// Frame loader, for content documents we load.
|
||||
nsRefPtr<nsFrameLoader> mFrameLoader;
|
||||
|
||||
// A pending nsAsyncInstantiateEvent (may be null). This is a weak ref.
|
||||
nsIRunnable *mPendingInstantiateEvent;
|
||||
// Track if we have a pending AsyncInstantiateEvent
|
||||
nsCOMPtr<nsIRunnable> mPendingInstantiateEvent;
|
||||
|
||||
// The content type of our current load target, updated by
|
||||
// UpdateObjectParameters(). Takes the channel's type into account once
|
||||
|
Loading…
Reference in New Issue
Block a user