Bug 583053 - Corruption issues when running rdio because windows double-pass rendering events don't win the RPC race, r=bent

This commit is contained in:
Benjamin Smedberg 2010-08-16 10:10:25 -04:00
Родитель 64da8c83e1
Коммит 2afbd46dc1
8 изменённых файлов: 36 добавлений и 24 удалений

Просмотреть файл

@ -86,8 +86,6 @@ using mozilla::gfx::SharedDIB;
// helpers' section for details.
const int kFlashWMUSERMessageThrottleDelayMs = 5;
#define NS_OOPP_DOUBLEPASS_MSGID TEXT("MozDoublePassMsg")
#elif defined(XP_MACOSX)
#include <ApplicationServices/ApplicationServices.h>
#endif // defined(XP_MACOSX)
@ -125,7 +123,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
#endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
#if defined(OS_WIN)
memset(&mAlphaExtract, 0, sizeof(mAlphaExtract));
mAlphaExtract.doublePassEvent = ::RegisterWindowMessage(NS_OOPP_DOUBLEPASS_MSGID);
#endif // OS_WIN
InitQuirksModes(aMimeType);
#if defined(OS_WIN)
@ -565,7 +562,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
*handled = SharedSurfacePaint(evcopy);
return true;
}
else if (evcopy.event == mAlphaExtract.doublePassEvent) {
else if (DoublePassRenderingEvent() == evcopy.event) {
// We'll render to mSharedSurfaceDib first, then render to a cached bitmap
// we store locally. The two passes are for alpha extraction, so the second
// pass must be to a flat white surface in order for things to work.

Просмотреть файл

@ -352,7 +352,6 @@ private:
};
gfx::SharedDIBWin mSharedSurfaceDib;
struct {
PRUint32 doublePassEvent;
PRUint16 doublePass;
HDC hdc;
HBITMAP bmp;

Просмотреть файл

@ -638,7 +638,12 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
#if defined(OS_WIN)
if (mWindowType == NPWindowTypeDrawable) {
switch(npevent->event) {
if (DoublePassRenderingEvent() == npevent->event) {
CallPaint(npremoteevent, &handled);
return handled;
}
switch (npevent->event) {
case WM_PAINT:
{
RECT rect;

Просмотреть файл

@ -162,5 +162,18 @@ void DeferNPVariantLastRelease(const NPNetscapeFuncs* f, NPVariant* v)
VOID_TO_NPVARIANT(*v);
}
#ifdef XP_WIN
// The private event used for double-pass widgetless plugin rendering.
UINT DoublePassRenderingEvent()
{
static UINT gEventID = 0;
if (!gEventID)
gEventID = ::RegisterWindowMessage(L"MozDoublePassMsg");
return gEventID;
}
#endif
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -271,6 +271,11 @@ struct DeletingObjectEntry : public nsPtrHashKey<NPObject>
bool mDeleted;
};
#ifdef XP_WIN
// The private event used for double-pass widgetless plugin rendering.
UINT DoublePassRenderingEvent();
#endif
} /* namespace plugins */
} /* namespace mozilla */

Просмотреть файл

@ -144,6 +144,8 @@ RESOURCES_HTML = \
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \

Просмотреть файл

@ -46,6 +46,10 @@
/* rendering objects for replaced elements implemented by a plugin */
#ifdef MOZ_IPC
#include "mozilla/plugins/PluginMessageUtils.h"
#endif
#ifdef MOZ_WIDGET_QT
#include <QWidget>
#include <QKeyEvent>
@ -207,9 +211,6 @@ using mozilla::DefaultXDisplay;
#ifdef XP_WIN
#include <wtypes.h>
#include <winuser.h>
#ifdef MOZ_IPC
#define NS_OOPP_DOUBLEPASS_MSGID TEXT("MozDoublePassMsg")
#endif
#endif
#ifdef XP_OS2
@ -624,10 +625,6 @@ nsObjectFrame::Init(nsIContent* aContent,
nsresult rv = nsObjectFrameSuper::Init(aContent, aParent, aPrevInFlow);
#ifdef XP_WIN
mDoublePassEvent = 0;
#endif
return rv;
}
@ -1726,15 +1723,12 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
// OOP plugin specific: let the shim know before we paint if we are doing a
// double pass render. If this plugin isn't oop, the register window message
// will be ignored.
if (!mDoublePassEvent)
mDoublePassEvent = ::RegisterWindowMessage(NS_OOPP_DOUBLEPASS_MSGID);
if (mDoublePassEvent) {
NPEvent pluginEvent;
pluginEvent.event = mDoublePassEvent;
pluginEvent.wParam = 0;
pluginEvent.lParam = 0;
NPEvent pluginEvent;
pluginEvent.event = mozilla::plugins::DoublePassRenderingEvent();
pluginEvent.wParam = 0;
pluginEvent.lParam = 0;
if (pluginEvent.event)
inst->HandleEvent(&pluginEvent, nsnull);
}
}
#endif
do {

Просмотреть файл

@ -252,9 +252,6 @@ private:
nsIView* mInnerView;
nsCOMPtr<nsIWidget> mWidget;
nsIntRect mWindowlessRect;
#ifdef XP_WIN
PRUint32 mDoublePassEvent;
#endif
// For assertions that make it easier to determine if a crash is due
// to the underlying problem described in bug 136927, and to prevent