st-texture-cache: Use GSlice to manage memory of leaders data
This allows some memory optimizations when possible, so let's use it. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
This commit is contained in:
parent
19c60ff5c5
commit
2bda79cb3a
@ -315,7 +315,7 @@ texture_load_data_free (gpointer p)
|
||||
if (data->actors)
|
||||
g_slist_free_full (data->actors, (GDestroyNotify) g_object_unref);
|
||||
|
||||
g_free (data);
|
||||
g_slice_free (AsyncTextureLoadData, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -751,7 +751,7 @@ st_texture_cache_free_bind (gpointer data)
|
||||
StTextureCachePropertyBind *bind = data;
|
||||
if (bind->weakref_active)
|
||||
g_object_weak_unref (G_OBJECT (bind->actor), st_texture_cache_bind_weak_notify, bind);
|
||||
g_free (bind);
|
||||
g_slice_free (StTextureCachePropertyBind, bind);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -782,7 +782,7 @@ st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
||||
actor = create_invisible_actor ();
|
||||
clutter_actor_set_size (actor, size, size);
|
||||
|
||||
bind = g_new0 (StTextureCachePropertyBind, 1);
|
||||
bind = g_slice_new0 (StTextureCachePropertyBind);
|
||||
bind->cache = cache;
|
||||
bind->actor = actor;
|
||||
bind->size = size;
|
||||
@ -880,7 +880,7 @@ ensure_request (StTextureCache *cache,
|
||||
if (pending == NULL)
|
||||
{
|
||||
/* Not cached and no pending request, create it */
|
||||
*request = g_new0 (AsyncTextureLoadData, 1);
|
||||
*request = g_slice_new0 (AsyncTextureLoadData);
|
||||
if (policy != ST_TEXTURE_CACHE_POLICY_NONE)
|
||||
g_hash_table_insert (cache->priv->outstanding_requests, g_strdup (key), *request);
|
||||
}
|
||||
@ -1096,7 +1096,7 @@ on_data_destroy (gpointer data)
|
||||
g_object_unref (d->gfile);
|
||||
g_object_unref (d->actor);
|
||||
g_object_unref (d->cancellable);
|
||||
g_free (d);
|
||||
g_slice_free (AsyncImageData, d);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1261,7 +1261,7 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
|
||||
g_assert (paint_scale > 0);
|
||||
g_assert (resource_scale > 0);
|
||||
|
||||
data = g_new0 (AsyncImageData, 1);
|
||||
data = g_slice_new0 (AsyncImageData);
|
||||
data->grid_width = grid_width;
|
||||
data->grid_height = grid_height;
|
||||
data->paint_scale = paint_scale;
|
||||
|
Loading…
Reference in New Issue
Block a user