[anjuta] symbol-db: force tablemaps mode for all global scans.
- From: Massimo Cora' <mcora src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: force tablemaps mode for all global scans.
- Date: Thu, 3 Jun 2010 21:41:57 +0000 (UTC)
commit 262daf4e6ca4c4a452ebbebd416b28d93ead18ca
Author: Massimo Corà <mcora src gnome org>
Date: Thu Jun 3 21:43:07 2010 +0200
symbol-db: force tablemaps mode for all global scans.
plugins/symbol-db/benchmark/benchmark.c | 2 +-
plugins/symbol-db/plugin.c | 8 +++++---
plugins/symbol-db/symbol-db-engine-core.c | 18 +++++++++++++++++-
plugins/symbol-db/symbol-db-engine-core.h | 5 ++++-
plugins/symbol-db/symbol-db-engine-priv.h | 5 +++--
5 files changed, 30 insertions(+), 8 deletions(-)
---
diff --git a/plugins/symbol-db/benchmark/benchmark.c b/plugins/symbol-db/benchmark/benchmark.c
index a972104..aa9925f 100644
--- a/plugins/symbol-db/benchmark/benchmark.c
+++ b/plugins/symbol-db/benchmark/benchmark.c
@@ -51,7 +51,7 @@ int main (int argc, char** argv)
engine = symbol_db_engine_new_full ("anjuta-tags", "benchmark-db");
- if (symbol_db_engine_open_db (engine, root_dir, root_dir) == DB_OPEN_STATUS_FATAL)
+ if (symbol_db_engine_open_db (engine, root_dir, root_dir, FALSE) == DB_OPEN_STATUS_FATAL)
{
g_message ("Could not open database: %s", root_dir);
return -1;
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index 685b7cf..62c3e87 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -1645,7 +1645,8 @@ on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
anjuta_cache_path = anjuta_util_get_user_cache_file_path (".", NULL);
if (symbol_db_engine_open_db (sdb_plugin->sdbe_globals,
anjuta_cache_path,
- PROJECT_GLOBALS) == DB_OPEN_STATUS_FATAL)
+ PROJECT_GLOBALS,
+ FALSE) == DB_OPEN_STATUS_FATAL)
{
g_error ("Opening global project under %s", anjuta_cache_path);
}
@@ -1705,7 +1706,7 @@ on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
/* we'll use the same values for db_directory and project_directory */
DEBUG_PRINT ("Opening db %s and project_dir %s", root_dir, root_dir);
gint open_status = symbol_db_engine_open_db (sdb_plugin->sdbe_project, root_dir,
- root_dir);
+ root_dir, FALSE);
/* is it a fresh-new project? is it an imported project with
* no 'new' symbol-db database but the 'old' one symbol-browser?
@@ -2046,7 +2047,8 @@ symbol_db_activate (AnjutaPlugin *plugin)
anjuta_cache_path = anjuta_util_get_user_cache_file_path (".", NULL);
if (symbol_db_engine_open_db (sdb_plugin->sdbe_globals,
anjuta_cache_path,
- PROJECT_GLOBALS) == DB_OPEN_STATUS_FATAL)
+ PROJECT_GLOBALS,
+ TRUE) == DB_OPEN_STATUS_FATAL)
{
g_error ("Opening global project under %s", anjuta_cache_path);
}
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index 95f841d..9109d33 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -1839,6 +1839,12 @@ sdb_engine_timeout_trigger_signals (gpointer user_data)
/* ok, set the flag to false. We're done with it */
priv->is_first_population = FALSE;
}
+
+ /* were we forced to use tablemaps? Ok, reset the flag to true */
+ if (priv->is_tablemaps_forced == TRUE)
+ {
+ priv->is_first_population = TRUE;
+ }
/* get the process id from the queue */
gint int_tmp = GPOINTER_TO_INT(g_async_queue_pop (priv->scan_process_id_queue));
@@ -2284,6 +2290,7 @@ sdb_engine_init (SymbolDBEngine * object)
sdbe->priv->removed_launchers = NULL;
sdbe->priv->shutting_down = FALSE;
sdbe->priv->is_first_population = FALSE;
+ sdbe->priv->is_tablemaps_forced = FALSE;
/* set the ctags executable path to NULL */
sdbe->priv->ctags_path = NULL;
@@ -3256,6 +3263,8 @@ symbol_db_engine_close_db (SymbolDBEngine *dbe)
priv->thread_pool = NULL;
ret = sdb_engine_disconnect_from_db (dbe);
+ priv->is_tablemaps_forced = FALSE;
+
g_free (priv->db_directory);
priv->db_directory = NULL;
@@ -3364,7 +3373,7 @@ sdb_engine_check_db_version_and_upgrade (SymbolDBEngine *dbe,
gint
symbol_db_engine_open_db (SymbolDBEngine * dbe, const gchar * base_db_path,
- const gchar * prj_directory)
+ const gchar * prj_directory, gboolean force_tablemaps)
{
SymbolDBEnginePriv *priv;
gboolean needs_tables_creation = FALSE;
@@ -3380,6 +3389,13 @@ symbol_db_engine_open_db (SymbolDBEngine * dbe, const gchar * base_db_path,
priv = dbe->priv;
+ priv->is_tablemaps_forced = force_tablemaps;
+ if (priv->is_tablemaps_forced == TRUE)
+ {
+ priv->is_first_population = TRUE;
+ }
+
+
/* check whether the db filename already exists. If it's not the case
* create the tables for the database. */
gchar *db_file = g_strdup_printf ("%s/%s.db", base_db_path,
diff --git a/plugins/symbol-db/symbol-db-engine-core.h b/plugins/symbol-db/symbol-db-engine-core.h
index 978e2a5..8aec5f9 100644
--- a/plugins/symbol-db/symbol-db-engine-core.h
+++ b/plugins/symbol-db/symbol-db-engine-core.h
@@ -106,6 +106,9 @@ symbol_db_engine_set_ctags_path (SymbolDBEngine *dbe,
* directory of /home/user/project/foo_prj/. On db it'll be represented as
* src/file.c. In this way you can move around the project dir without dealing
* with relative paths.
+ * @param force_tablemaps Defaults to FALSE. Set this to TRUE if you want all
+ * scans to use the tablemaps method. This could be useful for global db
+ * but not for project one.
*/
#define DB_OPEN_STATUS_FATAL -1
#define DB_OPEN_STATUS_NORMAL 0
@@ -113,7 +116,7 @@ symbol_db_engine_set_ctags_path (SymbolDBEngine *dbe,
#define DB_OPEN_STATUS_UPGRADE 2
gint
symbol_db_engine_open_db (SymbolDBEngine *dbe, const gchar* base_db_path,
- const gchar * prj_directory);
+ const gchar * prj_directory, gboolean force_tablemaps);
/** Disconnect db, gda client and db_connection */
gboolean
diff --git a/plugins/symbol-db/symbol-db-engine-priv.h b/plugins/symbol-db/symbol-db-engine-priv.h
index 2f06b3c..4346667 100644
--- a/plugins/symbol-db/symbol-db-engine-priv.h
+++ b/plugins/symbol-db/symbol-db-engine-priv.h
@@ -49,8 +49,8 @@
#define THREADS_MAX_CONCURRENT 2
#define TRIGGER_SIGNALS_DELAY 100
-#define MEMORY_POOL_STRING_SIZE 200
-#define MEMORY_POOL_INT_SIZE 200
+#define MEMORY_POOL_STRING_SIZE 400
+#define MEMORY_POOL_INT_SIZE 400
#define DUMMY_VOID_STRING ""
#define MP_VOID_STRING "-"
@@ -293,6 +293,7 @@ struct _SymbolDBEnginePriv
GList *removed_launchers;
gboolean shutting_down;
gboolean is_first_population;
+ gboolean is_tablemaps_forced;
GMutex* mutex;
GAsyncQueue* signals_queue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]