summaryrefslogtreecommitdiff
path: root/src/lib/emotion
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-13 15:29:09 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-13 16:51:49 +0900
commit76244d89a75c0a465c3b4eb63d642b6ad14a3d74 (patch)
tree3c6a1055619f36f5e6aed8c410c3087bf421b790 /src/lib/emotion
parent95d83e80406ddf48305cdbc91eecd340ecc4c6e1 (diff)
vpath file - add a keey property to know if obj should be kept around
if its a file downloading (to a tmp location) or a zip/tar/whatever file being extracted also to a tmp location and that tmp file needs to be removed after ...you need to keep the obj around to know when to delete the file. this makes the keeping optional and you query if the vpath obj is meant to be kept or not. if it's not it's safe to del immediately. this cuts down 1 obj per image obj/edje obj when generally unused. save some mem.
Diffstat (limited to 'src/lib/emotion')
-rw-r--r--src/lib/emotion/emotion_smart.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index 93cf1975ff..96f14da295 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -68,6 +68,8 @@ struct _Efl_Canvas_Video_Data
68 68
69 Ecore_Job *job; 69 Ecore_Job *job;
70 70
71 Efl_Vpath_File *file_obj;
72
71 const char *title; 73 const char *title;
72 74
73#ifdef HAVE_EIO 75#ifdef HAVE_EIO
@@ -169,6 +171,11 @@ _smart_data_free(Efl_Canvas_Video_Data *sd)
169 sd->save_xattr = NULL; 171 sd->save_xattr = NULL;
170#endif 172#endif
171 173
174 if (sd->file_obj)
175 {
176 efl_del(sd->file_obj);
177 sd->file_obj = NULL;
178 }
172 if (sd->engine_instance) 179 if (sd->engine_instance)
173 { 180 {
174 emotion_engine_instance_file_close(sd->engine_instance); 181 emotion_engine_instance_file_close(sd->engine_instance);
@@ -374,7 +381,7 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *
374 sd->video.h = 0; 381 sd->video.h = 0;
375 if ((file) && (file[0] != 0)) 382 if ((file) && (file[0] != 0))
376 { 383 {
377 const char *file2; 384 const char *file2 = NULL;
378 385
379 eina_stringshare_replace(&sd->file, file); 386 eina_stringshare_replace(&sd->file, file);
380 emotion_engine_instance_file_close(sd->engine_instance); 387 emotion_engine_instance_file_close(sd->engine_instance);
@@ -383,19 +390,35 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *
383 _emotion_image_data_zero(sd->obj); 390 _emotion_image_data_zero(sd->obj);
384 sd->open = 0; 391 sd->open = 0;
385 392
386 Efl_Vpath_File *file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file); 393 if (sd->file_obj)
387 efl_vpath_file_do(file_obj); 394 {
388 // XXX:FIXME: allow this to be async 395 efl_del(sd->file_obj);
389 efl_vpath_file_wait(file_obj); 396 sd->file_obj = NULL;
390 file2 = efl_vpath_file_result_get(file_obj); 397 }
398 if (file)
399 {
400 sd->file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
401 efl_vpath_file_do(sd->file_obj);
402 // XXX:FIXME: allow this to be async
403 efl_vpath_file_wait(sd->file_obj);
404 file2 = efl_vpath_file_result_get(sd->file_obj);
405 }
391 406
392 if (!emotion_engine_instance_file_open(sd->engine_instance, file2)) 407 if (!emotion_engine_instance_file_open(sd->engine_instance, file2))
393 { 408 {
394 WRN("Couldn't open file=%s", sd->file); 409 WRN("Couldn't open file=%s", sd->file);
395 efl_del(file_obj); 410 if (sd->file_obj)
411 {
412 efl_del(sd->file_obj);
413 sd->file_obj = NULL;
414 }
396 return EINA_FALSE; 415 return EINA_FALSE;
397 } 416 }
398 efl_del(file_obj); 417 if ((sd->file_obj) && (!efl_vpath_file_keep_get(sd->file_obj)))
418 {
419 efl_del(sd->file_obj);
420 sd->file_obj = NULL;
421 }
399 DBG("successfully opened file=%s", sd->file); 422 DBG("successfully opened file=%s", sd->file);
400 sd->pos = 0.0; 423 sd->pos = 0.0;
401 if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0); 424 if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0);