gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-254-gc8901d4
Date: Sat, 12 Mar 2011 14:37:14 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  c8901d4dc7446038a66c80e923a5a37c386979bc (commit)
       via  ff1ebc278c6dcb2c971eb8fa95af581fe4b07c2d (commit)
       via  a0f6fdd77ffc75e527ab92c2ebd3bce472c36af8 (commit)
      from  95a6133393633707d575e8f49ea2dd124befdf69 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=c8901d4dc7446038a66c80e923a5a37c386979bc


commit c8901d4dc7446038a66c80e923a5a37c386979bc
Author: Bastiaan Jacques <address@hidden>
Date:   Sat Mar 12 15:28:58 2011 +0100

    Add some documentation.

diff --git a/plugin/npapi/plugin.h b/plugin/npapi/plugin.h
index a5b3ef6..835d863 100644
--- a/plugin/npapi/plugin.h
+++ b/plugin/npapi/plugin.h
@@ -102,6 +102,11 @@ private:
 
     bool handlePlayerRequests(GIOChannel* iochan, GIOCondition cond);
 
+    /// Setup an event handler for a file descriptor.
+    /// @param fd the file descriptor to handle
+    /// @param handler the function to invoke
+    /// @param signals the signals for which to invoke the handler
+    /// See GIOChannel documentation for more information on the parameters.
     void setupIOChannel(int fd, GIOFunc handler, GIOCondition signals) const;
 
 
@@ -122,6 +127,10 @@ private:
     unsigned int                       _width;
     unsigned int                       _height;
     std::map<std::string, std::string> _options;
+    /// This is the file descriptor for writing to Gnash's standard input.
+    /// As of this writing, the file descriptor must be closed before Gnash
+    /// can finish parsing, which in turn must be finished before Gnash starts
+    /// playback.
     int                                _streamfd;
     pid_t                              _childpid;
     int                                _filefd;

http://git.savannah.gnu.org/cgit//commit/?id=ff1ebc278c6dcb2c971eb8fa95af581fe4b07c2d


commit ff1ebc278c6dcb2c971eb8fa95af581fe4b07c2d
Author: Bastiaan Jacques <address@hidden>
Date:   Sat Mar 12 15:21:55 2011 +0100

    Manage the second file descriptor as well.

diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index ea37489..aab2197 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -398,7 +398,6 @@ nsPluginInstance::nsPluginInstance(nsPluginCreateData* data)
     _width(0),
     _height(0),
     _streamfd(-1),
-    _ichanWatchId(0),
     _childpid(0),
     _filefd(-1),
     _name(),
