StTextureCache: do not monitor files inside GResource

This is wasteful, since GResource does not support file monitoring.
Further, doing so will trigger a fallback code path in GLib that polls
every second in a thread, which is doubly wasteful.

https://bugzilla.gnome.org/show_bug.cgi?id=744013
This commit is contained in:
Cosimo Cecchi 2015-02-04 12:23:30 -08:00 committed by Cosimo Cecchi
parent c647be375a
commit 12b00501cc

View File

@ -983,6 +983,12 @@ ensure_monitor_for_file (StTextureCache *cache,
{ {
StTextureCachePrivate *priv = cache->priv; StTextureCachePrivate *priv = cache->priv;
/* No point in trying to monitor files that are part of a
* GResource, since it does not support file monitoring.
*/
if (g_file_has_uri_scheme (file, "resource"))
return;
if (g_hash_table_lookup (priv->file_monitors, file) == NULL) if (g_hash_table_lookup (priv->file_monitors, file) == NULL)
{ {
GFileMonitor *monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, GFileMonitor *monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE,