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

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

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

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

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

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

@ -162,5 +162,18 @@ void DeferNPVariantLastRelease(const NPNetscapeFuncs* f, NPVariant* v)
VOID_TO_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 plugins
} // namespace mozilla } // namespace mozilla

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

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

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

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

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

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

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

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