summaryrefslogtreecommitdiff
path: root/src/lib/evas/vg/evas_vg_cache.c
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2020-06-09 10:57:20 +0900
committerHermet Park <chuneon.park@samsung.com>2020-06-09 10:57:21 +0900
commit53991e0ef6efdbf7df2919bad75618cfbea85105 (patch)
tree8ffa30012e852c25f8baff7864086bcae0c54e67 /src/lib/evas/vg/evas_vg_cache.c
parent18218f50729fac5d27c004a504ef96d146d6f9e7 (diff)
evas_vg_cache: Don't caching vg file if value_provider is applied.
Summary: value_provider can change the value of the property received from VG file. When a file is cached, the changed properties are applied to all other objects using the same file. So. If value provider is applied, evas_vg_cache is not caching vg file. Test Plan: N/A Reviewers: Hermet, herb, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11924
Diffstat (limited to '')
-rw-r--r--src/lib/evas/vg/evas_vg_cache.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c
index 86c23dfb31..3b3bfaeb96 100644
--- a/src/lib/evas/vg/evas_vg_cache.c
+++ b/src/lib/evas/vg/evas_vg_cache.c
@@ -153,14 +153,21 @@ _evas_cache_vg_entry_free_cb(void *data)
153 153
154 if (vg_entry->vfd->ref <= 0) 154 if (vg_entry->vfd->ref <= 0)
155 { 155 {
156 Eina_Strbuf *hash_key = eina_strbuf_new(); 156 if (vg_entry->vfd->shareable)
157 eina_strbuf_append_printf(hash_key, "%s/%s/%p", 157 {
158 eina_file_filename_get(vg_entry->file), 158 Eina_Strbuf *hash_key = eina_strbuf_new();
159 vg_entry->key, 159 eina_strbuf_append_printf(hash_key, "%s/%s/%p",
160 vg_entry->evas); 160 eina_file_filename_get(vg_entry->file),
161 if (!eina_hash_del(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vg_entry->vfd)) 161 vg_entry->key,
162 ERR("Failed to delete vfd = (%p) from hash", vg_entry->vfd); 162 vg_entry->evas);
163 eina_strbuf_free(hash_key); 163 if (!eina_hash_del(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vg_entry->vfd))
164 ERR("Failed to delete vfd = (%p) from hash", vg_entry->vfd);
165 eina_strbuf_free(hash_key);
166 }
167 else
168 {
169 vg_entry->vfd->loader->file_close(vg_entry->vfd);
170 }
164 } 171 }
165 } 172 }
166 173
@@ -322,21 +329,29 @@ evas_cache_vg_shutdown(void)
322} 329}
323 330
324Vg_File_Data * 331Vg_File_Data *
325evas_cache_vg_file_open(const Eina_File *file, const char *key, Evas *e) 332evas_cache_vg_file_open(const Eina_File *file, const char *key, Evas *e, Eina_Bool shareable)
326{ 333{
327 Vg_File_Data *vfd; 334 Vg_File_Data *vfd;
328 Eina_Strbuf *hash_key; 335 Eina_Strbuf *hash_key;
329 336
330 hash_key = eina_strbuf_new(); 337 if (shareable)
331 eina_strbuf_append_printf(hash_key, "%s/%s/%p", eina_file_filename_get(file), key, e); 338 {
332 vfd = eina_hash_find(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key)); 339 hash_key = eina_strbuf_new();
333 if (!vfd) 340 eina_strbuf_append_printf(hash_key, "%s/%s/%p", eina_file_filename_get(file), key, e);
341 vfd = eina_hash_find(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key));
342 if (!vfd)
343 {
344 vfd = _vg_load_from_file(file, key);
345 //File exists.
346 if (vfd) eina_hash_add(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vfd);
347 }
348 eina_strbuf_free(hash_key);
349 }
350 else
334 { 351 {
335 vfd = _vg_load_from_file(file, key); 352 vfd = _vg_load_from_file(file, key);
336 //File exists.
337 if (vfd) eina_hash_add(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vfd);
338 } 353 }
339 eina_strbuf_free(hash_key); 354 if (vfd) vfd->shareable = shareable;
340 return vfd; 355 return vfd;
341} 356}
342 357
@@ -380,7 +395,7 @@ evas_cache_vg_entry_create(Evas *evas,
380 } 395 }
381 eina_strbuf_free(hash_key); 396 eina_strbuf_free(hash_key);
382 vg_entry->ref++; 397 vg_entry->ref++;
383 vg_entry->vfd = evas_cache_vg_file_open(file, key, vg_entry->evas); 398 vg_entry->vfd = evas_cache_vg_file_open(file, key, vg_entry->evas, vp_list ? EINA_FALSE : EINA_TRUE);
384 //No File?? 399 //No File??
385 if (!vg_entry->vfd) 400 if (!vg_entry->vfd)
386 { 401 {
@@ -536,7 +551,8 @@ Eina_Bool
536evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const Efl_File_Save_Info *info) 551evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const Efl_File_Save_Info *info)
537{ 552{
538 Vg_File_Data *vfd = 553 Vg_File_Data *vfd =
539 evas_cache_vg_file_open(vg_entry->file, vg_entry->key, vg_entry->evas); 554 evas_cache_vg_file_open(vg_entry->file, vg_entry->key, vg_entry->evas
555 ,vg_entry->vfd ? (vg_entry->vfd->vp_list ? EINA_FALSE : EINA_TRUE): EINA_TRUE);
540 556
541 if (!vfd) return EINA_FALSE; 557 if (!vfd) return EINA_FALSE;
542 558