Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Günther Wagner
gnome-builder
Commits
7664c4b7
Commit
7664c4b7
authored
Mar 21, 2018
by
Christian Hergert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workers: port to IdeTask
parent
fe718a0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
src/libide/workers/ide-worker-manager.c
src/libide/workers/ide-worker-manager.c
+10
-9
src/libide/workers/ide-worker-process.c
src/libide/workers/ide-worker-process.c
+15
-14
No files found.
src/libide/workers/ide-worker-manager.c
View file @
7664c4b7
...
...
@@ -32,6 +32,7 @@
#include "workers/ide-worker-process.h"
#include "workers/ide-worker-manager.h"
#include "threading/ide-task.h"
struct
_IdeWorkerManager
{
...
...
@@ -225,21 +226,21 @@ ide_worker_manager_get_worker_cb (GObject *object,
gpointer
user_data
)
{
IdeWorkerProcess
*
worker_process
=
(
IdeWorkerProcess
*
)
object
;
g_autoptr
(
G
Task
)
task
=
user_data
;
g_autoptr
(
Ide
Task
)
task
=
user_data
;
g_autoptr
(
GError
)
error
=
NULL
;
GDBusProxy
*
proxy
;
IDE_ENTRY
;
g_assert
(
IDE_IS_WORKER_PROCESS
(
worker_process
));
g_assert
(
G
_IS_TASK
(
task
));
g_assert
(
IDE
_IS_TASK
(
task
));
proxy
=
ide_worker_process_get_proxy_finish
(
worker_process
,
result
,
&
error
);
if
(
proxy
==
NULL
)
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
else
g
_task_return_pointer
(
task
,
proxy
,
g_object_unref
);
ide
_task_return_pointer
(
task
,
proxy
,
g_object_unref
);
IDE_EXIT
;
}
...
...
@@ -252,13 +253,13 @@ ide_worker_manager_get_worker_async (IdeWorkerManager *self,
gpointer
user_data
)
{
IdeWorkerProcess
*
worker_process
;
G
Task
*
task
;
Ide
Task
*
task
;
g_return_if_fail
(
IDE_IS_WORKER_MANAGER
(
self
));
g_return_if_fail
(
plugin_name
!=
NULL
);
g_return_if_fail
(
!
cancellable
||
G_IS_CANCELLABLE
(
cancellable
));
task
=
g
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
task
=
ide
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
worker_process
=
ide_worker_manager_get_worker_process
(
self
,
plugin_name
);
ide_worker_process_get_proxy_async
(
worker_process
,
cancellable
,
...
...
@@ -271,12 +272,12 @@ ide_worker_manager_get_worker_finish (IdeWorkerManager *self,
GAsyncResult
*
result
,
GError
**
error
)
{
G
Task
*
task
=
(
G
Task
*
)
result
;
Ide
Task
*
task
=
(
Ide
Task
*
)
result
;
g_return_val_if_fail
(
IDE_IS_WORKER_MANAGER
(
self
),
NULL
);
g_return_val_if_fail
(
G
_IS_TASK
(
task
),
NULL
);
g_return_val_if_fail
(
IDE
_IS_TASK
(
task
),
NULL
);
return
g
_task_propagate_pointer
(
task
,
error
);
return
ide
_task_propagate_pointer
(
task
,
error
);
}
IdeWorkerManager
*
...
...
src/libide/workers/ide-worker-process.c
View file @
7664c4b7
...
...
@@ -26,6 +26,7 @@
#include "logging/ide-log.h"
#include "workers/ide-worker-process.h"
#include "workers/ide-worker.h"
#include "threading/ide-task.h"
struct
_IdeWorkerProcess
{
...
...
@@ -363,7 +364,7 @@ ide_worker_process_matches_credentials (IdeWorkerProcess *self,
static
void
ide_worker_process_create_proxy_for_task
(
IdeWorkerProcess
*
self
,
G
Task
*
task
)
Ide
Task
*
task
)
{
GDBusProxy
*
proxy
;
g_autoptr
(
GError
)
error
=
NULL
;
...
...
@@ -371,14 +372,14 @@ ide_worker_process_create_proxy_for_task (IdeWorkerProcess *self,
IDE_ENTRY
;
g_assert
(
IDE_IS_WORKER_PROCESS
(
self
));
g_assert
(
G
_IS_TASK
(
task
));
g_assert
(
IDE
_IS_TASK
(
task
));
if
(
self
->
worker
==
NULL
)
{
g
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_PROXY_FAILED
,
"Failed to create IdeWorker instance."
);
ide
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_PROXY_FAILED
,
"Failed to create IdeWorker instance."
);
IDE_EXIT
;
}
...
...
@@ -390,11 +391,11 @@ ide_worker_process_create_proxy_for_task (IdeWorkerProcess *self,
error
=
g_error_new_literal
(
G_IO_ERROR
,
G_IO_ERROR_PROXY_FAILED
,
"IdeWorker returned NULL and did not set an error."
);
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
IDE_EXIT
;
}
g
_task_return_pointer
(
task
,
proxy
,
g_object_unref
);
ide
_task_return_pointer
(
task
,
proxy
,
g_object_unref
);
IDE_EXIT
;
}
...
...
@@ -418,7 +419,7 @@ ide_worker_process_set_connection (IdeWorkerProcess *self,
for
(
i
=
0
;
i
<
ar
->
len
;
i
++
)
{
G
Task
*
task
=
g_ptr_array_index
(
ar
,
i
);
Ide
Task
*
task
=
g_ptr_array_index
(
ar
,
i
);
ide_worker_process_create_proxy_for_task
(
self
,
task
);
}
}
...
...
@@ -431,14 +432,14 @@ ide_worker_process_get_proxy_async (IdeWorkerProcess *self,
GAsyncReadyCallback
callback
,
gpointer
user_data
)
{
g_autoptr
(
G
Task
)
task
=
NULL
;
g_autoptr
(
Ide
Task
)
task
=
NULL
;
IDE_ENTRY
;
g_return_if_fail
(
IDE_IS_WORKER_PROCESS
(
self
));
g_return_if_fail
(
!
cancellable
||
G_IS_CANCELLABLE
(
cancellable
));
task
=
g
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
task
=
ide
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
if
(
self
->
connection
!=
NULL
)
{
...
...
@@ -459,15 +460,15 @@ ide_worker_process_get_proxy_finish (IdeWorkerProcess *self,
GAsyncResult
*
result
,
GError
**
error
)
{
G
Task
*
task
=
(
G
Task
*
)
result
;
Ide
Task
*
task
=
(
Ide
Task
*
)
result
;
GDBusProxy
*
ret
;
IDE_ENTRY
;
g_return_val_if_fail
(
IDE_IS_WORKER_PROCESS
(
self
),
NULL
);
g_return_val_if_fail
(
G
_IS_TASK
(
task
),
NULL
);
g_return_val_if_fail
(
IDE
_IS_TASK
(
task
),
NULL
);
ret
=
g
_task_propagate_pointer
(
task
,
error
);
ret
=
ide
_task_propagate_pointer
(
task
,
error
);
IDE_RETURN
(
ret
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment