[xiph-commits] r3121 - liboggplay/trunk/plugin
tahn at svn.annodex.net
tahn at svn.annodex.net
Thu Jun 28 06:59:06 PDT 2007
Author: tahn
Date: 2007-06-28 06:59:05 -0700 (Thu, 28 Jun 2007)
New Revision: 3121
Modified:
liboggplay/trunk/plugin/plugin.cpp
liboggplay/trunk/plugin/plugin.h
Log:
Made processCrossThreadCalls public so the windows heartbeat function can access it, and moved the semaphore locking inside it.
Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp 2007-06-28 13:45:37 UTC (rev 3120)
+++ liboggplay/trunk/plugin/plugin.cpp 2007-06-28 13:59:05 UTC (rev 3121)
@@ -410,9 +410,7 @@
// turn out to be useful for a couple of things.
//
// First, to process any events triggered from the display thread..
- SEM_WAIT(mCrossThreadSem);
- processCrossThreadCalls();
- SEM_SIGNAL(mCrossThreadSem);
+ processCrossThreadCalls(TRUE);
// ..and second, to handle hiding our output when the user changes tabs or
// scrolls the media off the page.
@@ -451,9 +449,7 @@
nsPluginInstance * plugin = NULL;
plugin = (nsPluginInstance *)GetWindowLongPtr(hWnd, GWL_USERDATA);
- SEM_WAIT(mCrossThreadSem);
- plugin->processCrossThreadCalls();
- SEM_SIGNAL(mCrossThreadSem);
+ plugin->processCrossThreadCalls(TRUE);
}
#endif
@@ -863,7 +859,7 @@
mCmmlStrings.push_back(strdup(cmml_data[i]));
}
#if defined(XP_UX)
- processCrossThreadCalls();
+ processCrossThreadCalls(FALSE);
#endif
}
SEM_SIGNAL(mCrossThreadSem);
@@ -874,7 +870,7 @@
SEM_WAIT(mCrossThreadSem);
mReachedEndOfMovie = TRUE;
#if defined(XP_UX)
- processCrossThreadCalls();
+ processCrossThreadCalls(FALSE);
#endif
SEM_SIGNAL(mCrossThreadSem);
}
@@ -894,9 +890,13 @@
// -- Deferred callback processing --
-// Every call to this method must protected by mCrossThreadSem.
+// This method must protected by mCrossThreadSem; if it's being called
+// from somewhere already thus protected, set useSemaphore to FALSE.
void
-nsPluginInstance::processCrossThreadCalls() {
+nsPluginInstance::processCrossThreadCalls(NPBool useSemaphore) {
+ if (useSemaphore) {
+ SEM_WAIT(mCrossThreadSem);
+ }
// Send any cmml strings collected by onCMMLData.
if (mCmmlStrings.size() > 0) {
@@ -928,5 +928,8 @@
}
}
+ if (useSemaphore) {
+ SEM_SIGNAL(mCrossThreadSem);
+ }
}
Modified: liboggplay/trunk/plugin/plugin.h
===================================================================
--- liboggplay/trunk/plugin/plugin.h 2007-06-28 13:45:37 UTC (rev 3120)
+++ liboggplay/trunk/plugin/plugin.h 2007-06-28 13:59:05 UTC (rev 3121)
@@ -121,11 +121,12 @@
void onCMMLData(char **cmml_data, int cmml_size);
void onEndOfMovie();
+ void processCrossThreadCalls(NPBool useSemaphore);
+
private:
char * curMovie() const;
bool playlistIndexOk(long index) const;
void clearCmmlStrings();
- void processCrossThreadCalls();
NPP mInstance;
NPBool mPluginInitialised;
More information about the commits
mailing list