From b10ab6647121346900d5de8c64e29dd857bebd5e Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Tue, 15 Feb 2011 12:08:07 -0500 Subject: [PATCH] Bug 633942: Add debug logging for OOPP model negotiation. r=bsmedberg a=josh --- dom/plugins/PluginInstanceChild.cpp | 18 +++++++++++------- dom/plugins/PluginInstanceChild.h | 9 +++------ dom/plugins/PluginModuleChild.cpp | 9 ++++++++- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index 1ac8a2a48e3c..4053ee845650 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -128,12 +128,16 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface) #endif // OS_WIN , mAsyncCallMutex("PluginInstanceChild::mAsyncCallMutex") #if defined(OS_MACOSX) -#if defined(__i386__) +#if defined(NP_NO_CARBON) + , mEventModel(NPEventModelCocoa) + , mDrawingModel(NPDrawingModelCoreGraphics) +#else , mEventModel(NPEventModelCarbon) + , mDrawingModel(NPDrawingModelQuickDraw) #endif , mShColorSpace(nsnull) , mShContext(nsnull) - , mDrawingModel(NPDrawingModelCoreGraphics) + , mCurrentEvent(nsnull) #endif , mLayersRendering(false) @@ -476,25 +480,25 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue) #ifdef XP_MACOSX case NPPVpluginDrawingModel: { - NPError rv; int drawingModel = (int16) (intptr_t) aValue; + NPError rv = NPERR_GENERIC_ERROR; if (!CallNPN_SetValue_NPPVpluginDrawingModel(drawingModel, &rv)) return NPERR_GENERIC_ERROR; - mDrawingModel = drawingModel; + + mDrawingModel = static_cast(drawingModel); return rv; } case NPPVpluginEventModel: { - NPError rv; int eventModel = (int16) (intptr_t) aValue; + NPError rv = NPERR_GENERIC_ERROR; if (!CallNPN_SetValue_NPPVpluginEventModel(eventModel, &rv)) return NPERR_GENERIC_ERROR; -#if defined(__i386__) + mEventModel = static_cast(eventModel); -#endif return rv; } diff --git a/dom/plugins/PluginInstanceChild.h b/dom/plugins/PluginInstanceChild.h index 5ef37ba3a4ee..e01c9ca0a4bb 100644 --- a/dom/plugins/PluginInstanceChild.h +++ b/dom/plugins/PluginInstanceChild.h @@ -390,12 +390,10 @@ private: #endif // defined(OS_WIN) #if defined(OS_MACOSX) private: -#if defined(__i386__) NPEventModel mEventModel; -#endif + NPDrawingModel mDrawingModel; CGColorSpaceRef mShColorSpace; CGContextRef mShContext; - int16_t mDrawingModel; nsCARenderer mCARenderer; public: @@ -403,9 +401,8 @@ public: return mCurrentEvent; } -#if defined(__i386__) - NPEventModel EventModel() { return mEventModel; } -#endif + NPEventModel EventModel() { return mEventModel; } + NPDrawingModel DrawingModel() { return mDrawingModel; } private: const NPCocoaEvent *mCurrentEvent; diff --git a/dom/plugins/PluginModuleChild.cpp b/dom/plugins/PluginModuleChild.cpp index dfde96cfa178..e71b4777e8d8 100644 --- a/dom/plugins/PluginModuleChild.cpp +++ b/dom/plugins/PluginModuleChild.cpp @@ -1910,7 +1910,13 @@ PluginModuleChild::AnswerPPluginInstanceConstructor(PPluginInstanceChild* aActor return false; } -#if defined(XP_MACOSX) && defined(__i386__) +#if defined(XP_MACOSX) + if (getenv("NPAPI_MODEL_DEBUG")) { + printf("OOP plugin negotiated NPAPI event model: %d\n", childInstance->EventModel()); + printf("OOP plugin negotiated NPAPI drawing model: %d\n", childInstance->DrawingModel()); + } + +#if defined(__i386__) // If an i386 Mac OS X plugin has selected the Carbon event model then // we have to fail. We do not support putting Carbon event model plugins // out of process. Note that Carbon is the default model so out of process @@ -1925,6 +1931,7 @@ PluginModuleChild::AnswerPPluginInstanceConstructor(PPluginInstanceChild* aActor // Fail to instantiate. *rv = NPERR_MODULE_LOAD_FAILED_ERROR; } +#endif #endif return true;