@@ -460,15 +459,12 @@ nsPluginInstance::~nsPluginInstance()
 {
 //    gnash::log_debug("plugin instance destruction");
 
-    if ( _ichanWatchId ) {
-        g_source_remove(_ichanWatchId);
-        _ichanWatchId = 0;
-    }
-
     if (_scriptObject) {
         NPN_ReleaseObject(_scriptObject);
     }
 
+    do { } while (g_source_remove_by_user_data(this));
+
     if (_childpid > 0) {
         // When the child has terminated (signaled by GTK through GtkSocket), 
it
         // remains as a defunct process and we remove it from the kernel table 
now.
@@ -630,7 +626,6 @@ nsPluginInstance::NewStream(NPMIMEType /*type*/, NPStream* 
stream,
 NPError
 nsPluginInstance::DestroyStream(NPStream* /*stream*/, NPError /*reason*/)
 {
-
     if (_streamfd != -1) {
         if (close(_streamfd) == -1) {
             perror("closing _streamfd");
@@ -678,10 +673,6 @@ nsPluginInstance::handlePlayerRequests(GIOChannel* iochan, 
GIOCondition cond)
 
     if ( cond & G_IO_HUP ) {
         gnash::log_debug("Player control socket hang up");
-        // Returning false here will cause the "watch" to be removed. This 
watch
-        // is the only reference held to the GIOChannel, so it will be
-        // destroyed. We must make sure we don't attempt to destroy it again.
-        _ichanWatchId = 0;
         return false;
     }
 
@@ -742,6 +733,14 @@ nsPluginInstance::handlePlayerRequests(GIOChannel* iochan, 
GIOCondition cond)
     return true;
 }
 
+// This GIOFunc handler removes the source from the mainloop.
+gboolean 
+remove_handler(GIOChannel *source, GIOCondition condition, gpointer data)
+{
+    return FALSE;
+}
+
+
 // There may be multiple Invoke messages in a single packet, so each
 // packet needs to be broken up into separate messages to be parsed.
 bool
@@ -1286,6 +1285,32 @@ wait_for_gdb()
 }
 
 void
+nsPluginInstance::setupIOChannel(int fd, GIOFunc handler, GIOCondition 
signals) const
+{
+    GIOChannel* ichan = g_io_channel_unix_new(fd);
+    g_io_channel_set_close_on_unref(ichan, true);
+
+    GError* error = 0;
+    GIOStatus rv = g_io_channel_set_flags(ichan, G_IO_FLAG_NONBLOCK,
+                                          &error);
+    if (error || rv != G_IO_STATUS_NORMAL) {
+        log_error("Could not make player communication nonblocking.");
+
+        g_io_channel_unref(ichan);
+        if (error) {
+            g_error_free(error);
+        }
+        return;
+    }
+
+    gnash::log_debug("New IO Channel for fd #%d",
+                     g_io_channel_unix_get_fd(ichan));
+    g_io_add_watch(ichan, signals, handler, (gpointer)this); 
+    g_io_channel_unref(ichan);
+}
+
+
+void
 nsPluginInstance::startProc()
 {
 
@@ -1363,30 +1388,12 @@ nsPluginInstance::startProc()
             gnash::log_debug("Forked successfully, child process PID is %d",
                              _childpid);
         }
-        
-        GIOChannel* ichan = g_io_channel_unix_new(c2p_pipe[0]);
-        g_io_channel_set_close_on_unref(ichan, true);
 
-        GError* error = 0;
-        GIOStatus rv = g_io_channel_set_flags(ichan, G_IO_FLAG_NONBLOCK,
-                                              &error);
-        if (error || rv != G_IO_STATUS_NORMAL) {
-            log_error("Could not make player communication nonblocking.");
-
-            g_io_channel_unref(ichan);
-            if (error) {
-                g_error_free(error);
-            }
-            return;
-        }
+        setupIOChannel(c2p_pipe[0], (GIOFunc)handlePlayerRequestsWrapper,
+                                    (GIOCondition)(G_IO_IN|G_IO_HUP));
+        
+        setupIOChannel(p2c_controlpipe[1], remove_handler, G_IO_HUP);
 
-        gnash::log_debug("New IO Channel for fd #%d",
-                         g_io_channel_unix_get_fd(ichan));
-        _ichanWatchId = g_io_add_watch(ichan, 
-                                       (GIOCondition)(G_IO_IN|G_IO_HUP), 
-                                       (GIOFunc)handlePlayerRequestsWrapper,
-                                       this);
-        g_io_channel_unref(ichan);
         return;
     }
     
diff --git a/plugin/npapi/plugin.h b/plugin/npapi/plugin.h
index 409381e..a5b3ef6 100644
--- a/plugin/npapi/plugin.h
+++ b/plugin/npapi/plugin.h
@@ -102,6 +102,9 @@ private:
 
     bool handlePlayerRequests(GIOChannel* iochan, GIOCondition cond);
 
+    void setupIOChannel(int fd, GIOFunc handler, GIOCondition signals) const;
+
+
     /// Process requests from the player.
     //
     /// @return true if the requests were processed, false otherwise (bogus 
request..)
@@ -120,7 +123,6 @@ private:
     unsigned int                       _height;
     std::map<std::string, std::string> _options;
     int                                _streamfd;
-    int                                _ichanWatchId;
     pid_t                              _childpid;
     int                                _filefd;
 

http://git.savannah.gnu.org/cgit//commit/?id=a0f6fdd77ffc75e527ab92c2ebd3bce472c36af8


commit a0f6fdd77ffc75e527ab92c2ebd3bce472c36af8
Author: Bastiaan Jacques <address@hidden>
Date:   Fri Mar 11 23:22:50 2011 +0100

    Call the function wrappers rather than directly invoking the function 
pointers.

diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index b6d8574..ea37489 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -426,8 +426,8 @@ nsPluginInstance::nsPluginInstance(nsPluginCreateData* data)
     }
 
     if (NPNFuncs.version >= 14) { // since NPAPI start to support
-        _scriptObject = (GnashPluginScriptObject *)NPNFuncs.createobject(
-            _instance, GnashPluginScriptObject::marshalGetNPClass());
+        _scriptObject = (GnashPluginScriptObject*) NPN_CreateObject( _instance,
+            GnashPluginScriptObject::marshalGetNPClass());
     }
     
     return;
@@ -583,7 +583,7 @@ nsPluginInstance::GetValue(NPPVariable aVariable, void 
*aValue)
     if (aVariable == NPPVpluginScriptableNPObject) {
         if (_scriptObject) {
             void **v = (void **)aValue;
-            NPNFuncs.retainobject(_scriptObject);
+            NPN_RetainObject(_scriptObject);
             *v = _scriptObject;
         } else {
             gnash::log_debug("_scriptObject is not assigned");

-----------------------------------------------------------------------

Summary of changes:
 plugin/npapi/plugin.cpp |   79 +++++++++++++++++++++++++---------------------
 plugin/npapi/plugin.h   |   13 +++++++-
 2 files changed, 55 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]