Author: miguel
Date: 2007-07-23 01:29:44 -0400 (Mon, 23 Jul 2007)
New Revision: 82460

Modified:
   trunk/moon/plugin/ChangeLog
   trunk/moon/plugin/moonlight.cs
   trunk/moon/plugin/plugin.cpp
   trunk/moon/plugin/plugin.h
   trunk/moon/src/ChangeLog
   trunk/moon/src/runtime.cpp
Log:
2007-07-23  Miguel de Icaza  <[EMAIL PROTECTED]>

        * plugin.cpp (PluginInstance): track the timers on a linked list
        here. 

        (~PluginInstance): Remove all the timers for this plugin on
        destruction. 

        (plugin_html_timer_timeout_add, plugin_html_timer_timeout_stop):
        Move these routines here and track all the timers created. 

        * moonlight.cs: Use the type from agmono instead of agclr

2007-07-23  Miguel de Icaza  <[EMAIL PROTECTED]>

        * runtime.cpp: Removed the timer code from here, move to plugin.




Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2007-07-23 05:06:52 UTC (rev 82459)
+++ trunk/moon/plugin/ChangeLog 2007-07-23 05:29:44 UTC (rev 82460)
@@ -1,3 +1,16 @@
+2007-07-23  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * plugin.cpp (PluginInstance): track the timers on a linked list
+       here. 
+
+       (~PluginInstance): Remove all the timers for this plugin on
+       destruction. 
+
+       (plugin_html_timer_timeout_add, plugin_html_timer_timeout_stop):
+       Move these routines here and track all the timers created. 
+
+       * moonlight.cs: Use the type from agmono instead of agclr
+
 2007-07-21  Chris Toshok  <[EMAIL PROTECTED]>
 
        * plugin-class.cpp (variant_to_value): fix this such that it

Modified: trunk/moon/plugin/moonlight.cs
===================================================================
--- trunk/moon/plugin/moonlight.cs      2007-07-23 05:06:52 UTC (rev 82459)
+++ trunk/moon/plugin/moonlight.cs      2007-07-23 05:29:44 UTC (rev 82460)
@@ -175,12 +175,11 @@
 
                        Hosting.xaml_set_parser_callbacks 
(create_element_callback, set_attribute_callback, hookup_event_callback);
                        
-                       Type t = typeof (System.Windows.Interop.BrowserHost);
-                       MethodInfo m = t.GetMethod ("SetPluginHandle", 
BindingFlags.Static | BindingFlags.NonPublic);
+                       Type t = typeof (System.Windows.Interop.PluginHost);
+                       MethodInfo m = t.GetMethod ("SetPluginHandle", 
BindingFlags.Static | BindingFlags.Public);
                        if (m == null){
-                               Console.WriteLine ("Having problems");
+                               Console.Error.WriteLine ("Could not find 
System.Window.Interop.PluginHost::SetPluginHandle");
                        } else {
-                               Console.WriteLine ("The plugin handle is {0}", 
_plugin);
                                m.Invoke (null, new object [] { _plugin });
                        } 
                }

Modified: trunk/moon/plugin/plugin.cpp
===================================================================
--- trunk/moon/plugin/plugin.cpp        2007-07-23 05:06:52 UTC (rev 82459)
+++ trunk/moon/plugin/plugin.cpp        2007-07-23 05:29:44 UTC (rev 82460)
@@ -122,6 +122,8 @@
        this->vm_missing_file = NULL;
        this->mono_loader_object = NULL;
 
+       this->timers = NULL;
+
        plugin_instances = g_slist_append (plugin_instances, this->instance);
 
        /* back pointer to us */
@@ -130,6 +132,16 @@
 
 PluginInstance::~PluginInstance ()
 {
+       // Kill timers
+       GSList *p;
+       for (p = timers; p != NULL; p = p->next){
+               uint32_t source_id = (uint32_t) p->data;
+
+               g_source_remove (source_id);
+       }
+       g_slist_free (p);
+       
+       // Remove us from the list.
        plugin_instances = g_slist_remove (plugin_instances, this->instance);
 
        // 
@@ -594,7 +606,30 @@
        return instance->getActualHeight ();
 }
 
+uint32_t
+plugin_html_timer_timeout_add (PluginInstance *instance, int32_t interval, 
GSourceFunc callback, gpointer data)
+{
+       uint32_t id;
+
+#if GLIB_CHECK_VERSION(2,14,0)
+       if (interval > 1000 && ((interval % 1000) == 0))
+               id = g_timeout_add_seconds (interval / 1000, callback, data);
+       else
+#endif
+               id = g_timeout_add (interval, callback, data);
+
+       instance->timers = g_slist_append (instance->timers, GINT_TO_POINTER 
((int)id));
+}
+
 void
+plugin_html_timer_timeout_stop (PluginInstance *instance, uint32_t source_id)
+{
+       g_source_remove (source_id);
+       instance->timers = g_slist_remove (instance->timers, GINT_TO_POINTER 
(source_id));
+}
+
+
+void
 plugin_instance_get_browser_information (PluginInstance *instance,
                                         char **name, char **version,
                                         char **platform, char **userAgent,

Modified: trunk/moon/plugin/plugin.h
===================================================================
--- trunk/moon/plugin/plugin.h  2007-07-23 05:06:52 UTC (rev 82459)
+++ trunk/moon/plugin/plugin.h  2007-07-23 05:29:44 UTC (rev 82460)
@@ -97,6 +97,7 @@
        void getBrowserInformation (char **name, char **version,
                                    char **platform, char **userAgent,
                                    bool *cookieEnabled);
+       GSList *timers;
 };
 
 extern GSList *plugin_instances;
@@ -144,7 +145,10 @@
                                              char **name, char **version,
                                              char **platform, char **userAgent,
                                              bool *cookieEnabled);
-                                             
+
+void     plugin_html_timer_timeout_stop (PluginInstance *instance, uint32_t 
source_id);
+uint32_t plugin_html_timer_timeout_add (PluginInstance *instance, int32_t 
interval, GSourceFunc callback, gpointer data);
+
 G_END_DECLS
 
 #endif /* MOON_PLUGIN */

Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-07-23 05:06:52 UTC (rev 82459)
+++ trunk/moon/src/ChangeLog    2007-07-23 05:29:44 UTC (rev 82460)
@@ -1,3 +1,7 @@
+2007-07-23  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * runtime.cpp: Removed the timer code from here, move to plugin.
+
 2007-07-20  Chris Toshok  <[EMAIL PROTECTED]>
 
        * xaml.cpp (custom_add_child): this method is what's called when

Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp  2007-07-23 05:06:52 UTC (rev 82459)
+++ trunk/moon/src/runtime.cpp  2007-07-23 05:29:44 UTC (rev 82460)
@@ -778,24 +778,7 @@
        stylus_init ();
 }
 
-uint32_t
-html_timer_timeout_add (int32_t interval, GSourceFunc callback, gpointer data)
-{
-#if GLIB_CHECK_VERSION(2,14,0)
-       if (interval > 1000 && ((interval % 1000) == 0))
-               return g_timeout_add_seconds (interval / 1000, callback, data);
-       else
-#endif
-               return g_timeout_add (interval, callback, data);
-}
-
 void
-html_timer_timeout_stop (uint32_t source_id)
-{
-       g_source_remove (source_id);
-}
-
-void
 runtime_shutdown ()
 {
        if (!inited)
@@ -806,4 +789,5 @@
        DependencyObject::Shutdown ();
 
        inited = false;
+       
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to