[pygobject/invoke-rewrite] [gi] conditionalize invoke code paths



commit 35619fec43f4df85edf5456f3fc9733b16f2ba90
Author: John (J5) Palmieri <johnp redhat com>
Date:   Tue Mar 22 15:40:02 2011 -0400

    [gi] conditionalize invoke code paths

 configure.ac      |    7 +++++++
 gi/Makefile.am    |   20 +++++++++++++++-----
 gi/pygi-cache.h   |    2 ++
 gi/pygi-info.c    |    4 +++-
 gi/pygi-private.h |    9 +++++++--
 gi/pygi.h         |    4 +++-
 6 files changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0cc920b..8eedd15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,12 @@ AC_ARG_ENABLE(thread,
   AC_HELP_STRING([--disable-thread], [Disable pygobject threading support]),,
   enable_thread=yes)
 
+dnl Build with the new caching invoker
+AC_ARG_ENABLE(invoke-ng,
+  AC_HELP_STRING([--enable-invoke-ng], [Enable the new caching invoke path]),,
+  enable_invoke_ng=no)
+AM_CONDITIONAL(ENABLE_INVOKE_NG, test x$enable_invoke_ng != xno)
+
 dnl Building documentation
 AC_ARG_ENABLE(docs,
   AC_HELP_STRING([--enable-docs], [Enable documentation building]),enable_docs=$enableval,
@@ -277,4 +283,5 @@ AC_OUTPUT
 echo
 echo "libffi support: $have_libffi"
 echo "introspection support: $enable_introspection"
+echo "invoke-ng support: $enable_invoke_ng"
 echo
diff --git a/gi/Makefile.am b/gi/Makefile.am
index dad5203..82ca98a 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -31,9 +31,6 @@ _gi_la_SOURCES = \
 	pygi-repository.h \
 	pygi-info.c \
 	pygi-info.h \
-	pygi-invoke.c \
-	pygi-invoke.h \
-       pygi-invoke-state-struct.h \
 	pygi-foreign.c \
 	pygi-foreign.h \
 	pygi-foreign-gvariant.c \
@@ -54,13 +51,26 @@ _gi_la_SOURCES = \
 	pygi-private.h \
 	pygi-property.c \
 	pygi-property.h \
-	pygi-cache.h \
-	pygi-cache.c \
 	pygi-signal-closure.c \
 	pygi-signal-closure.h \
 	pygobject-external.h \
 	gimodule.c
 
+if ENABLE_INVOKE_NG
+_gi_la_SOURCES += \
+	pygi-invoke-ng.c \
+	pygi-invoke-ng.h \
+	pygi-invoke-state-struct.h \
+	pygi-cache.h \
+	pygi-cache.c \
+	pygi-marshal.c \
+	pygi-marshal.h
+else
+_gi_la_SOURCES += \
+	pygi-invoke.c \
+	pygi-invoke.h
+endif
+
 _gi_cairo_la_CFLAGS = \
 	$(PYTHON_INCLUDES) \
 	$(GI_CFLAGS) \
diff --git a/gi/pygi-cache.h b/gi/pygi-cache.h
index 7bc3f9d..87f5ec8 100644
--- a/gi/pygi-cache.h
+++ b/gi/pygi-cache.h
@@ -19,6 +19,7 @@
  * USA
  */
 
+#ifdef ENABLE_INVOKE_NG
 #ifndef __PYGI_CACHE_H__
 #define __PYGI_CACHE_H__
 
@@ -140,3 +141,4 @@ PyGIFunctionCache *_pygi_function_cache_new (GIFunctionInfo *function_info);
 G_END_DECLS
 
 #endif /* __PYGI_CACHE_H__ */
+#endif /* def ENABLE_INVOKE_NG */
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 9b33d01..d89d1b5 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -37,8 +37,10 @@ _base_info_dealloc (PyGIBaseInfo *self)
     PyObject_ClearWeakRefs ( (PyObject *) self);
 
     g_base_info_unref (self->info);
-    
+
+#ifdef ENABLE_INVOKE_NG
     _pygi_function_cache_free(self->cache);
+#endif
 
     Py_TYPE( (PyObject *) self)->tp_free ( (PyObject *) self);
 }
diff --git a/gi/pygi-private.h b/gi/pygi-private.h
index 1ef5645..5b7b505 100644
--- a/gi/pygi-private.h
+++ b/gi/pygi-private.h
@@ -27,11 +27,16 @@
 #include "pygi-foreign.h"
 #include "pygi-closure.h"
 #include "pygi-callbacks.h"
-#include "pygi-invoke.h"
 #include "pygi-property.h"
-#include "pygi-cache.h"
 #include "pygi-signal-closure.h"
 
+#ifdef ENABLE_INVOKE_NG
+  #include "pygi-invoke-ng.h"
+  #include "pygi-cache.h"
+#else
+  #include "pygi-invoke.h"
+#endif
+
 G_BEGIN_DECLS
 #if PY_VERSION_HEX >= 0x03000000
 
diff --git a/gi/pygi.h b/gi/pygi.h
index 201af06..c9c7d86 100644
--- a/gi/pygi.h
+++ b/gi/pygi.h
@@ -42,8 +42,10 @@ typedef struct {
 typedef struct {
     PyObject_HEAD
     GIBaseInfo *info;
-    PyGIFunctionCache *cache;
     PyObject *inst_weakreflist;
+#ifdef ENABLE_INVOKE_NG
+    PyGIFunctionCache *cache;
+#endif
 } PyGIBaseInfo;
 
 typedef struct {



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