Merge lp:~vanvugt/mir/remove-callbacks-mir_connect into lp:~mir-team/mir/trunk
- remove-callbacks-mir_connect
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Daniel van Vugt |
Proposed branch: | lp:~vanvugt/mir/remove-callbacks-mir_connect |
Merge into: | lp:~mir-team/mir/trunk |
Diff against target: |
743 lines (+73/-198) 17 files modified
examples/demo_client.c (+1/-6) examples/demo_client_accelerated.cpp (+1/-7) examples/demo_client_unaccelerated.c (+1/-7) include/mir_client/mir_client_library.h (+3/-14) include/mir_client/mir_client_library_lightdm.h (+1/-2) src/client/mir_client_library.cpp (+13/-7) src/client/mir_connection.cpp (+8/-8) src/client/mir_connection.h (+3/-5) tests/acceptance-tests/test_client_library.cpp (+16/-14) tests/acceptance-tests/test_focus_management_api.cpp (+2/-10) tests/acceptance-tests/test_surfaceloop.cpp (+6/-31) tests/integration-tests/test_display_info.cpp (+1/-7) tests/integration-tests/test_drm_auth_magic.cpp (+2/-8) tests/integration-tests/test_error_reporting.cpp (+2/-25) tests/integration-tests/test_surfaceloop.cpp (+8/-34) tests/unit-tests/client/test_client_mir_surface.cpp (+1/-5) tests/unit-tests/client/test_mir_connection.cpp (+4/-8) |
To merge this branch: | bzr merge lp:~vanvugt/mir/remove-callbacks-mir_connect |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Thomas Voß (community) | Disapprove | ||
Alan Griffiths | Disapprove | ||
Review via email: mp+147056@code.launchpad.net |
Commit message
Remove mir_connect callback from the public API.
First pass at simplifying the client API by removing callbacks. This is part
of a greater effort to resolve LP: #1112195, with more proposals to come.
Description of the change
Thomas Voß (thomas-voss) wrote : | # |
In our conversations, both our toolkit experts (loicm and kaleo) expressed a requirement for an asynchronous API based on callbacks and added support for that requirement. I will disapprove until we have clarified with the stakeholders.
Daniel van Vugt (vanvugt) wrote : | # |
The API is still asynchronous. I'm not sure the stakeholders even conceived that it could be so without callbacks. And if callbacks are still required, they should be attached to a MirWaitHandle in the spirit of:
mir_callback_
I hope we can resolve this. The API is presently so awful that I refuse to use it. And I won't be the only one.
Daniel van Vugt (vanvugt) wrote : | # |
An alternate solution, as discussed in bug 1112195 is to simply add the synchronous functions that most people will want to use:
connection = mir_connect(...);
Though that suggests the existing functions like "mir_connect" change to something like "mir_async_connect" or "mir_background
The approach proposed here however is a nice middle-ground, not requiring duplicate functions to elegantly support both asynchronous and synchronous operation.
Daniel van Vugt (vanvugt) wrote : | # |
Design issues should be discussed in bug 1112195...
But I have many possible compromise solutions in mine. Will propose later.
Daniel van Vugt (vanvugt) wrote : | # |
*in mind
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:408
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 408. By Daniel van Vugt
-
Remove mir_connect callback from the public API.
First pass at simplifying the client API by removing callbacks. This is part
of a greater effort to resolve LP: #1112195, with more proposals to come. - 407. By Alan Griffiths
-
3rd_party/
android- input: remove reliance on hardware_ legacy/ power.( c|h). Approved by Alexandros Frantzis, PS Jenkins bot.
- 406. By Alan Griffiths
-
3rd_party/
android- input: remove reliance on cutils/ atomic. (c|h). Approved by Alexandros Frantzis, PS Jenkins bot.
- 405. By Alan Griffiths
-
3rd_party/
android- input: move the files we want to keep to "input". Approved by Thomas Voß, PS Jenkins bot.
- 404. By Kevin DuBois
-
remove the wrappers for <thread> and <chrono> that were used to work around poor stdlib support on android, now that we have proper support of these libraries in the chroot.
Approved by Alan Griffiths, PS Jenkins bot.
- 403. By Alan Griffiths
-
graphics: Silence "narrowing conversion" with g++ 4.7.
Approved by PS Jenkins bot, Kevin DuBois.
- 402. By Kevin DuBois
-
stride was not being put into the native window type correctly. This caused render glitches when client was rendering. Add test that catches this condition
fixes: bug #1111612. Fixes: https:/
/bugs.launchpad .net/bugs/ 1111612. Approved by Alexandros Frantzis, Robert Carr, PS Jenkins bot, Alan Griffiths.
- 401. By Alan Griffiths
-
various: An assortment of nitpicky tidy-up.
Approved by Alexandros Frantzis, PS Jenkins bot.
- 400. By Alan Griffiths
-
3rd_party/
android- input: stub our small use of TextOutput. Approved by Kevin DuBois, PS Jenkins bot.
- 399. By Daniel van Vugt
-
mir_client_
library. h: Documentation cleanup 1. Make the comments properly C-compatible so that clients written in pure C
can build. (LP: #1116104)
2. Fix invalid Doxygen syntax which was generating bad docs (LP: #1116120). Fixes: https://bugs.launchpad .net/bugs/ 1116104, https:/ /bugs.launchpad .net/bugs/ 1116120. Approved by PS Jenkins bot, Alan Griffiths.
Preview Diff
1 | === modified file 'examples/demo_client.c' | |||
2 | --- examples/demo_client.c 2012-12-27 14:44:59 +0000 | |||
3 | +++ examples/demo_client.c 2013-02-07 10:24:19 +0000 | |||
4 | @@ -48,11 +48,6 @@ | |||
5 | 48 | /// needs to be accessible both to callbacks and to the control function. | 48 | /// needs to be accessible both to callbacks and to the control function. |
6 | 49 | /// \snippet demo_client.c Callback_tag | 49 | /// \snippet demo_client.c Callback_tag |
7 | 50 | ///\internal [Callback_tag] | 50 | ///\internal [Callback_tag] |
8 | 51 | // Callback to update MirDemoState on connection | ||
9 | 52 | static void connection_callback(MirConnection *new_connection, void *context) | ||
10 | 53 | { | ||
11 | 54 | ((MirDemoState*)context)->connection = new_connection; | ||
12 | 55 | } | ||
13 | 56 | 51 | ||
14 | 57 | // Callback to update MirDemoState on surface_create | 52 | // Callback to update MirDemoState on surface_create |
15 | 58 | static void surface_create_callback(MirSurface *new_surface, void *context) | 53 | static void surface_create_callback(MirSurface *new_surface, void *context) |
16 | @@ -93,7 +88,7 @@ | |||
17 | 93 | /// \snippet demo_client.c connect_tag | 88 | /// \snippet demo_client.c connect_tag |
18 | 94 | ///\internal [connect_tag] | 89 | ///\internal [connect_tag] |
19 | 95 | // Call mir_connect and wait for callback to complete. | 90 | // Call mir_connect and wait for callback to complete. |
21 | 96 | mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, connection_callback, &mcd)); | 91 | mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, &mcd.connection)); |
22 | 97 | puts("Connected"); | 92 | puts("Connected"); |
23 | 98 | ///\internal [connect_tag] | 93 | ///\internal [connect_tag] |
24 | 99 | 94 | ||
25 | 100 | 95 | ||
26 | === modified file 'examples/demo_client_accelerated.cpp' | |||
27 | --- examples/demo_client_accelerated.cpp 2013-01-28 21:35:03 +0000 | |||
28 | +++ examples/demo_client_accelerated.cpp 2013-02-07 10:24:19 +0000 | |||
29 | @@ -32,12 +32,6 @@ | |||
30 | 32 | static MirConnection *connection = 0; | 32 | static MirConnection *connection = 0; |
31 | 33 | static MirSurface *surface = 0; | 33 | static MirSurface *surface = 0; |
32 | 34 | 34 | ||
33 | 35 | static void set_connection(MirConnection *new_connection, void * context) | ||
34 | 36 | { | ||
35 | 37 | (void)context; | ||
36 | 38 | connection = new_connection; | ||
37 | 39 | } | ||
38 | 40 | |||
39 | 41 | static void surface_create_callback(MirSurface *new_surface, void *context) | 35 | static void surface_create_callback(MirSurface *new_surface, void *context) |
40 | 42 | { | 36 | { |
41 | 43 | (void)context; | 37 | (void)context; |
42 | @@ -76,7 +70,7 @@ | |||
43 | 76 | 70 | ||
44 | 77 | puts("Starting"); | 71 | puts("Starting"); |
45 | 78 | 72 | ||
47 | 79 | mir_wait_for(mir_connect(socket_file, __PRETTY_FUNCTION__, set_connection, 0)); | 73 | mir_wait_for(mir_connect(socket_file, __PRETTY_FUNCTION__, &connection)); |
48 | 80 | puts("Connected"); | 74 | puts("Connected"); |
49 | 81 | 75 | ||
50 | 82 | assert(connection != NULL); | 76 | assert(connection != NULL); |
51 | 83 | 77 | ||
52 | === modified file 'examples/demo_client_unaccelerated.c' | |||
53 | --- examples/demo_client_unaccelerated.c 2012-12-19 16:01:00 +0000 | |||
54 | +++ examples/demo_client_unaccelerated.c 2013-02-07 10:24:19 +0000 | |||
55 | @@ -30,12 +30,6 @@ | |||
56 | 30 | static MirConnection *connection = 0; | 30 | static MirConnection *connection = 0; |
57 | 31 | static MirSurface *surface = 0; | 31 | static MirSurface *surface = 0; |
58 | 32 | 32 | ||
59 | 33 | static void set_connection(MirConnection *new_connection, void * context) | ||
60 | 34 | { | ||
61 | 35 | (void)context; | ||
62 | 36 | connection = new_connection; | ||
63 | 37 | } | ||
64 | 38 | |||
65 | 39 | static void surface_create_callback(MirSurface *new_surface, void *context) | 33 | static void surface_create_callback(MirSurface *new_surface, void *context) |
66 | 40 | { | 34 | { |
67 | 41 | (void)context; | 35 | (void)context; |
68 | @@ -136,7 +130,7 @@ | |||
69 | 136 | 130 | ||
70 | 137 | puts("Starting"); | 131 | puts("Starting"); |
71 | 138 | 132 | ||
73 | 139 | mir_wait_for(mir_connect(socket_file, __PRETTY_FUNCTION__, set_connection, 0)); | 133 | mir_wait_for(mir_connect(socket_file, __PRETTY_FUNCTION__, &connection)); |
74 | 140 | puts("Connected"); | 134 | puts("Connected"); |
75 | 141 | 135 | ||
76 | 142 | assert(connection != NULL); | 136 | assert(connection != NULL); |
77 | 143 | 137 | ||
78 | === modified file 'include/mir_client/mir_client_library.h' | |||
79 | --- include/mir_client/mir_client_library.h 2013-02-05 10:28:36 +0000 | |||
80 | +++ include/mir_client/mir_client_library.h 2013-02-07 10:24:19 +0000 | |||
81 | @@ -38,14 +38,6 @@ | |||
82 | 38 | typedef struct MirWaitHandle MirWaitHandle; | 38 | typedef struct MirWaitHandle MirWaitHandle; |
83 | 39 | 39 | ||
84 | 40 | /** | 40 | /** |
85 | 41 | * Callback to be passed when issuing a mir_connect request. | ||
86 | 42 | * \param [in] connection the new connection | ||
87 | 43 | * \param [in,out] client_context context provided by client in calling | ||
88 | 44 | * mir_connect | ||
89 | 45 | */ | ||
90 | 46 | typedef void (*mir_connected_callback)(MirConnection *connection, void *client_context); | ||
91 | 47 | |||
92 | 48 | /** | ||
93 | 49 | * Callback to be passed when calling: | 41 | * Callback to be passed when calling: |
94 | 50 | * - mir_surface_create | 42 | * - mir_surface_create |
95 | 51 | * - mir_surface_next_buffer | 43 | * - mir_surface_next_buffer |
96 | @@ -146,16 +138,13 @@ | |||
97 | 146 | * wait handle remains valid until the connection has been released. | 138 | * wait handle remains valid until the connection has been released. |
98 | 147 | * \param [in] server a name identifying the server | 139 | * \param [in] server a name identifying the server |
99 | 148 | * \param [in] app_name a name referring to the application | 140 | * \param [in] app_name a name referring to the application |
104 | 149 | * \param [in] callback callback function to be invoked when request | 141 | * \param [out] result where to store the connection handle on |
105 | 150 | * completes | 142 | * completion. |
102 | 151 | * \param [in,out] context passed to the callback function | ||
103 | 152 | * \return a handle that can be passed to mir_wait_for | ||
106 | 153 | */ | 143 | */ |
107 | 154 | MirWaitHandle *mir_connect( | 144 | MirWaitHandle *mir_connect( |
108 | 155 | char const *server, | 145 | char const *server, |
109 | 156 | char const *app_name, | 146 | char const *app_name, |
112 | 157 | mir_connected_callback callback, | 147 | MirConnection **result); |
111 | 158 | void *client_context); | ||
113 | 159 | 148 | ||
114 | 160 | /** | 149 | /** |
115 | 161 | * Test for a valid connection | 150 | * Test for a valid connection |
116 | 162 | 151 | ||
117 | === modified file 'include/mir_client/mir_client_library_lightdm.h' | |||
118 | --- include/mir_client/mir_client_library_lightdm.h 2013-02-05 14:50:25 +0000 | |||
119 | +++ include/mir_client/mir_client_library_lightdm.h 2013-02-07 10:24:19 +0000 | |||
120 | @@ -40,8 +40,7 @@ | |||
121 | 40 | char const *server, | 40 | char const *server, |
122 | 41 | int lightdm_id, | 41 | int lightdm_id, |
123 | 42 | char const *app_name, | 42 | char const *app_name, |
126 | 43 | mir_connected_callback callback, | 43 | MirConnection **result); |
125 | 44 | void *client_context); | ||
127 | 45 | 44 | ||
128 | 46 | 45 | ||
129 | 47 | /** | 46 | /** |
130 | 48 | 47 | ||
131 | === modified file 'src/client/mir_client_library.cpp' | |||
132 | --- src/client/mir_client_library.cpp 2013-02-05 18:12:46 +0000 | |||
133 | +++ src/client/mir_client_library.cpp 2013-02-07 10:24:19 +0000 | |||
134 | @@ -44,7 +44,8 @@ | |||
135 | 44 | MirConnection error_connection; | 44 | MirConnection error_connection; |
136 | 45 | } | 45 | } |
137 | 46 | 46 | ||
139 | 47 | MirWaitHandle* mir_connect(char const* socket_file, char const* name, mir_connected_callback callback, void * context) | 47 | MirWaitHandle* mir_connect(char const* socket_file, char const* name, |
140 | 48 | MirConnection **result) | ||
141 | 48 | { | 49 | { |
142 | 49 | 50 | ||
143 | 50 | try | 51 | try |
144 | @@ -57,12 +58,17 @@ | |||
145 | 57 | log, | 58 | log, |
146 | 58 | client_platform_factory); | 59 | client_platform_factory); |
147 | 59 | 60 | ||
149 | 60 | return connection->connect(name, callback, context); | 61 | return connection->connect(name, result); |
150 | 61 | } | 62 | } |
151 | 62 | catch (std::exception const& x) | 63 | catch (std::exception const& x) |
152 | 63 | { | 64 | { |
153 | 64 | error_connection.set_error_message(x.what()); | 65 | error_connection.set_error_message(x.what()); |
155 | 65 | callback(&error_connection, context); | 66 | |
156 | 67 | // Test cases expect a non-null error connection but why not null | ||
157 | 68 | // for simpler error handling? | ||
158 | 69 | if (result) | ||
159 | 70 | *result = &error_connection; | ||
160 | 71 | |||
161 | 66 | return 0; | 72 | return 0; |
162 | 67 | } | 73 | } |
163 | 68 | } | 74 | } |
164 | @@ -195,8 +201,7 @@ | |||
165 | 195 | char const *server, | 201 | char const *server, |
166 | 196 | int lightdm_id, | 202 | int lightdm_id, |
167 | 197 | char const *app_name, | 203 | char const *app_name, |
170 | 198 | mir_connected_callback callback, | 204 | MirConnection **result) |
169 | 199 | void *client_context) | ||
171 | 200 | try | 205 | try |
172 | 201 | { | 206 | { |
173 | 202 | auto log = std::make_shared<mcl::ConsoleLogger>(); | 207 | auto log = std::make_shared<mcl::ConsoleLogger>(); |
174 | @@ -207,12 +212,13 @@ | |||
175 | 207 | log, | 212 | log, |
176 | 208 | client_platform_factory); | 213 | client_platform_factory); |
177 | 209 | 214 | ||
179 | 210 | return connection->connect(lightdm_id, app_name, callback, client_context); | 215 | return connection->connect(lightdm_id, app_name, result); |
180 | 211 | } | 216 | } |
181 | 212 | catch (std::exception const& x) | 217 | catch (std::exception const& x) |
182 | 213 | { | 218 | { |
183 | 214 | error_connection.set_error_message(x.what()); | 219 | error_connection.set_error_message(x.what()); |
185 | 215 | callback(&error_connection, client_context); | 220 | if (result) |
186 | 221 | *result = 0; | ||
187 | 216 | return 0; | 222 | return 0; |
188 | 217 | } | 223 | } |
189 | 218 | 224 | ||
190 | 219 | 225 | ||
191 | === modified file 'src/client/mir_connection.cpp' | |||
192 | --- src/client/mir_connection.cpp 2013-02-05 18:12:46 +0000 | |||
193 | +++ src/client/mir_connection.cpp 2013-02-07 10:24:19 +0000 | |||
194 | @@ -126,7 +126,7 @@ | |||
195 | 126 | return new_wait_handle; | 126 | return new_wait_handle; |
196 | 127 | } | 127 | } |
197 | 128 | 128 | ||
199 | 129 | void MirConnection::connected(mir_connected_callback callback, void * context) | 129 | void MirConnection::connected(MirConnection **result) |
200 | 130 | { | 130 | { |
201 | 131 | /* | 131 | /* |
202 | 132 | * We need to create the client platform after the connection has been | 132 | * We need to create the client platform after the connection has been |
203 | @@ -136,14 +136,15 @@ | |||
204 | 136 | platform = client_platform_factory->create_client_platform(this); | 136 | platform = client_platform_factory->create_client_platform(this); |
205 | 137 | native_display = platform->create_egl_native_display(); | 137 | native_display = platform->create_egl_native_display(); |
206 | 138 | 138 | ||
208 | 139 | callback(this, context); | 139 | if (result) |
209 | 140 | *result = this; | ||
210 | 141 | |||
211 | 140 | connect_wait_handle.result_received(); | 142 | connect_wait_handle.result_received(); |
212 | 141 | } | 143 | } |
213 | 142 | 144 | ||
214 | 143 | MirWaitHandle* MirConnection::connect( | 145 | MirWaitHandle* MirConnection::connect( |
215 | 144 | const char* app_name, | 146 | const char* app_name, |
218 | 145 | mir_connected_callback callback, | 147 | MirConnection **result) |
217 | 146 | void * context) | ||
219 | 147 | { | 148 | { |
220 | 148 | connect_parameters.set_application_name(app_name); | 149 | connect_parameters.set_application_name(app_name); |
221 | 149 | server.connect( | 150 | server.connect( |
222 | @@ -151,15 +152,14 @@ | |||
223 | 151 | &connect_parameters, | 152 | &connect_parameters, |
224 | 152 | &connect_result, | 153 | &connect_result, |
225 | 153 | google::protobuf::NewCallback( | 154 | google::protobuf::NewCallback( |
227 | 154 | this, &MirConnection::connected, callback, context)); | 155 | this, &MirConnection::connected, result)); |
228 | 155 | return &connect_wait_handle; | 156 | return &connect_wait_handle; |
229 | 156 | } | 157 | } |
230 | 157 | 158 | ||
231 | 158 | MirWaitHandle* MirConnection::connect( | 159 | MirWaitHandle* MirConnection::connect( |
232 | 159 | int lightdm_id, | 160 | int lightdm_id, |
233 | 160 | const char* app_name, | 161 | const char* app_name, |
236 | 161 | mir_connected_callback callback, | 162 | MirConnection **result) |
235 | 162 | void * context) | ||
237 | 163 | { | 163 | { |
238 | 164 | connect_parameters.set_application_name(app_name); | 164 | connect_parameters.set_application_name(app_name); |
239 | 165 | connect_parameters.set_lightdm_id(lightdm_id); | 165 | connect_parameters.set_lightdm_id(lightdm_id); |
240 | @@ -168,7 +168,7 @@ | |||
241 | 168 | &connect_parameters, | 168 | &connect_parameters, |
242 | 169 | &connect_result, | 169 | &connect_result, |
243 | 170 | google::protobuf::NewCallback( | 170 | google::protobuf::NewCallback( |
245 | 171 | this, &MirConnection::connected, callback, context)); | 171 | this, &MirConnection::connected, result)); |
246 | 172 | return &connect_wait_handle; | 172 | return &connect_wait_handle; |
247 | 173 | } | 173 | } |
248 | 174 | 174 | ||
249 | 175 | 175 | ||
250 | === modified file 'src/client/mir_connection.h' | |||
251 | --- src/client/mir_connection.h 2013-02-05 18:12:46 +0000 | |||
252 | +++ src/client/mir_connection.h 2013-02-07 10:24:19 +0000 | |||
253 | @@ -71,14 +71,12 @@ | |||
254 | 71 | 71 | ||
255 | 72 | MirWaitHandle* connect( | 72 | MirWaitHandle* connect( |
256 | 73 | const char* app_name, | 73 | const char* app_name, |
259 | 74 | mir_connected_callback callback, | 74 | MirConnection **result); |
258 | 75 | void * context); | ||
260 | 76 | 75 | ||
261 | 77 | MirWaitHandle* connect( | 76 | MirWaitHandle* connect( |
262 | 78 | int lightdm_id, | 77 | int lightdm_id, |
263 | 79 | const char* app_name, | 78 | const char* app_name, |
266 | 80 | mir_connected_callback callback, | 79 | MirConnection **result); |
265 | 81 | void * context); | ||
267 | 82 | 80 | ||
268 | 83 | void select_focus_by_lightdm_id(int lightdm_id); | 81 | void select_focus_by_lightdm_id(int lightdm_id); |
269 | 84 | 82 | ||
270 | @@ -128,7 +126,7 @@ | |||
271 | 128 | struct SurfaceRelease; | 126 | struct SurfaceRelease; |
272 | 129 | 127 | ||
273 | 130 | void done_disconnect(); | 128 | void done_disconnect(); |
275 | 131 | void connected(mir_connected_callback callback, void * context); | 129 | void connected(MirConnection **result); |
276 | 132 | void released(SurfaceRelease ); | 130 | void released(SurfaceRelease ); |
277 | 133 | void done_drm_auth_magic(mir_drm_auth_magic_callback callback, void* context); | 131 | void done_drm_auth_magic(mir_drm_auth_magic_callback callback, void* context); |
278 | 134 | }; | 132 | }; |
279 | 135 | 133 | ||
280 | === modified file 'tests/acceptance-tests/test_client_library.cpp' | |||
281 | --- tests/acceptance-tests/test_client_library.cpp 2013-02-05 18:12:46 +0000 | |||
282 | +++ tests/acceptance-tests/test_client_library.cpp 2013-02-07 10:24:19 +0000 | |||
283 | @@ -53,12 +53,6 @@ | |||
284 | 53 | { | 53 | { |
285 | 54 | } | 54 | } |
286 | 55 | 55 | ||
287 | 56 | static void connection_callback(MirConnection * connection, void * context) | ||
288 | 57 | { | ||
289 | 58 | ClientConfigCommon * config = reinterpret_cast<ClientConfigCommon *>(context); | ||
290 | 59 | config->connection = connection; | ||
291 | 60 | } | ||
292 | 61 | |||
293 | 62 | static void create_surface_callback(MirSurface * surface, void * context) | 56 | static void create_surface_callback(MirSurface * surface, void * context) |
294 | 63 | { | 57 | { |
295 | 64 | ClientConfigCommon * config = reinterpret_cast<ClientConfigCommon *>(context); | 58 | ClientConfigCommon * config = reinterpret_cast<ClientConfigCommon *>(context); |
296 | @@ -109,7 +103,8 @@ | |||
297 | 109 | { | 103 | { |
298 | 110 | void exec() | 104 | void exec() |
299 | 111 | { | 105 | { |
301 | 112 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this)); | 106 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
302 | 107 | &connection)); | ||
303 | 113 | 108 | ||
304 | 114 | ASSERT_TRUE(connection != NULL); | 109 | ASSERT_TRUE(connection != NULL); |
305 | 115 | EXPECT_TRUE(mir_connection_is_valid(connection)); | 110 | EXPECT_TRUE(mir_connection_is_valid(connection)); |
306 | @@ -129,7 +124,8 @@ | |||
307 | 129 | void exec() | 124 | void exec() |
308 | 130 | { | 125 | { |
309 | 131 | 126 | ||
311 | 132 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this)); | 127 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
312 | 128 | &connection)); | ||
313 | 133 | 129 | ||
314 | 134 | ASSERT_TRUE(connection != NULL); | 130 | ASSERT_TRUE(connection != NULL); |
315 | 135 | EXPECT_TRUE(mir_connection_is_valid(connection)); | 131 | EXPECT_TRUE(mir_connection_is_valid(connection)); |
316 | @@ -200,7 +196,8 @@ | |||
317 | 200 | 196 | ||
318 | 201 | void exec() | 197 | void exec() |
319 | 202 | { | 198 | { |
321 | 203 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this)); | 199 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
322 | 200 | &connection)); | ||
323 | 204 | 201 | ||
324 | 205 | ASSERT_TRUE(connection != NULL); | 202 | ASSERT_TRUE(connection != NULL); |
325 | 206 | EXPECT_TRUE(mir_connection_is_valid(connection)); | 203 | EXPECT_TRUE(mir_connection_is_valid(connection)); |
326 | @@ -252,7 +249,8 @@ | |||
327 | 252 | void exec() | 249 | void exec() |
328 | 253 | { | 250 | { |
329 | 254 | 251 | ||
331 | 255 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this)); | 252 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
332 | 253 | &connection)); | ||
333 | 256 | 254 | ||
334 | 257 | ASSERT_TRUE(connection != NULL); | 255 | ASSERT_TRUE(connection != NULL); |
335 | 258 | EXPECT_TRUE(mir_connection_is_valid(connection)); | 256 | EXPECT_TRUE(mir_connection_is_valid(connection)); |
336 | @@ -288,7 +286,8 @@ | |||
337 | 288 | { | 286 | { |
338 | 289 | void exec() | 287 | void exec() |
339 | 290 | { | 288 | { |
341 | 291 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this)); | 289 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
342 | 290 | &connection)); | ||
343 | 292 | ASSERT_TRUE(connection != NULL); | 291 | ASSERT_TRUE(connection != NULL); |
344 | 293 | 292 | ||
345 | 294 | MirPlatformPackage platform_package; | 293 | MirPlatformPackage platform_package; |
346 | @@ -314,7 +313,8 @@ | |||
347 | 314 | { | 313 | { |
348 | 315 | void exec() | 314 | void exec() |
349 | 316 | { | 315 | { |
351 | 317 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this)); | 316 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
352 | 317 | &connection)); | ||
353 | 318 | ASSERT_TRUE(connection != NULL); | 318 | ASSERT_TRUE(connection != NULL); |
354 | 319 | 319 | ||
355 | 320 | MirDisplayInfo display_info; | 320 | MirDisplayInfo display_info; |
356 | @@ -338,7 +338,8 @@ | |||
357 | 338 | { | 338 | { |
358 | 339 | void exec() | 339 | void exec() |
359 | 340 | { | 340 | { |
361 | 341 | mir_wait_for(mir_connect("garbage", __PRETTY_FUNCTION__, connection_callback, this)); | 341 | mir_wait_for(mir_connect("garbage", __PRETTY_FUNCTION__, |
362 | 342 | &connection)); | ||
363 | 342 | ASSERT_TRUE(connection != NULL); | 343 | ASSERT_TRUE(connection != NULL); |
364 | 343 | 344 | ||
365 | 344 | char const* error = mir_connection_get_error_message(connection); | 345 | char const* error = mir_connection_get_error_message(connection); |
366 | @@ -360,7 +361,8 @@ | |||
367 | 360 | { | 361 | { |
368 | 361 | void exec() | 362 | void exec() |
369 | 362 | { | 363 | { |
371 | 363 | mir_wait_for(mir_connect("garbage", __PRETTY_FUNCTION__, connection_callback, this)); | 364 | mir_wait_for(mir_connect("garbage", __PRETTY_FUNCTION__, |
372 | 365 | &connection)); | ||
373 | 364 | 366 | ||
374 | 365 | MirSurfaceParameters const request_params = | 367 | MirSurfaceParameters const request_params = |
375 | 366 | { | 368 | { |
376 | 367 | 369 | ||
377 | === modified file 'tests/acceptance-tests/test_focus_management_api.cpp' | |||
378 | --- tests/acceptance-tests/test_focus_management_api.cpp 2013-02-05 18:12:46 +0000 | |||
379 | +++ tests/acceptance-tests/test_focus_management_api.cpp 2013-02-07 10:24:19 +0000 | |||
380 | @@ -56,12 +56,6 @@ | |||
381 | 56 | { | 56 | { |
382 | 57 | } | 57 | } |
383 | 58 | 58 | ||
384 | 59 | static void connection_callback(MirConnection* connection, void* context) | ||
385 | 60 | { | ||
386 | 61 | ClientConfigCommon* config = reinterpret_cast<ClientConfigCommon *>(context); | ||
387 | 62 | config->connection = connection; | ||
388 | 63 | } | ||
389 | 64 | |||
390 | 65 | static void create_surface_callback(MirSurface* surface, void* context) | 59 | static void create_surface_callback(MirSurface* surface, void* context) |
391 | 66 | { | 60 | { |
392 | 67 | ClientConfigCommon* config = reinterpret_cast<ClientConfigCommon *>(context); | 61 | ClientConfigCommon* config = reinterpret_cast<ClientConfigCommon *>(context); |
393 | @@ -200,8 +194,7 @@ | |||
394 | 200 | mir_test_socket, | 194 | mir_test_socket, |
395 | 201 | lightdm_id, | 195 | lightdm_id, |
396 | 202 | __PRETTY_FUNCTION__, | 196 | __PRETTY_FUNCTION__, |
399 | 203 | connection_callback, | 197 | &connection)); |
398 | 204 | this)); | ||
400 | 205 | 198 | ||
401 | 206 | ASSERT_TRUE(connection != NULL); | 199 | ASSERT_TRUE(connection != NULL); |
402 | 207 | 200 | ||
403 | @@ -229,8 +222,7 @@ | |||
404 | 229 | mir_wait_for(mir_connect( | 222 | mir_wait_for(mir_connect( |
405 | 230 | mir_test_socket, | 223 | mir_test_socket, |
406 | 231 | __PRETTY_FUNCTION__, | 224 | __PRETTY_FUNCTION__, |
409 | 232 | connection_callback, | 225 | &connection)); |
408 | 233 | this)); | ||
410 | 234 | 226 | ||
411 | 235 | wait_for(focus_ready); | 227 | wait_for(focus_ready); |
412 | 236 | mir_select_focus_by_lightdm_id(connection, lightdm_id); | 228 | mir_select_focus_by_lightdm_id(connection, lightdm_id); |
413 | 237 | 229 | ||
414 | === modified file 'tests/acceptance-tests/test_surfaceloop.cpp' | |||
415 | --- tests/acceptance-tests/test_surfaceloop.cpp 2013-01-11 23:47:40 +0000 | |||
416 | +++ tests/acceptance-tests/test_surfaceloop.cpp 2013-02-07 10:24:19 +0000 | |||
417 | @@ -96,28 +96,6 @@ | |||
418 | 96 | { | 96 | { |
419 | 97 | } | 97 | } |
420 | 98 | 98 | ||
421 | 99 | static void connection_callback(MirConnection * connection, void * context) | ||
422 | 100 | { | ||
423 | 101 | ClientConfigCommon * config = reinterpret_cast<ClientConfigCommon *>(context); | ||
424 | 102 | config->connected(connection); | ||
425 | 103 | } | ||
426 | 104 | |||
427 | 105 | void connected(MirConnection * new_connection) | ||
428 | 106 | { | ||
429 | 107 | std::unique_lock<std::mutex> lock(guard); | ||
430 | 108 | connection = new_connection; | ||
431 | 109 | wait_condition.notify_all(); | ||
432 | 110 | } | ||
433 | 111 | |||
434 | 112 | void wait_for_connect() | ||
435 | 113 | { | ||
436 | 114 | std::unique_lock<std::mutex> lock(guard); | ||
437 | 115 | while (!connection) | ||
438 | 116 | wait_condition.wait(lock); | ||
439 | 117 | } | ||
440 | 118 | |||
441 | 119 | std::mutex guard; | ||
442 | 120 | std::condition_variable wait_condition; | ||
443 | 121 | MirConnection * connection; | 99 | MirConnection * connection; |
444 | 122 | static const int max_surface_count = 5; | 100 | static const int max_surface_count = 5; |
445 | 123 | SurfaceSync ssync[max_surface_count]; | 101 | SurfaceSync ssync[max_surface_count]; |
446 | @@ -160,9 +138,8 @@ | |||
447 | 160 | { | 138 | { |
448 | 161 | void exec() | 139 | void exec() |
449 | 162 | { | 140 | { |
453 | 163 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 141 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
454 | 164 | 142 | &connection)); | |
452 | 165 | wait_for_connect(); | ||
455 | 166 | 143 | ||
456 | 167 | MirSurfaceParameters request_params = | 144 | MirSurfaceParameters request_params = |
457 | 168 | { | 145 | { |
458 | @@ -213,9 +190,8 @@ | |||
459 | 213 | { | 190 | { |
460 | 214 | void exec() | 191 | void exec() |
461 | 215 | { | 192 | { |
465 | 216 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 193 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
466 | 217 | 194 | &connection)); | |
464 | 218 | wait_for_connect(); | ||
467 | 219 | 195 | ||
468 | 220 | MirSurfaceParameters request_params = | 196 | MirSurfaceParameters request_params = |
469 | 221 | { | 197 | { |
470 | @@ -257,9 +233,8 @@ | |||
471 | 257 | { | 233 | { |
472 | 258 | void exec() | 234 | void exec() |
473 | 259 | { | 235 | { |
477 | 260 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 236 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
478 | 261 | 237 | &connection)); | |
476 | 262 | wait_for_connect(); | ||
479 | 263 | 238 | ||
480 | 264 | MirSurfaceParameters request_params = | 239 | MirSurfaceParameters request_params = |
481 | 265 | { | 240 | { |
482 | 266 | 241 | ||
483 | === modified file 'tests/integration-tests/test_display_info.cpp' | |||
484 | --- tests/integration-tests/test_display_info.cpp 2013-01-11 23:47:40 +0000 | |||
485 | +++ tests/integration-tests/test_display_info.cpp 2013-02-07 10:24:19 +0000 | |||
486 | @@ -106,12 +106,6 @@ | |||
487 | 106 | 106 | ||
488 | 107 | }; | 107 | }; |
489 | 108 | 108 | ||
490 | 109 | void connection_callback(MirConnection* connection, void* context) | ||
491 | 110 | { | ||
492 | 111 | auto connection_ptr = static_cast<MirConnection**>(context); | ||
493 | 112 | *connection_ptr = connection; | ||
494 | 113 | } | ||
495 | 114 | |||
496 | 115 | } | 109 | } |
497 | 116 | 110 | ||
498 | 117 | TEST_F(BespokeDisplayServerTestFixture, display_info_reaches_client) | 111 | TEST_F(BespokeDisplayServerTestFixture, display_info_reaches_client) |
499 | @@ -139,7 +133,7 @@ | |||
500 | 139 | { | 133 | { |
501 | 140 | MirConnection* connection{nullptr}; | 134 | MirConnection* connection{nullptr}; |
502 | 141 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, | 135 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
504 | 142 | connection_callback, &connection)); | 136 | &connection)); |
505 | 143 | 137 | ||
506 | 144 | MirDisplayInfo info; | 138 | MirDisplayInfo info; |
507 | 145 | 139 | ||
508 | 146 | 140 | ||
509 | === modified file 'tests/integration-tests/test_drm_auth_magic.cpp' | |||
510 | --- tests/integration-tests/test_drm_auth_magic.cpp 2013-02-05 18:12:46 +0000 | |||
511 | +++ tests/integration-tests/test_drm_auth_magic.cpp 2013-02-07 10:24:19 +0000 | |||
512 | @@ -83,12 +83,6 @@ | |||
513 | 83 | MOCK_METHOD1(drm_auth_magic, void(unsigned int)); | 83 | MOCK_METHOD1(drm_auth_magic, void(unsigned int)); |
514 | 84 | }; | 84 | }; |
515 | 85 | 85 | ||
516 | 86 | void connection_callback(MirConnection* connection, void* context) | ||
517 | 87 | { | ||
518 | 88 | auto connection_ptr = static_cast<MirConnection**>(context); | ||
519 | 89 | *connection_ptr = connection; | ||
520 | 90 | } | ||
521 | 91 | |||
522 | 92 | void drm_auth_magic_callback(int status, void* client_context) | 86 | void drm_auth_magic_callback(int status, void* client_context) |
523 | 93 | { | 87 | { |
524 | 94 | auto status_ptr = static_cast<int*>(client_context); | 88 | auto status_ptr = static_cast<int*>(client_context); |
525 | @@ -127,7 +121,7 @@ | |||
526 | 127 | { | 121 | { |
527 | 128 | MirConnection* connection{nullptr}; | 122 | MirConnection* connection{nullptr}; |
528 | 129 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, | 123 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
530 | 130 | connection_callback, &connection)); | 124 | &connection)); |
531 | 131 | 125 | ||
532 | 132 | int const no_error{0}; | 126 | int const no_error{0}; |
533 | 133 | int status{67}; | 127 | int status{67}; |
534 | @@ -176,7 +170,7 @@ | |||
535 | 176 | { | 170 | { |
536 | 177 | MirConnection* connection{nullptr}; | 171 | MirConnection* connection{nullptr}; |
537 | 178 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, | 172 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
539 | 179 | connection_callback, &connection)); | 173 | &connection)); |
540 | 180 | 174 | ||
541 | 181 | int status{67}; | 175 | int status{67}; |
542 | 182 | 176 | ||
543 | 183 | 177 | ||
544 | === modified file 'tests/integration-tests/test_error_reporting.cpp' | |||
545 | --- tests/integration-tests/test_error_reporting.cpp 2013-02-05 18:12:46 +0000 | |||
546 | +++ tests/integration-tests/test_error_reporting.cpp 2013-02-07 10:24:19 +0000 | |||
547 | @@ -151,28 +151,6 @@ | |||
548 | 151 | { | 151 | { |
549 | 152 | } | 152 | } |
550 | 153 | 153 | ||
551 | 154 | static void connection_callback(MirConnection * connection, void * context) | ||
552 | 155 | { | ||
553 | 156 | ClientConfigCommon * config = reinterpret_cast<ClientConfigCommon *>(context); | ||
554 | 157 | config->connected(connection); | ||
555 | 158 | } | ||
556 | 159 | |||
557 | 160 | void connected(MirConnection * new_connection) | ||
558 | 161 | { | ||
559 | 162 | std::unique_lock<std::mutex> lock(guard); | ||
560 | 163 | connection = new_connection; | ||
561 | 164 | wait_condition.notify_all(); | ||
562 | 165 | } | ||
563 | 166 | |||
564 | 167 | void wait_for_connect() | ||
565 | 168 | { | ||
566 | 169 | std::unique_lock<std::mutex> lock(guard); | ||
567 | 170 | while (!connection) | ||
568 | 171 | wait_condition.wait(lock); | ||
569 | 172 | } | ||
570 | 173 | |||
571 | 174 | std::mutex guard; | ||
572 | 175 | std::condition_variable wait_condition; | ||
573 | 176 | MirConnection * connection; | 154 | MirConnection * connection; |
574 | 177 | static const int max_surface_count = 5; | 155 | static const int max_surface_count = 5; |
575 | 178 | SurfaceSync ssync[max_surface_count]; | 156 | SurfaceSync ssync[max_surface_count]; |
576 | @@ -255,9 +233,8 @@ | |||
577 | 255 | { | 233 | { |
578 | 256 | void exec() | 234 | void exec() |
579 | 257 | { | 235 | { |
583 | 258 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 236 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
584 | 259 | 237 | &connection)); | |
582 | 260 | wait_for_connect(); | ||
585 | 261 | 238 | ||
586 | 262 | ASSERT_TRUE(connection != NULL); | 239 | ASSERT_TRUE(connection != NULL); |
587 | 263 | EXPECT_FALSE(mir_connection_is_valid(connection)); | 240 | EXPECT_FALSE(mir_connection_is_valid(connection)); |
588 | 264 | 241 | ||
589 | === modified file 'tests/integration-tests/test_surfaceloop.cpp' | |||
590 | --- tests/integration-tests/test_surfaceloop.cpp 2013-02-05 18:12:46 +0000 | |||
591 | +++ tests/integration-tests/test_surfaceloop.cpp 2013-02-07 10:24:19 +0000 | |||
592 | @@ -183,28 +183,6 @@ | |||
593 | 183 | { | 183 | { |
594 | 184 | } | 184 | } |
595 | 185 | 185 | ||
596 | 186 | static void connection_callback(MirConnection * connection, void * context) | ||
597 | 187 | { | ||
598 | 188 | ClientConfigCommon * config = reinterpret_cast<ClientConfigCommon *>(context); | ||
599 | 189 | config->connected(connection); | ||
600 | 190 | } | ||
601 | 191 | |||
602 | 192 | void connected(MirConnection * new_connection) | ||
603 | 193 | { | ||
604 | 194 | std::unique_lock<std::mutex> lock(guard); | ||
605 | 195 | connection = new_connection; | ||
606 | 196 | wait_condition.notify_all(); | ||
607 | 197 | } | ||
608 | 198 | |||
609 | 199 | void wait_for_connect() | ||
610 | 200 | { | ||
611 | 201 | std::unique_lock<std::mutex> lock(guard); | ||
612 | 202 | while (!connection) | ||
613 | 203 | wait_condition.wait(lock); | ||
614 | 204 | } | ||
615 | 205 | |||
616 | 206 | std::mutex guard; | ||
617 | 207 | std::condition_variable wait_condition; | ||
618 | 208 | MirConnection * connection; | 186 | MirConnection * connection; |
619 | 209 | static const int max_surface_count = 5; | 187 | static const int max_surface_count = 5; |
620 | 210 | SurfaceSync ssync[max_surface_count]; | 188 | SurfaceSync ssync[max_surface_count]; |
621 | @@ -270,9 +248,8 @@ | |||
622 | 270 | { | 248 | { |
623 | 271 | void exec() | 249 | void exec() |
624 | 272 | { | 250 | { |
628 | 273 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 251 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
629 | 274 | 252 | &connection)); | |
627 | 275 | wait_for_connect(); | ||
630 | 276 | 253 | ||
631 | 277 | ASSERT_TRUE(connection != NULL); | 254 | ASSERT_TRUE(connection != NULL); |
632 | 278 | EXPECT_TRUE(mir_connection_is_valid(connection)); | 255 | EXPECT_TRUE(mir_connection_is_valid(connection)); |
633 | @@ -373,9 +350,8 @@ | |||
634 | 373 | { | 350 | { |
635 | 374 | void exec() | 351 | void exec() |
636 | 375 | { | 352 | { |
640 | 376 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 353 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
641 | 377 | 354 | &connection)); | |
639 | 378 | wait_for_connect(); | ||
642 | 379 | 355 | ||
643 | 380 | ASSERT_TRUE(connection != NULL); | 356 | ASSERT_TRUE(connection != NULL); |
644 | 381 | EXPECT_TRUE(mir_connection_is_valid(connection)); | 357 | EXPECT_TRUE(mir_connection_is_valid(connection)); |
645 | @@ -512,9 +488,8 @@ | |||
646 | 512 | { | 488 | { |
647 | 513 | void exec() | 489 | void exec() |
648 | 514 | { | 490 | { |
652 | 515 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 491 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
653 | 516 | 492 | &connection)); | |
651 | 517 | wait_for_connect(); | ||
654 | 518 | 493 | ||
655 | 519 | MirSurfaceParameters const request_params = | 494 | MirSurfaceParameters const request_params = |
656 | 520 | { | 495 | { |
657 | @@ -561,9 +536,8 @@ | |||
658 | 561 | { | 536 | { |
659 | 562 | void exec() | 537 | void exec() |
660 | 563 | { | 538 | { |
664 | 564 | mir_connect(mir_test_socket, __PRETTY_FUNCTION__, connection_callback, this); | 539 | mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__, |
665 | 565 | 540 | &connection)); | |
663 | 566 | wait_for_connect(); | ||
666 | 567 | 541 | ||
667 | 568 | MirSurfaceParameters const request_params = | 542 | MirSurfaceParameters const request_params = |
668 | 569 | { | 543 | { |
669 | 570 | 544 | ||
670 | === modified file 'tests/unit-tests/client/test_client_mir_surface.cpp' | |||
671 | --- tests/unit-tests/client/test_client_mir_surface.cpp 2013-01-02 15:57:13 +0000 | |||
672 | +++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-02-07 10:24:19 +0000 | |||
673 | @@ -201,10 +201,6 @@ | |||
674 | 201 | 201 | ||
675 | 202 | namespace mt = mir::test; | 202 | namespace mt = mir::test; |
676 | 203 | 203 | ||
677 | 204 | void connected_callback(MirConnection* /*connection*/, void * /*client_context*/) | ||
678 | 205 | { | ||
679 | 206 | } | ||
680 | 207 | |||
681 | 208 | struct CallBack | 204 | struct CallBack |
682 | 209 | { | 205 | { |
683 | 210 | void msg() {} | 206 | void msg() {} |
684 | @@ -233,7 +229,7 @@ | |||
685 | 233 | channel = mcl::make_rpc_channel("./test_socket_surface", logger); | 229 | channel = mcl::make_rpc_channel("./test_socket_surface", logger); |
686 | 234 | connection = std::make_shared<MirConnection>(channel, logger, platform_factory); | 230 | connection = std::make_shared<MirConnection>(channel, logger, platform_factory); |
687 | 235 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", | 231 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", |
689 | 236 | connected_callback, 0); | 232 | nullptr); |
690 | 237 | wait_handle->wait_for_result(); | 233 | wait_handle->wait_for_result(); |
691 | 238 | client_comm_channel = std::make_shared<mir::protobuf::DisplayServer::Stub>(channel.get()); | 234 | client_comm_channel = std::make_shared<mir::protobuf::DisplayServer::Stub>(channel.get()); |
692 | 239 | } | 235 | } |
693 | 240 | 236 | ||
694 | === modified file 'tests/unit-tests/client/test_mir_connection.cpp' | |||
695 | --- tests/unit-tests/client/test_mir_connection.cpp 2013-01-02 15:57:13 +0000 | |||
696 | +++ tests/unit-tests/client/test_mir_connection.cpp 2013-02-07 10:24:19 +0000 | |||
697 | @@ -98,10 +98,6 @@ | |||
698 | 98 | std::shared_ptr<mcl::ClientPlatform> platform; | 98 | std::shared_ptr<mcl::ClientPlatform> platform; |
699 | 99 | }; | 99 | }; |
700 | 100 | 100 | ||
701 | 101 | void connected_callback(MirConnection* /*connection*/, void * /*client_context*/) | ||
702 | 102 | { | ||
703 | 103 | } | ||
704 | 104 | |||
705 | 105 | void drm_auth_magic_callback(int status, void* client_context) | 101 | void drm_auth_magic_callback(int status, void* client_context) |
706 | 106 | { | 102 | { |
707 | 107 | auto status_ptr = static_cast<int*>(client_context); | 103 | auto status_ptr = static_cast<int*>(client_context); |
708 | @@ -144,7 +140,7 @@ | |||
709 | 144 | .WillOnce(Return(native_display)); | 140 | .WillOnce(Return(native_display)); |
710 | 145 | 141 | ||
711 | 146 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", | 142 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", |
713 | 147 | connected_callback, 0); | 143 | nullptr); |
714 | 148 | wait_handle->wait_for_result(); | 144 | wait_handle->wait_for_result(); |
715 | 149 | 145 | ||
716 | 150 | EGLNativeDisplayType connection_native_display = connection->egl_native_display(); | 146 | EGLNativeDisplayType connection_native_display = connection->egl_native_display(); |
717 | @@ -167,7 +163,7 @@ | |||
718 | 167 | .Times(1); | 163 | .Times(1); |
719 | 168 | 164 | ||
720 | 169 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", | 165 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", |
722 | 170 | connected_callback, 0); | 166 | nullptr); |
723 | 171 | wait_handle->wait_for_result(); | 167 | wait_handle->wait_for_result(); |
724 | 172 | 168 | ||
725 | 173 | int const no_error{0}; | 169 | int const no_error{0}; |
726 | @@ -211,7 +207,7 @@ | |||
727 | 211 | .WillOnce(Invoke(fill_display_info)); | 207 | .WillOnce(Invoke(fill_display_info)); |
728 | 212 | 208 | ||
729 | 213 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", | 209 | MirWaitHandle* wait_handle = connection->connect("MirClientSurfaceTest", |
731 | 214 | connected_callback, 0); | 210 | nullptr); |
732 | 215 | wait_handle->wait_for_result(); | 211 | wait_handle->wait_for_result(); |
733 | 216 | 212 | ||
734 | 217 | MirDisplayInfo info; | 213 | MirDisplayInfo info; |
735 | @@ -236,7 +232,7 @@ | |||
736 | 236 | .WillOnce(Invoke(fill_display_info_100)); | 232 | .WillOnce(Invoke(fill_display_info_100)); |
737 | 237 | 233 | ||
738 | 238 | MirWaitHandle* wait_handle = connection->connect("MirConnectionTest", | 234 | MirWaitHandle* wait_handle = connection->connect("MirConnectionTest", |
740 | 239 | connected_callback, 0); | 235 | nullptr); |
741 | 240 | wait_handle->wait_for_result(); | 236 | wait_handle->wait_for_result(); |
742 | 241 | 237 | ||
743 | 242 | MirDisplayInfo info; | 238 | MirDisplayInfo info; |
We were asked to provided a callback based API.
Ignoring the stakeholders (I'm sure Thomas can provide a list) by removing the callbacks they asked is a bad idea.