summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-10-15 18:10:42 -0500
committerBehdad Esfahbod <behdad@behdad.org>2012-11-07 10:59:03 -0800
commitdfc1726f91d14d4af94a8959f63a492c94ee7b32 (patch)
treed1fca164de0683be0f8aef77af82fcb2f153d58e
parentbdec39afb41471e7ebc86122239741a819e4a8b3 (diff)
downloadpango-dfc1726f91d14d4af94a8959f63a492c94ee7b32.tar.gz
Use threadsafe hashtable in PangoContext font cache
-rw-r--r--pango/pango-context.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 341f92a6..8ae01413 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -30,6 +30,7 @@
#include "pango-engine-private.h"
#include "pango-modules.h"
#include "pango-script-private.h"
+#include "pango-threadsafe.h"
struct _PangoContext
{
@@ -560,7 +561,7 @@ advance_attr_iterator_to (PangoAttrIterator *iterator,
***************************************************************************/
typedef struct {
- GHashTable *hash;
+ PHashTable *hash;
} ShaperFontCache;
typedef struct {
@@ -571,7 +572,7 @@ typedef struct {
static void
shaper_font_cache_destroy (ShaperFontCache *cache)
{
- g_hash_table_destroy (cache->hash);
+ p_hash_table_destroy (cache->hash);
g_slice_free (ShaperFontCache, cache);
}
@@ -599,7 +600,7 @@ retry:
if (G_UNLIKELY (!cache))
{
cache = g_slice_new (ShaperFontCache);
- cache->hash = g_hash_table_new_full (g_direct_hash, NULL,
+ cache->hash = p_hash_table_new_full (g_direct_hash, NULL,
NULL, (GDestroyNotify)shaper_font_element_destroy);
if (!g_object_replace_qdata (G_OBJECT (fontset), cache_quark, NULL,
cache, (GDestroyNotify)shaper_font_cache_destroy,
@@ -621,7 +622,7 @@ shaper_font_cache_get (ShaperFontCache *cache,
{
ShaperFontElement *element;
- element = g_hash_table_lookup (cache->hash, GUINT_TO_POINTER (wc));
+ element = p_hash_table_lookup (cache->hash, GUINT_TO_POINTER (wc));
if (element)
{
*shape_engine = element->shape_engine;
@@ -643,7 +644,7 @@ shaper_font_cache_insert (ShaperFontCache *cache,
element->shape_engine = shape_engine ? g_object_ref (shape_engine) : NULL;
element->font = font ? g_object_ref (font) : NULL;
- g_hash_table_insert (cache->hash, GUINT_TO_POINTER (wc), element);
+ p_hash_table_insert (cache->hash, GUINT_TO_POINTER (wc), element);
}
/**********************************************************************/