diff options
-rw-r--r-- | pango/pangofc-fontmap.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 9364c082..aa90345e 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -54,6 +54,7 @@ #include "pango-impl-utils.h" #include "pango-enum-types.h" #include "pango-coverage-private.h" +#include "pango-trace-private.h" #include <hb-ft.h> @@ -830,12 +831,15 @@ match_in_thread (GTask *task, ThreadData *td = task_data; FcResult result; FcPattern *match; + gint64 before = PANGO_TRACE_CURRENT_TIME; match = FcFontSetMatch (td->config, &td->fonts, 1, td->pattern, &result); + pango_trace_mark (before, "FcFontSetMatch", NULL); + g_mutex_lock (&td->patterns->mutex); td->patterns->match = match; g_cond_signal (&td->patterns->cond); @@ -851,6 +855,7 @@ sort_in_thread (GTask *task, ThreadData *td = task_data; FcResult result; FcFontSet *fontset; + gint64 before = PANGO_TRACE_CURRENT_TIME; fontset = FcFontSetSort (td->config, &td->fonts, 1, @@ -859,6 +864,8 @@ sort_in_thread (GTask *task, NULL, &result); + pango_trace_mark (before, "FcFontSetSort", NULL); + g_mutex_lock (&td->patterns->mutex); td->patterns->fontset = fontset; g_cond_signal (&td->patterns->cond); @@ -1011,16 +1018,25 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep if (i == 0) { + gint64 before = PANGO_TRACE_CURRENT_TIME; + gboolean waited = FALSE; + g_mutex_lock (&pats->mutex); while (!pats->match && !pats->fontset) - g_cond_wait (&pats->cond, &pats->mutex); + { + waited = TRUE; + g_cond_wait (&pats->cond, &pats->mutex); + } match = pats->match; fontset = pats->fontset; g_mutex_unlock (&pats->mutex); + if (waited) + pango_trace_mark (before, "wait for FcFontMatch", NULL); + if (match) { *prepare = FALSE; @@ -1029,14 +1045,23 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep } else { + gint64 before = PANGO_TRACE_CURRENT_TIME; + gboolean waited = FALSE; + g_mutex_lock (&pats->mutex); while (!pats->fontset) - g_cond_wait (&pats->cond, &pats->mutex); + { + waited = TRUE; + g_cond_wait (&pats->cond, &pats->mutex); + } fontset = pats->fontset; g_mutex_unlock (&pats->mutex); + + if (waited) + pango_trace_mark (before, "wait for FcFontSort", NULL); } if (fontset) @@ -1327,8 +1352,12 @@ init_in_thread (GTask *task, gpointer task_data, GCancellable *cancellable) { + gint64 before = PANGO_TRACE_CURRENT_TIME; + FcInit (); + pango_trace_mark (before, "FcInit", NULL); + g_mutex_lock (&fc_init_mutex); fc_initialized = TRUE; g_cond_signal (&fc_init_cond); @@ -1338,10 +1367,19 @@ init_in_thread (GTask *task, static void wait_for_fc_init (void) { + gint64 before = PANGO_TRACE_CURRENT_TIME; + gboolean waited = FALSE; + g_mutex_lock (&fc_init_mutex); while (!fc_initialized) - g_cond_wait (&fc_init_cond, &fc_init_mutex); + { + waited = TRUE; + g_cond_wait (&fc_init_cond, &fc_init_mutex); + } g_mutex_unlock (&fc_init_mutex); + + if (waited) + pango_trace_mark (before, "wait for FcInit", NULL); } static void |