зеркало из https://github.com/mozilla/gecko-dev.git
Bug 613360 - Safe use of thread observers in ContentParent. f=josh r=bsemdberg
This commit is contained in:
Родитель
6f7be3b9fd
Коммит
15558a568d
|
@ -225,8 +225,7 @@ ContentParent::Init()
|
||||||
nsCOMPtr<nsIThreadInternal>
|
nsCOMPtr<nsIThreadInternal>
|
||||||
threadInt(do_QueryInterface(NS_GetCurrentThread()));
|
threadInt(do_QueryInterface(NS_GetCurrentThread()));
|
||||||
if (threadInt) {
|
if (threadInt) {
|
||||||
threadInt->GetObserver(getter_AddRefs(mOldObserver));
|
threadInt->AddObserver(this);
|
||||||
threadInt->SetObserver(this);
|
|
||||||
}
|
}
|
||||||
if (obs) {
|
if (obs) {
|
||||||
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", nsnull);
|
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", nsnull);
|
||||||
|
@ -344,7 +343,7 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||||
nsCOMPtr<nsIThreadInternal>
|
nsCOMPtr<nsIThreadInternal>
|
||||||
threadInt(do_QueryInterface(NS_GetCurrentThread()));
|
threadInt(do_QueryInterface(NS_GetCurrentThread()));
|
||||||
if (threadInt)
|
if (threadInt)
|
||||||
threadInt->SetObserver(mOldObserver);
|
threadInt->RemoveObserver(this);
|
||||||
if (mRunToCompletionDepth)
|
if (mRunToCompletionDepth)
|
||||||
mRunToCompletionDepth = 0;
|
mRunToCompletionDepth = 0;
|
||||||
|
|
||||||
|
@ -1118,11 +1117,9 @@ ContentParent::RecvLoadURIExternal(const IPC::URI& uri)
|
||||||
/* void onDispatchedEvent (in nsIThreadInternal thread); */
|
/* void onDispatchedEvent (in nsIThreadInternal thread); */
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ContentParent::OnDispatchedEvent(nsIThreadInternal *thread)
|
ContentParent::OnDispatchedEvent(nsIThreadInternal *thread)
|
||||||
{
|
{
|
||||||
if (mOldObserver)
|
NS_NOTREACHED("OnDispatchedEvent unimplemented");
|
||||||
return mOldObserver->OnDispatchedEvent(thread);
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void onProcessNextEvent (in nsIThreadInternal thread, in boolean mayWait, in unsigned long recursionDepth); */
|
/* void onProcessNextEvent (in nsIThreadInternal thread, in boolean mayWait, in unsigned long recursionDepth); */
|
||||||
|
@ -1134,9 +1131,6 @@ ContentParent::OnProcessNextEvent(nsIThreadInternal *thread,
|
||||||
if (mRunToCompletionDepth)
|
if (mRunToCompletionDepth)
|
||||||
++mRunToCompletionDepth;
|
++mRunToCompletionDepth;
|
||||||
|
|
||||||
if (mOldObserver)
|
|
||||||
return mOldObserver->OnProcessNextEvent(thread, mayWait, recursionDepth);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,9 +1150,6 @@ ContentParent::AfterProcessNextEvent(nsIThreadInternal *thread,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mOldObserver)
|
|
||||||
return mOldObserver->AfterProcessNextEvent(thread, recursionDepth);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,6 @@ private:
|
||||||
PRInt32 mGeolocationWatchID;
|
PRInt32 mGeolocationWatchID;
|
||||||
int mRunToCompletionDepth;
|
int mRunToCompletionDepth;
|
||||||
bool mShouldCallUnblockChild;
|
bool mShouldCallUnblockChild;
|
||||||
nsCOMPtr<nsIThreadObserver> mOldObserver;
|
|
||||||
|
|
||||||
// This is a cache of all of the memory reporters
|
// This is a cache of all of the memory reporters
|
||||||
// registered in the child process. To update this, one
|
// registered in the child process. To update this, one
|
||||||
|
|
Загрузка…
Ссылка в новой задаче