GNOME Bugzilla – Bug 761549
replace g_io_scheduler with GTask
Last modified: 2016-02-08 16:42:43 UTC
see patches.
Created attachment 320425 [details] [review] file-operations: replace io_scheduler in helper functions Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. In order to make this change possible, a first step would be to replace the scheduler in the helper functions called during the jobs. Replace g_io_scheduler_send_to_mainloop with g_main_context_invoke in helper functions. Since g_main_context_invoke is not blocking, add a mutex and a condition so the current thread is blocked until the operation is completed in the main loop.
Created attachment 320426 [details] [review] file-operations: replace io_scheduler with GTask API Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. The helper functions used in the operations have been changed in a previous patch so it is now possible to port the jobs themselves to the new API. The job structures are now data for tasks, which are handled by the existing functions in separate threads. For finalizing the operations, the existing "job_done" functions are now used as callbacks.
Created attachment 320427 [details] [review] file-operations: replace io_scheduler with GTask API Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. The helper functions used in the operations have been changed in a previous patch so it is now possible to port the jobs themselves to the new API. The job structures are now data for tasks, which are handled by the existing functions in separate threads. For finalizing the operations, the existing "job_done" functions are now used as callbacks.
As afraid as I am with this change, patches looks good to me. I created a gnome-3-20 branch, so we can commit to master and this code won't be there.
Review of attachment 320427 [details] [review]: good!
Review of attachment 320425 [details] [review]: See the comment inline. Would be nice to have this in the commit message as well. The commit message nor the code explains why we need to make it blocking. ::: libnautilus-private/nautilus-file-operations.c @@ +1065,2 @@ int result; + gboolean completed; Can you add a small comment here to explain why we need this? Something similar to the commit message. Like: "Needed to block the thread to wait for the response from the dialogs"
Created attachment 320639 [details] [review] file-operations: replace io_scheduler with GTask API Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. The helper functions used in the operations have been changed in a previous patch so it is now possible to port the jobs themselves to the new API. The job structures are now data for tasks, which are handled by the existing functions in separate threads. For finalizing the operations, the existing "job_done" functions are now used as callbacks.
Review of attachment 320639 [details] [review]: ::: libnautilus-private/nautilus-file-operations.c @@ +1067,3 @@ gboolean show_all; + /* dialogs are ran from operation threads, which need to be blocked until + the user gives a valid response */ The style is with first capital letter and a asterisk every line, finalizing in a newline with an asterisk aligned and the slash. Like: /* Test, * 124 */
Created attachment 320640 [details] [review] file-operations: replace io_scheduler with GTask API Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. The helper functions used in the operations have been changed in a previous patch so it is now possible to port the jobs themselves to the new API. The job structures are now data for tasks, which are handled by the existing functions in separate threads. For finalizing the operations, the existing "job_done" functions are now used as callbacks.
Review of attachment 320640 [details] [review]: Yep, thanks!
Created attachment 320642 [details] [review] file-operations: replace io_scheduler in helper functions Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. In order to make this change possible, a first step would be to replace the scheduler in the helper functions called during the jobs. Replace g_io_scheduler_send_to_mainloop with g_main_context_invoke in helper functions. Since g_main_context_invoke is not blocking, add a mutex and a condition so the current thread is blocked until the operation is completed in the main loop.
Created attachment 320643 [details] [review] file-operations: replace io_scheduler with GTask API Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. The helper functions used in the operations have been changed in a previous patch so it is now possible to port the jobs themselves to the new API. The job structures are now data for tasks, which are handled by the existing functions in separate threads. For finalizing the operations, the existing "job_done" functions are now used as callbacks.
Created attachment 320644 [details] [review] file-operations: replace io_scheduler in helper functions Nautilus file operations are implemented as asynchronous jobs scheduled using g_io_scheduler. Since g_io_scheduler has been deprecated, these operations should be using the simpler GTask API. In order to make this change possible, a first step would be to replace the scheduler in the helper functions called during the jobs. Replace g_io_scheduler_send_to_mainloop with g_main_context_invoke in helper functions. Since g_main_context_invoke is not blocking, add a mutex and a condition so the current thread is blocked until the operation is completed in the main loop.
Review of attachment 320644 [details] [review]: Yeah
Review of attachment 320643 [details] [review]: LGTM
Attachment 320643 [details] pushed as 1913ec0 - file-operations: replace io_scheduler with GTask API Attachment 320644 [details] pushed as 5a6f869 - file-operations: replace io_scheduler in helper functions