Bug 555281 - Implement Core Animation NPAPI Drawing Model for OOPP. r=joe,josh,cjones
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user