Bug 591687: Add interface to retrieve plugins actual (remote) drawing model from nsObjectFrame. r=bsmedberg a=blocking2.0betaN+

This commit is contained in:
Matt Woodrow 2011-02-12 10:55:40 -05:00
Родитель 32c0e9e64a
Коммит 52fa449634
11 изменённых файлов: 86 добавлений и 2 удалений

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

@ -572,6 +572,16 @@ PluginInstanceParent::GetSurface(gfxASurface** aSurface)
return NS_ERROR_NOT_AVAILABLE;
}
#ifdef XP_MACOSX
nsresult
PluginInstanceParent::IsRemoteDrawingCoreAnimation(PRBool *aDrawing)
{
*aDrawing = (NPDrawingModelCoreAnimation == (NPDrawingModel)mDrawingModel ||
NPDrawingModelInvalidatingCoreAnimation == (NPDrawingModel)mDrawingModel);
return NS_OK;
}
#endif
NPError
PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
{

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

@ -277,6 +277,9 @@ public:
nsresult AsyncSetWindow(NPWindow* window);
nsresult GetSurface(gfxASurface** aSurface);
#ifdef XP_MACOSX
nsresult IsRemoteDrawingCoreAnimation(PRBool *aDrawing);
#endif
private:
// Quirks mode support for various plugin mime types

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

@ -89,6 +89,9 @@ public:
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
virtual nsresult GetSurface(NPP instance, gfxASurface** aSurface) = 0;
virtual bool UseAsyncPainting() = 0;
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing) = 0;
#endif
};

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

@ -879,6 +879,18 @@ PluginModuleParent::NPP_GetSitesWithData(InfallibleTArray<nsCString>& result)
return NS_OK;
}
#if defined(XP_MACOSX)
nsresult
PluginModuleParent::IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing)
{
PluginInstanceParent* i = InstCast(instance);
if (!i)
return NS_ERROR_FAILURE;
return i->IsRemoteDrawingCoreAnimation(aDrawing);
}
#endif
bool
PluginModuleParent::AnswerNPN_GetValue_WithBoolReturn(const NPNVariable& aVariable,
NPError* aError,

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

@ -253,6 +253,10 @@ private:
uint64_t maxAge);
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing);
#endif
private:
void WritePluginExtraDataForMinidump(const nsAString& id);
void WriteExtraDataForHang();

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

@ -362,6 +362,7 @@ public:
#ifdef XP_MACOSX
NPDrawingModel GetDrawingModel();
PRBool IsRemoteDrawingCoreAnimation();
NPEventModel GetEventModel();
static void CARefresh(nsITimer *aTimer, void *aClosure);
static void AddToCARefreshTimer(nsPluginInstanceOwner *aPluginInstance);
@ -3937,6 +3938,19 @@ NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()
return drawingModel;
}
PRBool nsPluginInstanceOwner::IsRemoteDrawingCoreAnimation()
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = do_QueryInterface(mInstance);
if (!inst)
return PR_FALSE;
PRBool coreAnimation;
if (!NS_SUCCEEDED(inst->IsRemoteDrawingCoreAnimation(&coreAnimation)))
return PR_FALSE;
return coreAnimation;
}
NPEventModel nsPluginInstanceOwner::GetEventModel()
{
return mEventModel;

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

@ -247,3 +247,10 @@ interface nsIPluginInstance : nsISupports
*/
PRBool useAsyncPainting();
};
// XXX kill me after branching
[noscript, uuid(c4251cb8-dd2f-4885-a008-2d1b4d21fd33)]
interface nsIPluginInstance_MOZILLA_2_0_BRANCH : nsIPluginInstance
{
PRBool isRemoteDrawingCoreAnimation();
};

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

@ -255,4 +255,15 @@ PluginPRLibrary::GetSurface(NPP instance, gfxASurface** aSurface)
return NS_OK;
}
#if defined(XP_MACOSX)
nsresult
PluginPRLibrary::IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing)
{
nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*)instance->ndata;
NS_ENSURE_TRUE(inst, NS_ERROR_NULL_POINTER);
*aDrawing = PR_FALSE;
return NS_OK;
}
#endif
} // namespace mozilla

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

@ -142,6 +142,9 @@ public:
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
virtual nsresult GetSurface(NPP instance, gfxASurface** aSurface);
NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing);
#endif
private:
NP_InitializeFunc mNP_Initialize;

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

@ -65,7 +65,7 @@ using mozilla::TimeStamp;
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
NS_IMPL_ISUPPORTS1(nsNPAPIPluginInstance, nsIPluginInstance)
NS_IMPL_ISUPPORTS2(nsNPAPIPluginInstance, nsIPluginInstance, nsIPluginInstance_MOZILLA_2_0_BRANCH)
nsNPAPIPluginInstance::nsNPAPIPluginInstance(nsNPAPIPlugin* plugin)
:
@ -716,6 +716,22 @@ NS_IMETHODIMP nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
#endif
}
NS_IMETHODIMP nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(PRBool* aDrawing)
{
#ifdef XP_MACOSX
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
return NS_ERROR_FAILURE;
return library->IsRemoteDrawingCoreAnimation(&mNPP, aDrawing);
#else
return NS_ERROR_FAILURE;
#endif
}
NS_IMETHODIMP
nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
{

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

@ -67,7 +67,7 @@ public:
void (*callback)(NPP npp, uint32_t timerID);
};
class nsNPAPIPluginInstance : public nsIPluginInstance
class nsNPAPIPluginInstance : public nsIPluginInstance_MOZILLA_2_0_BRANCH
{
private:
typedef mozilla::PluginLibrary PluginLibrary;
@ -75,6 +75,7 @@ private:
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPLUGININSTANCE
NS_DECL_NSIPLUGININSTANCE_MOZILLA_2_0_BRANCH
nsNPAPIPlugin* GetPlugin();