mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Landing fix for bug 342810. Fixing leak of nsRunnable (huge leak on some flash sites). Patch by jmathies@mozilla.com, r+sr=jst@mozilla.com
This commit is contained in:
parent
e7e0ff1269
commit
dd6c74a75e
@ -76,7 +76,7 @@ public:
|
||||
ULONG GetMsg() { return mMsg; };
|
||||
MPARAM GetWParam() { return mWParam; };
|
||||
MPARAM GetLParam() { return mLParam; };
|
||||
PRBool InUse() { return (mWnd!=NULL || mMsg!=0); };
|
||||
PRBool InUse() { return (mWnd!=NULL); };
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
@ -86,7 +86,6 @@ protected:
|
||||
ULONG mMsg;
|
||||
MPARAM mWParam;
|
||||
MPARAM mLParam;
|
||||
PRBool mIsAlloced;
|
||||
};
|
||||
|
||||
PluginWindowEvent::PluginWindowEvent()
|
||||
@ -97,16 +96,13 @@ PluginWindowEvent::PluginWindowEvent()
|
||||
void PluginWindowEvent::Clear()
|
||||
{
|
||||
mWnd = NULL;
|
||||
mMsg = 0;
|
||||
mWParam = 0;
|
||||
mLParam = 0;
|
||||
}
|
||||
|
||||
void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd,
|
||||
ULONG aMsg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
NS_ASSERTION(aWnd!=NULL && aMsg!=0, "invalid plugin event value");
|
||||
NS_ASSERTION(mWnd==NULL && mMsg==0 && mWParam==0 && mLParam==0,"event already in use");
|
||||
NS_ASSERTION(aWnd != NULL, "invalid plugin event value");
|
||||
NS_ASSERTION(mWnd == NULL, "event already in use");
|
||||
mPluginWindowRef = ref;
|
||||
mWnd = aWnd;
|
||||
mMsg = aMsg;
|
||||
@ -139,8 +135,10 @@ private:
|
||||
public:
|
||||
// locals
|
||||
PFNWP GetWindowProc();
|
||||
already_AddRefed<nsIRunnable> GetPluginWindowEvent(HWND aWnd, ULONG aMsg,
|
||||
MPARAM mp1, MPARAM mp2);
|
||||
PluginWindowEvent* GetPluginWindowEvent(HWND aWnd,
|
||||
ULONG aMsg,
|
||||
MPARAM mp1,
|
||||
MPARAM mp2);
|
||||
|
||||
private:
|
||||
PFNWP mPluginWinProc;
|
||||
@ -272,7 +270,7 @@ NS_IMETHODIMP PluginWindowEvent::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIRunnable>
|
||||
PluginWindowEvent*
|
||||
nsPluginNativeWindowOS2::GetPluginWindowEvent(HWND aWnd, ULONG aMsg, MPARAM aMp1, MPARAM aMp2)
|
||||
{
|
||||
if (!mWeakRef) {
|
||||
@ -282,24 +280,29 @@ nsPluginNativeWindowOS2::GetPluginWindowEvent(HWND aWnd, ULONG aMsg, MPARAM aMp1
|
||||
}
|
||||
|
||||
PluginWindowEvent *event;
|
||||
if (!mCachedPluginWindowEvent || mCachedPluginWindowEvent->InUse()) {
|
||||
|
||||
// We have the ability to alloc if needed in case in the future some plugin
|
||||
// should post multiple PostMessages. However, this could lead to many
|
||||
// alloc's per second which could become a performance issue. If/when this
|
||||
// is asserting then this needs to be studied. See bug 169247
|
||||
NS_ASSERTION(1, "possible plugin performance issue");
|
||||
// alloc's per second which could become a performance issue. See bug 169247.
|
||||
if (!mCachedPluginWindowEvent)
|
||||
{
|
||||
event = new PluginWindowEvent();
|
||||
if (!event)
|
||||
return nsnull;
|
||||
if (!event) return nsnull;
|
||||
mCachedPluginWindowEvent = event;
|
||||
}
|
||||
else {
|
||||
else if (mCachedPluginWindowEvent->InUse())
|
||||
{
|
||||
event = new PluginWindowEvent();
|
||||
if (!event) return nsnull;
|
||||
}
|
||||
else
|
||||
{
|
||||
event = mCachedPluginWindowEvent;
|
||||
}
|
||||
NS_ADDREF(event);
|
||||
|
||||
event->Init(mWeakRef, aWnd, aMsg, aMp1, aMp2);
|
||||
return event;
|
||||
};
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowOS2::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
UINT GetMsg() { return mMsg; };
|
||||
WPARAM GetWParam() { return mWParam; };
|
||||
LPARAM GetLParam() { return mLParam; };
|
||||
PRBool InUse() { return (mWnd!=NULL || mMsg!=0); };
|
||||
PRBool InUse() { return (mWnd!=NULL); };
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
@ -89,7 +89,6 @@ protected:
|
||||
UINT mMsg;
|
||||
WPARAM mWParam;
|
||||
LPARAM mLParam;
|
||||
PRBool mIsAlloced;
|
||||
};
|
||||
|
||||
PluginWindowEvent::PluginWindowEvent()
|
||||
@ -108,8 +107,8 @@ void PluginWindowEvent::Clear()
|
||||
void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd,
|
||||
UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
||||
{
|
||||
NS_ASSERTION(aWnd!=NULL && aMsg!=0, "invalid plugin event value");
|
||||
NS_ASSERTION(mWnd==NULL && mMsg==0 && mWParam==0 && mLParam==0,"event already in use");
|
||||
NS_ASSERTION(aWnd != NULL, "invalid plugin event value");
|
||||
NS_ASSERTION(mWnd == NULL, "event already in use");
|
||||
mPluginWindowRef = ref;
|
||||
mWnd = aWnd;
|
||||
mMsg = aMsg;
|
||||
@ -145,7 +144,8 @@ public:
|
||||
// locals
|
||||
WNDPROC GetPrevWindowProc();
|
||||
WNDPROC GetWindowProc();
|
||||
already_AddRefed<nsIRunnable> GetPluginWindowEvent(HWND aWnd, UINT aMsg,
|
||||
PluginWindowEvent * GetPluginWindowEvent(HWND aWnd,
|
||||
UINT aMsg,
|
||||
WPARAM aWParam,
|
||||
LPARAM aLParam);
|
||||
|
||||
@ -439,7 +439,7 @@ NS_IMETHODIMP PluginWindowEvent::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIRunnable>
|
||||
PluginWindowEvent *
|
||||
nsPluginNativeWindowWin::GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
||||
{
|
||||
if (!mWeakRef) {
|
||||
@ -449,20 +449,25 @@ nsPluginNativeWindowWin::GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWPar
|
||||
}
|
||||
|
||||
PluginWindowEvent *event;
|
||||
if (!mCachedPluginWindowEvent || mCachedPluginWindowEvent->InUse()) {
|
||||
|
||||
// We have the ability to alloc if needed in case in the future some plugin
|
||||
// should post multiple PostMessages. However, this could lead to many
|
||||
// alloc's per second which could become a performance issue. If/when this
|
||||
// is asserting then this needs to be studied. See bug 169247
|
||||
NS_ASSERTION(1, "possible plugin performance issue");
|
||||
// alloc's per second which could become a performance issue. See bug 169247.
|
||||
if (!mCachedPluginWindowEvent)
|
||||
{
|
||||
event = new PluginWindowEvent();
|
||||
if (!event)
|
||||
return nsnull;
|
||||
if (!event) return nsnull;
|
||||
mCachedPluginWindowEvent = event;
|
||||
}
|
||||
else {
|
||||
else if (mCachedPluginWindowEvent->InUse())
|
||||
{
|
||||
event = new PluginWindowEvent();
|
||||
if (!event) return nsnull;
|
||||
}
|
||||
else
|
||||
{
|
||||
event = mCachedPluginWindowEvent;
|
||||
}
|
||||
NS_ADDREF(event);
|
||||
|
||||
event->Init(mWeakRef, aWnd, aMsg, aWParam, aLParam);
|
||||
return event;
|
||||
|
Loading…
Reference in New Issue
Block a user