changelog, news.

removing an api is not quite nice

Vincent

On Thu, Jul 5, 2012 at 12:06 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> e_dbus: Use idler instead of idler_enterer
>
>   Instead of using an idle_enterer to process D-Bus messages, use andidler 
> that does not requiring creating a dummy event and wakeup the mainloop every 
> interation.Remove unnecessary event when a signal is received and also a 
> callbackfunction to wake up the main loop when there a message in queue.
>
>   Patch by: zehortigoza <zehortig...@profusion.mobi>
>
>
>
> Author:       lucas
> Date:         2012-07-04 15:06:10 -0700 (Wed, 04 Jul 2012)
> New Revision: 73315
> Trac:         http://trac.enlightenment.org/e/changeset/73315
>
> Modified:
>   trunk/e_dbus/src/lib/dbus/E_DBus.h trunk/e_dbus/src/lib/dbus/e_dbus.c 
> trunk/e_dbus/src/lib/dbus/e_dbus_private.h
>
> Modified: trunk/e_dbus/src/lib/dbus/E_DBus.h
> ===================================================================
> --- trunk/e_dbus/src/lib/dbus/E_DBus.h  2012-07-04 22:06:07 UTC (rev 73314)
> +++ trunk/e_dbus/src/lib/dbus/E_DBus.h  2012-07-04 22:06:10 UTC (rev 73315)
> @@ -114,7 +114,6 @@
>     EAPI extern E_DBus_Version *e_dbus_version;
>
>     EAPI extern int E_DBUS_DOMAIN_GLOBAL;
> -   EAPI extern int E_DBUS_EVENT_SIGNAL;
>
>     typedef struct E_DBus_Connection E_DBus_Connection;
>     typedef struct E_DBus_Object E_DBus_Object;
>
> Modified: trunk/e_dbus/src/lib/dbus/e_dbus.c
> ===================================================================
> --- trunk/e_dbus/src/lib/dbus/e_dbus.c  2012-07-04 22:06:07 UTC (rev 73314)
> +++ trunk/e_dbus/src/lib/dbus/e_dbus.c  2012-07-04 22:06:10 UTC (rev 73315)
> @@ -25,7 +25,6 @@
>
>  static int _edbus_init_count = 0;
>  static int close_connection = 0;
> -EAPI int E_DBUS_EVENT_SIGNAL = 0;
>
>  static E_DBus_Connection *shared_connections[2] = {NULL, NULL};
>
> @@ -204,39 +203,12 @@
>
>    if (cd->conn_name) free(cd->conn_name);
>
> -  if (cd->idler) ecore_idle_enterer_del(cd->idler);
> +  if (cd->idler) ecore_idler_del(cd->idler);
>
>    free(cd);
>  }
>
> -
>  static void
> -cb_main_wakeup(void *data)
> -{
> -  E_DBus_Connection *cd;
> -  DBG("wakeup main!");
> -
> -  cd = data;
> -
> -  if (!cd->idler) cd->idler = ecore_idle_enterer_add(e_dbus_idler, cd);
> -  else DBG("already idling");
> -}
> -
> -static void
> -e_dbus_loop_wakeup(void)
> -{
> -  static int dummy_event = 0;
> -
> -  /* post a dummy event to get the mainloop back to normal - this is
> -   * needed because idlers are very special things that won't re-evaluate
> -   * timers and other stuff while idelrs run - idle_exiters and enterers
> -   * can do this safely, but not idlers. idelrs were meant to be used
> -   * very sparingly for very special cases */
> -  if (dummy_event == 0) dummy_event = ecore_event_type_new();
> -  ecore_event_add(dummy_event, NULL, NULL, NULL);
> -}
> -
> -static void
>  cb_dispatch_status(DBusConnection *conn __UNUSED__, DBusDispatchStatus 
> new_status, void *data)
>  {
>    E_DBus_Connection *cd;
> @@ -244,14 +216,13 @@
>    DBG("dispatch status: %d!", new_status);
>    cd = data;
>
> -  if (new_status == DBUS_DISPATCH_DATA_REMAINS && !cd->idler) cd->idler = 
> ecore_idle_enterer_add(e_dbus_idler, cd);
> -
> -  else if (new_status != DBUS_DISPATCH_DATA_REMAINS && cd->idler)
> -  {
> -    ecore_idle_enterer_del(cd->idler);
> -    cd->idler = NULL;
> -    e_dbus_loop_wakeup();
> -  }
> +  if (new_status == DBUS_DISPATCH_DATA_REMAINS && !cd->idler)
> +    cd->idler = ecore_idler_add(e_dbus_idler, cd);
> +  else if (new_status != DBUS_DISPATCH_DATA_REMAINS && cd->idler)
> +    {
> +       ecore_idler_del(cd->idler);
> +       cd->idler = NULL;
> +    }
>  }
>
>  static Eina_Bool
> @@ -382,12 +353,6 @@
>    else e_dbus_fd_handler_del(hd);
>  }
>
> -static void
> -e_dbus_message_free(void *data __UNUSED__, void *message)
> -{
> -  dbus_message_unref(message);
> -}
> -
>  static DBusHandlerResult
>  e_dbus_filter(DBusConnection *conn __UNUSED__, DBusMessage *message, void 
> *user_data)
>  {
> @@ -413,14 +378,8 @@
>        DBG("error: %s", dbus_message_get_error_name(message));
>        break;
>      case DBUS_MESSAGE_TYPE_SIGNAL:
> -      dbus_message_ref(message);
> -
>        if (cd->signal_dispatcher)
> -       cd->signal_dispatcher(cd, message);
> -
> -      ecore_event_add(E_DBUS_EVENT_SIGNAL, message, e_dbus_message_free, 
> NULL);
> -      /* don't need to handle signals, they're for everyone who wants them */
> -      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
> +        cd->signal_dispatcher(cd, message);
>        break;
>      default:
>        break;
> @@ -446,7 +405,7 @@
>    }
>    e_dbus_idler_active++;
>    dbus_connection_ref(cd->conn);
> -  DBG("dispatch!");
> +  DBG("dispatch()");
>    dbus_connection_dispatch(cd->conn);
>    dbus_connection_unref(cd->conn);
>    e_dbus_idler_active--;
> @@ -458,7 +417,6 @@
>        e_dbus_connection_close(cd);
>      } while (--close_connection);
>    }
> -  e_dbus_loop_wakeup();
>    return ECORE_CALLBACK_RENEW;
>  }
>
> @@ -535,7 +493,6 @@
>                                        cd,
>                                        NULL);
>
> -  dbus_connection_set_wakeup_main_function(cd->conn, cb_main_wakeup, cd, 
> NULL);
>    dbus_connection_set_dispatch_status_function(cd->conn, cb_dispatch_status, 
> cd, NULL);
>    dbus_connection_add_filter(cd->conn, e_dbus_filter, cd, NULL);
>
> @@ -576,7 +533,7 @@
>    /* Idler functin must be cancelled when dbus connection is  unreferenced */
>    if (conn->idler)
>      {
> -      ecore_idle_enterer_del(conn->idler);
> +      ecore_idler_del(conn->idler);
>        conn->idler = NULL;
>      }
>
> @@ -627,7 +584,6 @@
>      }
>
>
> -  E_DBUS_EVENT_SIGNAL = ecore_event_type_new();
>    e_dbus_object_init();
>
>    return _edbus_init_count;
>
> Modified: trunk/e_dbus/src/lib/dbus/e_dbus_private.h
> ===================================================================
> --- trunk/e_dbus/src/lib/dbus/e_dbus_private.h  2012-07-04 22:06:07 UTC (rev 
> 73314)
> +++ trunk/e_dbus/src/lib/dbus/e_dbus_private.h  2012-07-04 22:06:10 UTC (rev 
> 73315)
> @@ -26,7 +26,7 @@
>    Eina_List *signal_handlers;
>    void (*signal_dispatcher)(E_DBus_Connection *conn, DBusMessage *msg);
>
> -  Ecore_Idle_Enterer *idler;
> +  Ecore_Idler *idler;
>
>    int refcount;
>  };
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to