Bug 555281 - Implement Core Animation NPAPI Drawing Model for OOPP. r=joe,josh,cjones

This commit is contained in:
Benoit Girard
2010-04-18 19:46:33 -04:00
parent e33f851f2d
commit 60a9016f9c
15 changed files with 1146 additions and 280 deletions

View File

@@ -715,7 +715,8 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
}
PluginInstanceParent* parentInstance =
new PluginInstanceParent(this, instance, mNPNIface);
new PluginInstanceParent(this, instance,
nsDependentCString(pluginType), mNPNIface);
if (!parentInstance->Init()) {
delete parentInstance;
@@ -782,3 +783,35 @@ PluginModuleParent::AnswerProcessSomeEvents()
return true;
}
#endif
#ifdef OS_MACOSX
#define DEFAULT_REFRESH_MS 20 // CoreAnimation: 50 FPS
void
PluginModuleParent::AddToRefreshTimer(PluginInstanceParent *aInstance) {
if (mCATimerTargets.Contains(aInstance)) {
return;
}
mCATimerTargets.AppendElement(aInstance);
if (mCATimerTargets.Length() == 1) {
mCATimer.Start(base::TimeDelta::FromMilliseconds(DEFAULT_REFRESH_MS),
this, &PluginModuleParent::CAUpdate);
}
}
void
PluginModuleParent::RemoveFromRefreshTimer(PluginInstanceParent *aInstance) {
PRBool visibleRemoved = mCATimerTargets.RemoveElement(aInstance);
if (visibleRemoved && mCATimerTargets.IsEmpty()) {
mCATimer.Stop();
}
}
void
PluginModuleParent::CAUpdate() {
nsTObserverArray<PluginInstanceParent*>::ForwardIterator iter(mCATimerTargets);
while (iter.HasMore()) {
iter.GetNext()->Invalidate();
}
}
#endif