summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2018-01-19 15:35:08 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-04-30 14:21:12 -0700
commit202f433476c80c3c2a013038fb39ffc1a775b34f (patch)
tree33b22cb8e0c3034d47e29d8497c3b5175fee7fc4 /src/lib/eio
parent9882a2873606eabfbb593b285a65db07b07caafd (diff)
eio: remove unecessary helper function Efl.Io.Manager.
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/efl_io_manager.c123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c
index fea74c7069..cee58c873e 100644
--- a/src/lib/eio/efl_io_manager.c
+++ b/src/lib/eio/efl_io_manager.c
@@ -69,90 +69,8 @@ _future_file_error_cb(void *data,
69 eina_promise_reject(p, error); 69 eina_promise_reject(p, error);
70} 70}
71 71
72static void
73_no_future(void *data, const Efl_Event *ev EINA_UNUSED)
74{
75 Eio_File *h = data;
76
77 eio_file_cancel(h);
78}
79
80static void
81_forced_shutdown(void *data, const Efl_Event *ev EINA_UNUSED)
82{
83 Eio_File *h = data;
84
85 eio_file_cancel(h);
86 // FIXME: handle memory lock here !
87 // Acceptable strategy will be to unlock all thread as
88 // if we were freeing some memory
89 // FIXME: Handle long to finish thread
90 ecore_thread_wait(h->thread, 1.0);
91}
92
93static void
94_progress(void *data EINA_UNUSED, const Efl_Event *ev)
95{
96 efl_key_data_set(ev->object, "_eio.progress", (void*) EINA_TRUE);
97}
98
99EFL_CALLBACKS_ARRAY_DEFINE(promise_progress_handling,
100 { EFL_PROMISE_EVENT_FUTURE_PROGRESS_SET, _progress },
101 { EFL_PROMISE_EVENT_FUTURE_NONE, _no_future },
102 { EFL_EVENT_DEL, _forced_shutdown });
103
104EFL_CALLBACKS_ARRAY_DEFINE(promise_handling,
105 { EFL_PROMISE_EVENT_FUTURE_NONE, _no_future },
106 { EFL_EVENT_DEL, _forced_shutdown });
107
108static void
109_file_error_cb(void *data, Eio_File *handler, int error)
110{
111 Efl_Promise *p = data;
112
113 efl_event_callback_array_del(p, promise_handling(), handler);
114
115 efl_promise_failed_set(p, error);
116
117 efl_del(p);
118}
119
120static void
121_file_done_cb(void *data, Eio_File *handler)
122{
123 Efl_Promise *p = data;
124 uint64_t *v = calloc(1, sizeof (uint64_t));
125
126 efl_event_callback_array_del(p, promise_handling(), handler);
127
128 if (!v)
129 {
130 efl_promise_failed_set(p, ENOMEM);
131 goto end;
132 }
133
134 *v = handler->length;
135 efl_promise_value_set(p, v, free);
136
137 end:
138 efl_del(p);
139}
140
141/* Basic listing callbacks */ 72/* Basic listing callbacks */
142static void 73static void
143_cleanup_info_progress(void *data)
144{
145 Eina_Array *existing = data;
146 Eio_File_Direct_Info *d; // This is a trick because we use the head of the structure
147 Eina_Array_Iterator it;
148 unsigned int i;
149
150 EINA_ARRAY_ITER_NEXT(existing, i, d, it)
151 eio_direct_info_free(d);
152 eina_array_free(existing);
153}
154
155static void
156_future_string_cb(void *data EINA_UNUSED, Eio_File *handler, Eina_Array *gather) 74_future_string_cb(void *data EINA_UNUSED, Eio_File *handler, Eina_Array *gather)
157{ 75{
158 EflIoPath paths = ecore_thread_local_data_find(handler->thread, ".paths"); 76 EflIoPath paths = ecore_thread_local_data_find(handler->thread, ".paths");
@@ -188,47 +106,6 @@ _future_file_info_cb(void *data EINA_UNUSED, Eio_File *handler, Eina_Array *gath
188 eina_array_free(gather); 106 eina_array_free(gather);
189} 107}
190 108
191static void
192_file_info_cb(void *data, Eio_File *handler, Eina_Array *gather)
193{
194 Efl_Promise *p = data;
195 Eina_Array *existing = efl_key_data_get(p, "_eio.stored");
196 void **tmp;
197
198 // If a future is set, but without progress, we should assume
199 // that we should discard all future progress. [[FIXME]]
200 if (existing)
201 {
202 tmp = realloc(existing->data, sizeof (void*) * (existing->count + gather->count));
203 if (!tmp)
204 {
205 eina_array_free(gather);
206 eina_array_free(existing);
207 efl_key_data_set(p, "_eio.stored", NULL);
208 handler->error = ENOMEM;
209 eio_file_cancel(handler);
210 return ;
211 }
212 existing->data = tmp;
213 memcpy(existing->data + existing->count, gather->data, gather->count * sizeof (void*));
214 existing->count += gather->count;
215 existing->total = existing->count;
216 eina_array_free(gather);
217 }
218 else
219 {
220 existing = gather;
221 }
222 if (!efl_key_data_get(p, "_eio.progress"))
223 {
224 efl_key_data_set(p, "_eio.stored", existing);
225 return ;
226 }
227 efl_promise_progress_set(p, existing);
228 efl_key_data_set(p, "_eio.stored", NULL);
229 _cleanup_info_progress(existing);
230}
231
232/* Method implementations */ 109/* Method implementations */
233static Eina_Future * 110static Eina_Future *
234_efl_io_manager_direct_ls(Eo *obj, 111_efl_io_manager_direct_ls(Eo *obj,