summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-04 17:42:26 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-16 14:33:26 -0800
commit563f91eaf98fff474a4858f2d81c6374f0d777b9 (patch)
tree2e3a8abf52d835da7a74d1285ae45a17410cd763 /src/lib/eio
parent40ca3fbe5813dfe0f2d0090f421c22a4cf2d8817 (diff)
ecore: remove data parameters of Efl.Loop_Consumer.promise_new to reduce the risk of inadvertently using the wrong data.
If you need data, use a efl_future_then as done in every case here to get the same feature. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7577
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/efl_io_manager.c18
-rw-r--r--src/lib/eio/eio_model.c18
2 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c
index 110f01c..3509bc6 100644
--- a/src/lib/eio/efl_io_manager.c
+++ b/src/lib/eio/efl_io_manager.c
@@ -119,7 +119,7 @@ _efl_io_manager_direct_ls(const Eo *obj,
119 Eina_Future *future; 119 Eina_Future *future;
120 Eio_File *h; 120 Eio_File *h;
121 121
122 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 122 p = efl_loop_promise_new(obj);
123 if (!p) return NULL; 123 if (!p) return NULL;
124 future = eina_future_new(p); 124 future = eina_future_new(p);
125 125
@@ -161,7 +161,7 @@ _efl_io_manager_stat_ls(const Eo *obj,
161 Eina_Future *future; 161 Eina_Future *future;
162 Eio_File *h; 162 Eio_File *h;
163 163
164 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 164 p = efl_loop_promise_new(obj);
165 if (!p) return NULL; 165 if (!p) return NULL;
166 future = eina_future_new(p); 166 future = eina_future_new(p);
167 167
@@ -202,7 +202,7 @@ _efl_io_manager_ls(const Eo *obj,
202 Eina_Future *future; 202 Eina_Future *future;
203 Eio_File *h; 203 Eio_File *h;
204 204
205 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 205 p = efl_loop_promise_new(obj);
206 if (!p) return NULL; 206 if (!p) return NULL;
207 future = eina_future_new(p); 207 future = eina_future_new(p);
208 208
@@ -253,7 +253,7 @@ _efl_io_manager_stat(const Eo *obj,
253 Eina_Future *future; 253 Eina_Future *future;
254 Eio_File *h; 254 Eio_File *h;
255 255
256 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 256 p = efl_loop_promise_new(obj);
257 if (!p) return NULL; 257 if (!p) return NULL;
258 future = eina_future_new(p); 258 future = eina_future_new(p);
259 259
@@ -281,7 +281,7 @@ _efl_io_manager_xattr_ls(const Eo *obj,
281 Eina_Future *future; 281 Eina_Future *future;
282 Eio_File *h; 282 Eio_File *h;
283 283
284 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 284 p = efl_loop_promise_new(obj);
285 if (!p) return NULL; 285 if (!p) return NULL;
286 future = eina_future_new(p); 286 future = eina_future_new(p);
287 287
@@ -331,7 +331,7 @@ _efl_io_manager_xattr_set(Eo *obj,
331 Eina_Future *future; 331 Eina_Future *future;
332 Eio_File *h; 332 Eio_File *h;
333 333
334 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 334 p = efl_loop_promise_new(obj);
335 if (!p) return NULL; 335 if (!p) return NULL;
336 future = eina_future_new(p); 336 future = eina_future_new(p);
337 337
@@ -360,7 +360,7 @@ _efl_io_manager_xattr_get(const Eo *obj,
360 Eina_Future *future; 360 Eina_Future *future;
361 Eio_File *h; 361 Eio_File *h;
362 362
363 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 363 p = efl_loop_promise_new(obj);
364 if (!p) return NULL; 364 if (!p) return NULL;
365 future = eina_future_new(p); 365 future = eina_future_new(p);
366 366
@@ -397,7 +397,7 @@ _efl_io_manager_open(const Eo *obj,
397 Eina_Future *future; 397 Eina_Future *future;
398 Eio_File *h; 398 Eio_File *h;
399 399
400 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 400 p = efl_loop_promise_new(obj);
401 if (!p) return NULL; 401 if (!p) return NULL;
402 future = eina_future_new(p); 402 future = eina_future_new(p);
403 403
@@ -422,7 +422,7 @@ _efl_io_manager_close(const Eo *obj,
422 Eina_Future *future; 422 Eina_Future *future;
423 Eio_File *h; 423 Eio_File *h;
424 424
425 p = efl_loop_promise_new(obj, NULL, NULL, NULL); 425 p = efl_loop_promise_new(obj);
426 if (!p) return NULL; 426 if (!p) return NULL;
427 future = eina_future_new(p); 427 future = eina_future_new(p);
428 428
diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c
index d080830..01550d1 100644
--- a/src/lib/eio/eio_model.c
+++ b/src/lib/eio/eio_model.c
@@ -407,7 +407,7 @@ _delayed_flush(void *data EINA_UNUSED, const Efl_Event *ev)
407} 407}
408 408
409static Eina_Value 409static Eina_Value
410_cancel_request(Efl_Loop *loop EINA_UNUSED, void *data, Eina_Error error) 410_cancel_request(Eo *model EINA_UNUSED, void *data, Eina_Error error)
411{ 411{
412 delayed_queue = eina_list_remove_list(delayed_queue, data); 412 delayed_queue = eina_list_remove_list(delayed_queue, data);
413 413
@@ -415,23 +415,23 @@ _cancel_request(Efl_Loop *loop EINA_UNUSED, void *data, Eina_Error error)
415} 415}
416 416
417static Eina_Future * 417static Eina_Future *
418_build_delay(Efl_Loop *loop) 418_build_delay(Eio_Model *model)
419{ 419{
420 Eina_Promise *p; 420 Eina_Promise *p;
421 421
422 p = eina_promise_new(efl_loop_future_scheduler_get(loop), NULL, NULL); 422 p = efl_loop_promise_new(model);
423 423
424 if (!delayed_queue) 424 if (!delayed_queue)
425 { 425 {
426 // Remove callback, just in case it is still there. 426 // Remove callback, just in case it is still there.
427 efl_event_callback_del(loop, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL); 427 efl_event_callback_del(efl_loop_get(model), EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
428 efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL); 428 efl_event_callback_add(efl_loop_get(model), EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
429 // FIXME: It would be nice to be able to build a future directly to be triggered on one event 429 // FIXME: It would be nice to be able to build a future directly to be triggered on one event
430 } 430 }
431 431
432 delayed_queue = eina_list_append(delayed_queue, p); 432 delayed_queue = eina_list_append(delayed_queue, p);
433 433
434 return efl_future_then(loop, eina_future_new(p), 434 return efl_future_then(model, eina_future_new(p),
435 .error = _cancel_request, 435 .error = _cancel_request,
436 .data = eina_list_last(delayed_queue)); 436 .data = eina_list_last(delayed_queue));
437} 437}
@@ -456,7 +456,7 @@ _eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_futu
456 // Make sure that we are not over consuming time in the main loop 456 // Make sure that we are not over consuming time in the main loop
457 if (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004) 457 if (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004)
458 { 458 {
459 Eina_Future *f = eina_future_then(_build_delay(pd->loop), 459 Eina_Future *f = eina_future_then(_build_delay(model),
460 _eio_build_mime_now, model, NULL); 460 _eio_build_mime_now, model, NULL);
461 return eina_future_as_value(efl_future_then(model, f)); 461 return eina_future_as_value(efl_future_then(model, f));
462 } 462 }
@@ -483,7 +483,7 @@ _eio_build_mime(const Efl_Object *model, Eio_Model_Data *pd)
483 if (pd->mime_type) return ; 483 if (pd->mime_type) return ;
484 if (pd->request.mime) return ; 484 if (pd->request.mime) return ;
485 485
486 efl_wref_add(efl_provider_find(model, EFL_LOOP_CLASS), &pd->loop); 486 efl_wref_add(efl_loop_get(model), &pd->loop);
487 487
488 f = efl_loop_job(pd->loop); 488 f = efl_loop_job(pd->loop);
489 f = eina_future_then(f, _eio_build_mime_now, model, NULL); 489 f = eina_future_then(f, _eio_build_mime_now, model, NULL);
@@ -685,7 +685,7 @@ _eio_model_efl_model_property_set(Eo *obj,
685 685
686 if (finalized) 686 if (finalized)
687 { 687 {
688 Eina_Promise *p = efl_loop_promise_new(obj, NULL, NULL, NULL); 688 Eina_Promise *p = efl_loop_promise_new(obj);
689 f = eina_future_new(p); 689 f = eina_future_new(p);
690 690
691 pd->request.move = eio_file_move(pd->path, path, 691 pd->request.move = eio_file_move(pd->path, path,