Merge lp:~alan-griffiths/mir/cleanup-some-locking into lp:mir
- cleanup-some-locking
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | kevin gunn |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1316 |
Proposed branch: | lp:~alan-griffiths/mir/cleanup-some-locking |
Merge into: | lp:mir |
Diff against target: |
725 lines (+103/-112) 10 files modified
src/client/mir_client_library.cpp (+1/-2) src/client/mir_connection.cpp (+46/-46) src/client/mir_connection.h (+3/-3) src/client/mir_surface.cpp (+28/-33) src/client/mir_surface.h (+3/-3) src/client/rpc/mir_basic_rpc_channel.cpp (+16/-17) src/client/rpc/mir_basic_rpc_channel.h (+1/-2) src/client/rpc/mir_socket_rpc_channel.cpp (+3/-4) src/client/rpc/mir_socket_rpc_channel.h (+1/-1) tests/acceptance-tests/test_client_focus_notification.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/cleanup-some-locking |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Daniel van Vugt | Approve | ||
Review via email: mp+199828@code.launchpad.net |
Description of the change
client: rework dubious locking design in client rpc
PS Jenkins bot (ps-jenkins) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
Verified bug 1243584 fixed.
Bug 1243576 remains... unlinking it.
Daniel van Vugt (vanvugt) wrote : | # |
To test and verify the bugs;
sudo valgrind --tool=helgrind --log-file=
The news is pretty good already as branch halves the size of the log.
Daniel van Vugt (vanvugt) wrote : | # |
(1) Bug 1243576 is still happening. Please fix it or unlink.
(2) Adding error_message_mutex seems to not achieve anything. Because the string returned by MirConnection:
(3) std::mutex mutex; // Protects all members of *this that don't have their own
Is there a logical or performance reason why the class has multiple mutexes? If neither, then it would be easier to follow using just one.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1314
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1317
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) wrote : | # |
(1)-(3) Nice. All fixed, I think. As possibly more (linked 4 bugs now).
(4) surface_map is no longer protected by a mutex in MirConnection. But now I see it has its own built-in. That might be worth a comment where it's called by MirConnection.
(5) This is getting very complex and hard to review now. Not least because the diff doesn't show what's protected by each lock_guard. I suggest aiming to only fix one bug at a time in future :)
Daniel van Vugt (vanvugt) wrote : | # |
I was able to reproduce Jenkins' failure of ServerDisconnec
Alan Griffiths (alan-griffiths) wrote : | # |
> I was able to reproduce Jenkins' failure of
> ServerDisconnec
> repeatably, so can't prove it's due to this branch.
Thanks for trying - I've not been able to reproduce (yet) and your success gives me hope.
As it appears consistently on this branch in CI I'm assuming it is either due to the branch or exposed by it. Either way I need to track it down to land this.
Alan Griffiths (alan-griffiths) wrote : | # |
> > I was able to reproduce Jenkins' failure of
> > ServerDisconnec
> not
> > repeatably, so can't prove it's due to this branch.
>
> Thanks for trying - I've not been able to reproduce (yet) and your success
> gives me hope.
>
> As it appears consistently on this branch in CI I'm assuming it is either due
> to the branch or exposed by it. Either way I need to track it down to land
> this.
Right, I've been able to reproduce and also on *development-branch && desktop*.
This seems to be a race condition in the client side error reporting - something like detecting the broken pipe on the sending thread "before" processing the disconnect event message on the receiving thread.
I've not yet figured out where it breaks, or why this MP is particularly susceptible on the phone. But look for a separate MP.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1320
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'src/client/mir_client_library.cpp' | |||
2 | --- src/client/mir_client_library.cpp 2013-12-18 02:19:19 +0000 | |||
3 | +++ src/client/mir_client_library.cpp 2014-01-07 15:59:47 +0000 | |||
4 | @@ -108,9 +108,8 @@ | |||
5 | 108 | } | 108 | } |
6 | 109 | catch (std::exception const& x) | 109 | catch (std::exception const& x) |
7 | 110 | { | 110 | { |
9 | 111 | MirConnection* error_connection = new MirConnection(); | 111 | MirConnection* error_connection = new MirConnection(x.what()); |
10 | 112 | error_connections.insert(error_connection); | 112 | error_connections.insert(error_connection); |
11 | 113 | error_connection->set_error_message(x.what()); | ||
12 | 114 | callback(error_connection, context); | 113 | callback(error_connection, context); |
13 | 115 | return nullptr; | 114 | return nullptr; |
14 | 116 | } | 115 | } |
15 | 117 | 116 | ||
16 | === modified file 'src/client/mir_connection.cpp' | |||
17 | --- src/client/mir_connection.cpp 2013-12-20 05:06:28 +0000 | |||
18 | +++ src/client/mir_connection.cpp 2014-01-07 15:59:47 +0000 | |||
19 | @@ -66,10 +66,10 @@ | |||
20 | 66 | std::unordered_set<MirConnection*> valid_connections; | 66 | std::unordered_set<MirConnection*> valid_connections; |
21 | 67 | } | 67 | } |
22 | 68 | 68 | ||
24 | 69 | MirConnection::MirConnection() : | 69 | MirConnection::MirConnection(std::string const& error_message) : |
25 | 70 | channel(), | 70 | channel(), |
26 | 71 | server(0), | 71 | server(0), |
28 | 72 | error_message("ERROR") | 72 | error_message(error_message) |
29 | 73 | { | 73 | { |
30 | 74 | } | 74 | } |
31 | 75 | 75 | ||
32 | @@ -84,11 +84,11 @@ | |||
33 | 84 | lifecycle_control(conf.the_lifecycle_control()), | 84 | lifecycle_control(conf.the_lifecycle_control()), |
34 | 85 | surface_map(conf.the_surface_map()) | 85 | surface_map(conf.the_surface_map()) |
35 | 86 | { | 86 | { |
36 | 87 | connect_result.set_error("connect not called"); | ||
37 | 87 | { | 88 | { |
38 | 88 | std::lock_guard<std::mutex> lock(connection_guard); | 89 | std::lock_guard<std::mutex> lock(connection_guard); |
39 | 89 | valid_connections.insert(this); | 90 | valid_connections.insert(this); |
40 | 90 | } | 91 | } |
41 | 91 | connect_result.set_error("connect not called"); | ||
42 | 92 | } | 92 | } |
43 | 93 | 93 | ||
44 | 94 | MirConnection::~MirConnection() noexcept | 94 | MirConnection::~MirConnection() noexcept |
45 | @@ -97,9 +97,12 @@ | |||
46 | 97 | // But, if after 500ms we don't get a call, assume it won't happen. | 97 | // But, if after 500ms we don't get a call, assume it won't happen. |
47 | 98 | connect_wait_handle.wait_for_pending(std::chrono::milliseconds(500)); | 98 | connect_wait_handle.wait_for_pending(std::chrono::milliseconds(500)); |
48 | 99 | 99 | ||
51 | 100 | std::lock_guard<std::mutex> lock(connection_guard); | 100 | { |
52 | 101 | valid_connections.erase(this); | 101 | std::lock_guard<std::mutex> lock(connection_guard); |
53 | 102 | valid_connections.erase(this); | ||
54 | 103 | } | ||
55 | 102 | 104 | ||
56 | 105 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
57 | 103 | if (connect_result.has_platform()) | 106 | if (connect_result.has_platform()) |
58 | 104 | { | 107 | { |
59 | 105 | auto const& platform = connect_result.platform(); | 108 | auto const& platform = connect_result.platform(); |
60 | @@ -113,8 +116,6 @@ | |||
61 | 113 | mir_surface_callback callback, | 116 | mir_surface_callback callback, |
62 | 114 | void * context) | 117 | void * context) |
63 | 115 | { | 118 | { |
64 | 116 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
65 | 117 | |||
66 | 118 | auto surface = new MirSurface(this, server, platform->create_buffer_factory(), input_platform, params, callback, context); | 119 | auto surface = new MirSurface(this, server, platform->create_buffer_factory(), input_platform, params, callback, context); |
67 | 119 | 120 | ||
68 | 120 | return surface->get_create_wait_handle(); | 121 | return surface->get_create_wait_handle(); |
69 | @@ -122,22 +123,18 @@ | |||
70 | 122 | 123 | ||
71 | 123 | char const * MirConnection::get_error_message() | 124 | char const * MirConnection::get_error_message() |
72 | 124 | { | 125 | { |
74 | 125 | std::lock_guard<std::recursive_mutex> lock(mutex); | 126 | std::lock_guard<decltype(mutex)> lock(mutex); |
75 | 126 | 127 | ||
76 | 127 | if (connect_result.has_error()) | 128 | if (connect_result.has_error()) |
77 | 128 | { | 129 | { |
78 | 129 | return connect_result.error().c_str(); | 130 | return connect_result.error().c_str(); |
79 | 130 | } | 131 | } |
82 | 131 | else | 132 | |
81 | 132 | { | ||
83 | 133 | return error_message.c_str(); | 133 | return error_message.c_str(); |
84 | 134 | } | ||
85 | 135 | } | 134 | } |
86 | 136 | 135 | ||
87 | 137 | void MirConnection::set_error_message(std::string const& error) | 136 | void MirConnection::set_error_message(std::string const& error) |
88 | 138 | { | 137 | { |
89 | 139 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
90 | 140 | |||
91 | 141 | error_message = error; | 138 | error_message = error; |
92 | 142 | } | 139 | } |
93 | 143 | 140 | ||
94 | @@ -154,10 +151,8 @@ | |||
95 | 154 | 151 | ||
96 | 155 | void MirConnection::released(SurfaceRelease data) | 152 | void MirConnection::released(SurfaceRelease data) |
97 | 156 | { | 153 | { |
102 | 157 | { | 154 | surface_map->erase(data.surface->id()); |
103 | 158 | std::lock_guard<std::recursive_mutex> lock(mutex); | 155 | |
100 | 159 | surface_map->erase(data.surface->id()); | ||
101 | 160 | } | ||
104 | 161 | // Erasing this surface from surface_map means that it will no longer receive events | 156 | // Erasing this surface from surface_map means that it will no longer receive events |
105 | 162 | // If it's still focused, send an unfocused event before we kill it entirely | 157 | // If it's still focused, send an unfocused event before we kill it entirely |
106 | 163 | if (data.surface->attrib(mir_surface_attrib_focus) == mir_surface_focused) | 158 | if (data.surface->attrib(mir_surface_attrib_focus) == mir_surface_focused) |
107 | @@ -179,8 +174,6 @@ | |||
108 | 179 | mir_surface_callback callback, | 174 | mir_surface_callback callback, |
109 | 180 | void * context) | 175 | void * context) |
110 | 181 | { | 176 | { |
111 | 182 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
112 | 183 | |||
113 | 184 | auto new_wait_handle = new MirWaitHandle; | 177 | auto new_wait_handle = new MirWaitHandle; |
114 | 185 | 178 | ||
115 | 186 | SurfaceRelease surf_release{surface, new_wait_handle, callback, context}; | 179 | SurfaceRelease surf_release{surface, new_wait_handle, callback, context}; |
116 | @@ -189,7 +182,7 @@ | |||
117 | 189 | message.set_value(surface->id()); | 182 | message.set_value(surface->id()); |
118 | 190 | 183 | ||
119 | 191 | { | 184 | { |
121 | 192 | std::lock_guard<std::mutex> rel_lock(release_wait_handle_guard); | 185 | std::lock_guard<decltype(release_wait_handle_guard)> rel_lock(release_wait_handle_guard); |
122 | 193 | release_wait_handles.push_back(new_wait_handle); | 186 | release_wait_handles.push_back(new_wait_handle); |
123 | 194 | } | 187 | } |
124 | 195 | 188 | ||
125 | @@ -216,7 +209,7 @@ | |||
126 | 216 | { | 209 | { |
127 | 217 | bool safe_to_callback = true; | 210 | bool safe_to_callback = true; |
128 | 218 | { | 211 | { |
130 | 219 | std::lock_guard<std::recursive_mutex> lock(mutex); | 212 | std::lock_guard<decltype(mutex)> lock(mutex); |
131 | 220 | 213 | ||
132 | 221 | if (!connect_result.has_platform() || !connect_result.has_display_configuration()) | 214 | if (!connect_result.has_platform() || !connect_result.has_display_configuration()) |
133 | 222 | { | 215 | { |
134 | @@ -248,10 +241,13 @@ | |||
135 | 248 | mir_connected_callback callback, | 241 | mir_connected_callback callback, |
136 | 249 | void * context) | 242 | void * context) |
137 | 250 | { | 243 | { |
142 | 251 | std::lock_guard<std::recursive_mutex> lock(mutex); | 244 | { |
143 | 252 | 245 | std::lock_guard<decltype(mutex)> lock(mutex); | |
144 | 253 | connect_parameters.set_application_name(app_name); | 246 | |
145 | 254 | connect_wait_handle.expect_result(); | 247 | connect_parameters.set_application_name(app_name); |
146 | 248 | connect_wait_handle.expect_result(); | ||
147 | 249 | } | ||
148 | 250 | |||
149 | 255 | server.connect( | 251 | server.connect( |
150 | 256 | 0, | 252 | 0, |
151 | 257 | &connect_parameters, | 253 | &connect_parameters, |
152 | @@ -266,7 +262,7 @@ | |||
153 | 266 | /* todo: keeping all MirWaitHandles from a release surface until the end of the connection | 262 | /* todo: keeping all MirWaitHandles from a release surface until the end of the connection |
154 | 267 | is a kludge until we have a better story about the lifetime of MirWaitHandles */ | 263 | is a kludge until we have a better story about the lifetime of MirWaitHandles */ |
155 | 268 | { | 264 | { |
157 | 269 | std::lock_guard<std::mutex> lock(release_wait_handle_guard); | 265 | std::lock_guard<decltype(release_wait_handle_guard)> lock(release_wait_handle_guard); |
158 | 270 | for (auto handle : release_wait_handles) | 266 | for (auto handle : release_wait_handles) |
159 | 271 | delete handle; | 267 | delete handle; |
160 | 272 | } | 268 | } |
161 | @@ -276,8 +272,6 @@ | |||
162 | 276 | 272 | ||
163 | 277 | MirWaitHandle* MirConnection::disconnect() | 273 | MirWaitHandle* MirConnection::disconnect() |
164 | 278 | { | 274 | { |
165 | 279 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
166 | 280 | |||
167 | 281 | server.disconnect(0, &ignored, &ignored, | 275 | server.disconnect(0, &ignored, &ignored, |
168 | 282 | google::protobuf::NewCallback(this, &MirConnection::done_disconnect)); | 276 | google::protobuf::NewCallback(this, &MirConnection::done_disconnect)); |
169 | 283 | 277 | ||
170 | @@ -297,8 +291,6 @@ | |||
171 | 297 | mir_drm_auth_magic_callback callback, | 291 | mir_drm_auth_magic_callback callback, |
172 | 298 | void* context) | 292 | void* context) |
173 | 299 | { | 293 | { |
174 | 300 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
175 | 301 | |||
176 | 302 | mir::protobuf::DRMMagic request; | 294 | mir::protobuf::DRMMagic request; |
177 | 303 | request.set_magic(magic); | 295 | request.set_magic(magic); |
178 | 304 | 296 | ||
179 | @@ -320,12 +312,13 @@ | |||
180 | 320 | return false; | 312 | return false; |
181 | 321 | } | 313 | } |
182 | 322 | 314 | ||
183 | 315 | std::lock_guard<decltype(connection->mutex)> lock(connection->mutex); | ||
184 | 323 | return !connection->connect_result.has_error(); | 316 | return !connection->connect_result.has_error(); |
185 | 324 | } | 317 | } |
186 | 325 | 318 | ||
187 | 326 | void MirConnection::populate(MirPlatformPackage& platform_package) | 319 | void MirConnection::populate(MirPlatformPackage& platform_package) |
188 | 327 | { | 320 | { |
190 | 328 | std::lock_guard<std::recursive_mutex> lock(mutex); | 321 | std::lock_guard<decltype(mutex)> lock(mutex); |
191 | 329 | 322 | ||
192 | 330 | if (!connect_result.has_error() && connect_result.has_platform()) | 323 | if (!connect_result.has_error() && connect_result.has_platform()) |
193 | 331 | { | 324 | { |
194 | @@ -351,7 +344,7 @@ | |||
195 | 351 | 344 | ||
196 | 352 | MirDisplayConfiguration* MirConnection::create_copy_of_display_config() | 345 | MirDisplayConfiguration* MirConnection::create_copy_of_display_config() |
197 | 353 | { | 346 | { |
199 | 354 | std::lock_guard<std::recursive_mutex> lock(mutex); | 347 | std::lock_guard<decltype(mutex)> lock(mutex); |
200 | 355 | return display_configuration->copy_to_client(); | 348 | return display_configuration->copy_to_client(); |
201 | 356 | } | 349 | } |
202 | 357 | 350 | ||
203 | @@ -361,6 +354,8 @@ | |||
204 | 361 | unsigned int& valid_formats) | 354 | unsigned int& valid_formats) |
205 | 362 | { | 355 | { |
206 | 363 | valid_formats = 0; | 356 | valid_formats = 0; |
207 | 357 | |||
208 | 358 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
209 | 364 | if (!connect_result.has_error()) | 359 | if (!connect_result.has_error()) |
210 | 365 | { | 360 | { |
211 | 366 | valid_formats = std::min( | 361 | valid_formats = std::min( |
212 | @@ -376,7 +371,7 @@ | |||
213 | 376 | 371 | ||
214 | 377 | std::shared_ptr<mir::client::ClientPlatform> MirConnection::get_client_platform() | 372 | std::shared_ptr<mir::client::ClientPlatform> MirConnection::get_client_platform() |
215 | 378 | { | 373 | { |
217 | 379 | std::lock_guard<std::recursive_mutex> lock(mutex); | 374 | std::lock_guard<decltype(mutex)> lock(mutex); |
218 | 380 | 375 | ||
219 | 381 | return platform; | 376 | return platform; |
220 | 382 | } | 377 | } |
221 | @@ -388,7 +383,7 @@ | |||
222 | 388 | 383 | ||
223 | 389 | EGLNativeDisplayType MirConnection::egl_native_display() | 384 | EGLNativeDisplayType MirConnection::egl_native_display() |
224 | 390 | { | 385 | { |
226 | 391 | std::lock_guard<std::recursive_mutex> lock(mutex); | 386 | std::lock_guard<decltype(mutex)> lock(mutex); |
227 | 392 | 387 | ||
228 | 393 | return *native_display; | 388 | return *native_display; |
229 | 394 | } | 389 | } |
230 | @@ -410,8 +405,6 @@ | |||
231 | 410 | 405 | ||
232 | 411 | bool MirConnection::validate_user_display_config(MirDisplayConfiguration* config) | 406 | bool MirConnection::validate_user_display_config(MirDisplayConfiguration* config) |
233 | 412 | { | 407 | { |
234 | 413 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
235 | 414 | |||
236 | 415 | MirDisplayConfigurationStore orig_config{display_configuration->copy_to_client()}; | 408 | MirDisplayConfigurationStore orig_config{display_configuration->copy_to_client()}; |
237 | 416 | 409 | ||
238 | 417 | if ((!config) || (config->num_outputs == 0) || (config->outputs == NULL) || | 410 | if ((!config) || (config->num_outputs == 0) || (config->outputs == NULL) || |
239 | @@ -437,6 +430,8 @@ | |||
240 | 437 | 430 | ||
241 | 438 | void MirConnection::done_display_configure() | 431 | void MirConnection::done_display_configure() |
242 | 439 | { | 432 | { |
243 | 433 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
244 | 434 | |||
245 | 440 | set_error_message(display_configuration_response.error()); | 435 | set_error_message(display_configuration_response.error()); |
246 | 441 | 436 | ||
247 | 442 | if (!display_configuration_response.has_error()) | 437 | if (!display_configuration_response.has_error()) |
248 | @@ -447,23 +442,26 @@ | |||
249 | 447 | 442 | ||
250 | 448 | MirWaitHandle* MirConnection::configure_display(MirDisplayConfiguration* config) | 443 | MirWaitHandle* MirConnection::configure_display(MirDisplayConfiguration* config) |
251 | 449 | { | 444 | { |
252 | 450 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
253 | 451 | if (!validate_user_display_config(config)) | 445 | if (!validate_user_display_config(config)) |
254 | 452 | { | 446 | { |
255 | 453 | return NULL; | 447 | return NULL; |
256 | 454 | } | 448 | } |
257 | 455 | 449 | ||
258 | 456 | mir::protobuf::DisplayConfiguration request; | 450 | mir::protobuf::DisplayConfiguration request; |
259 | 457 | for (auto i=0u; i < config->num_outputs; i++) | ||
260 | 458 | { | 451 | { |
269 | 459 | auto output = config->outputs[i]; | 452 | std::lock_guard<decltype(mutex)> lock(mutex); |
270 | 460 | auto display_request = request.add_display_output(); | 453 | |
271 | 461 | display_request->set_output_id(output.output_id); | 454 | for (auto i=0u; i < config->num_outputs; i++) |
272 | 462 | display_request->set_used(output.used); | 455 | { |
273 | 463 | display_request->set_current_mode(output.current_mode); | 456 | auto output = config->outputs[i]; |
274 | 464 | display_request->set_position_x(output.position_x); | 457 | auto display_request = request.add_display_output(); |
275 | 465 | display_request->set_position_y(output.position_y); | 458 | display_request->set_output_id(output.output_id); |
276 | 466 | display_request->set_power_mode(output.power_mode); | 459 | display_request->set_used(output.used); |
277 | 460 | display_request->set_current_mode(output.current_mode); | ||
278 | 461 | display_request->set_position_x(output.position_x); | ||
279 | 462 | display_request->set_position_y(output.position_y); | ||
280 | 463 | display_request->set_power_mode(output.power_mode); | ||
281 | 464 | } | ||
282 | 467 | } | 465 | } |
283 | 468 | 466 | ||
284 | 469 | server.configure_display(0, &request, &display_configuration_response, | 467 | server.configure_display(0, &request, &display_configuration_response, |
285 | @@ -475,6 +473,8 @@ | |||
286 | 475 | bool MirConnection::set_extra_platform_data( | 473 | bool MirConnection::set_extra_platform_data( |
287 | 476 | std::vector<int> const& extra_platform_data_arg) | 474 | std::vector<int> const& extra_platform_data_arg) |
288 | 477 | { | 475 | { |
289 | 476 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
290 | 477 | |||
291 | 478 | auto const total_data_size = | 478 | auto const total_data_size = |
292 | 479 | connect_result.platform().data_size() + extra_platform_data_arg.size(); | 479 | connect_result.platform().data_size() + extra_platform_data_arg.size(); |
293 | 480 | 480 | ||
294 | 481 | 481 | ||
295 | === modified file 'src/client/mir_connection.h' | |||
296 | --- src/client/mir_connection.h 2013-12-20 05:06:28 +0000 | |||
297 | +++ src/client/mir_connection.h 2014-01-07 15:59:47 +0000 | |||
298 | @@ -69,7 +69,7 @@ | |||
299 | 69 | struct MirConnection : mir::client::ClientContext | 69 | struct MirConnection : mir::client::ClientContext |
300 | 70 | { | 70 | { |
301 | 71 | public: | 71 | public: |
303 | 72 | MirConnection(); | 72 | MirConnection(std::string const& error_message); |
304 | 73 | 73 | ||
305 | 74 | MirConnection(mir::client::ConnectionConfiguration& conf); | 74 | MirConnection(mir::client::ConnectionConfiguration& conf); |
306 | 75 | ~MirConnection() noexcept; | 75 | ~MirConnection() noexcept; |
307 | @@ -87,7 +87,6 @@ | |||
308 | 87 | void *context); | 87 | void *context); |
309 | 88 | 88 | ||
310 | 89 | char const * get_error_message(); | 89 | char const * get_error_message(); |
311 | 90 | void set_error_message(std::string const& error); | ||
312 | 91 | 90 | ||
313 | 92 | MirWaitHandle* connect( | 91 | MirWaitHandle* connect( |
314 | 93 | const char* app_name, | 92 | const char* app_name, |
315 | @@ -125,7 +124,7 @@ | |||
316 | 125 | bool set_extra_platform_data(std::vector<int> const& extra_platform_data); | 124 | bool set_extra_platform_data(std::vector<int> const& extra_platform_data); |
317 | 126 | 125 | ||
318 | 127 | private: | 126 | private: |
320 | 128 | std::recursive_mutex mutex; // Protects all members of *this | 127 | std::mutex mutex; // Protects all members of *this (except release_wait_handles) |
321 | 129 | 128 | ||
322 | 130 | std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> channel; | 129 | std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> channel; |
323 | 131 | mir::protobuf::DisplayServer::Stub server; | 130 | mir::protobuf::DisplayServer::Stub server; |
324 | @@ -163,6 +162,7 @@ | |||
325 | 163 | 162 | ||
326 | 164 | struct SurfaceRelease; | 163 | struct SurfaceRelease; |
327 | 165 | 164 | ||
328 | 165 | void set_error_message(std::string const& error); | ||
329 | 166 | void done_disconnect(); | 166 | void done_disconnect(); |
330 | 167 | void connected(mir_connected_callback callback, void * context); | 167 | void connected(mir_connected_callback callback, void * context); |
331 | 168 | void released(SurfaceRelease ); | 168 | void released(SurfaceRelease ); |
332 | 169 | 169 | ||
333 | === modified file 'src/client/mir_surface.cpp' | |||
334 | --- src/client/mir_surface.cpp 2014-01-03 05:37:54 +0000 | |||
335 | +++ src/client/mir_surface.cpp 2014-01-07 15:59:47 +0000 | |||
336 | @@ -64,7 +64,7 @@ | |||
337 | 64 | 64 | ||
338 | 65 | MirSurface::~MirSurface() | 65 | MirSurface::~MirSurface() |
339 | 66 | { | 66 | { |
341 | 67 | std::lock_guard<std::recursive_mutex> lock(mutex); | 67 | std::lock_guard<decltype(mutex)> lock(mutex); |
342 | 68 | 68 | ||
343 | 69 | if (input_thread) | 69 | if (input_thread) |
344 | 70 | { | 70 | { |
345 | @@ -80,7 +80,7 @@ | |||
346 | 80 | 80 | ||
347 | 81 | MirSurfaceParameters MirSurface::get_parameters() const | 81 | MirSurfaceParameters MirSurface::get_parameters() const |
348 | 82 | { | 82 | { |
350 | 83 | std::lock_guard<std::recursive_mutex> lock(mutex); | 83 | std::lock_guard<decltype(mutex)> lock(mutex); |
351 | 84 | 84 | ||
352 | 85 | return MirSurfaceParameters { | 85 | return MirSurfaceParameters { |
353 | 86 | 0, | 86 | 0, |
354 | @@ -93,7 +93,7 @@ | |||
355 | 93 | 93 | ||
356 | 94 | char const * MirSurface::get_error_message() | 94 | char const * MirSurface::get_error_message() |
357 | 95 | { | 95 | { |
359 | 96 | std::lock_guard<std::recursive_mutex> lock(mutex); | 96 | std::lock_guard<decltype(mutex)> lock(mutex); |
360 | 97 | 97 | ||
361 | 98 | if (surface.has_error()) | 98 | if (surface.has_error()) |
362 | 99 | { | 99 | { |
363 | @@ -104,21 +104,21 @@ | |||
364 | 104 | 104 | ||
365 | 105 | int MirSurface::id() const | 105 | int MirSurface::id() const |
366 | 106 | { | 106 | { |
368 | 107 | std::lock_guard<std::recursive_mutex> lock(mutex); | 107 | std::lock_guard<decltype(mutex)> lock(mutex); |
369 | 108 | 108 | ||
370 | 109 | return surface.id().value(); | 109 | return surface.id().value(); |
371 | 110 | } | 110 | } |
372 | 111 | 111 | ||
373 | 112 | bool MirSurface::is_valid() const | 112 | bool MirSurface::is_valid() const |
374 | 113 | { | 113 | { |
376 | 114 | std::lock_guard<std::recursive_mutex> lock(mutex); | 114 | std::lock_guard<decltype(mutex)> lock(mutex); |
377 | 115 | 115 | ||
378 | 116 | return !surface.has_error(); | 116 | return !surface.has_error(); |
379 | 117 | } | 117 | } |
380 | 118 | 118 | ||
381 | 119 | void MirSurface::get_cpu_region(MirGraphicsRegion& region_out) | 119 | void MirSurface::get_cpu_region(MirGraphicsRegion& region_out) |
382 | 120 | { | 120 | { |
384 | 121 | std::lock_guard<std::recursive_mutex> lock(mutex); | 121 | std::lock_guard<decltype(mutex)> lock(mutex); |
385 | 122 | 122 | ||
386 | 123 | auto buffer = buffer_depository->current_buffer(); | 123 | auto buffer = buffer_depository->current_buffer(); |
387 | 124 | 124 | ||
388 | @@ -132,21 +132,21 @@ | |||
389 | 132 | 132 | ||
390 | 133 | void MirSurface::release_cpu_region() | 133 | void MirSurface::release_cpu_region() |
391 | 134 | { | 134 | { |
392 | 135 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
393 | 136 | |||
394 | 137 | secured_region.reset(); | 135 | secured_region.reset(); |
395 | 138 | } | 136 | } |
396 | 139 | 137 | ||
397 | 140 | MirWaitHandle* MirSurface::next_buffer(mir_surface_callback callback, void * context) | 138 | MirWaitHandle* MirSurface::next_buffer(mir_surface_callback callback, void * context) |
398 | 141 | { | 139 | { |
401 | 142 | std::lock_guard<std::recursive_mutex> lock(mutex); | 140 | std::unique_lock<decltype(mutex)> lock(mutex); |
400 | 143 | |||
402 | 144 | release_cpu_region(); | 141 | release_cpu_region(); |
403 | 142 | auto const id = &surface.id(); | ||
404 | 143 | auto const mutable_buffer = surface.mutable_buffer(); | ||
405 | 144 | lock.unlock(); | ||
406 | 145 | 145 | ||
407 | 146 | server.next_buffer( | 146 | server.next_buffer( |
408 | 147 | 0, | 147 | 0, |
411 | 148 | &surface.id(), | 148 | id, |
412 | 149 | surface.mutable_buffer(), | 149 | mutable_buffer, |
413 | 150 | google::protobuf::NewCallback(this, &MirSurface::new_buffer, callback, context)); | 150 | google::protobuf::NewCallback(this, &MirSurface::new_buffer, callback, context)); |
414 | 151 | 151 | ||
415 | 152 | return &next_buffer_wait_handle; | 152 | return &next_buffer_wait_handle; |
416 | @@ -166,8 +166,6 @@ | |||
417 | 166 | 166 | ||
418 | 167 | void MirSurface::process_incoming_buffer() | 167 | void MirSurface::process_incoming_buffer() |
419 | 168 | { | 168 | { |
420 | 169 | std::lock_guard<std::recursive_mutex> lock(mutex); | ||
421 | 170 | |||
422 | 171 | auto const& buffer = surface.buffer(); | 169 | auto const& buffer = surface.buffer(); |
423 | 172 | 170 | ||
424 | 173 | /* | 171 | /* |
425 | @@ -201,17 +199,16 @@ | |||
426 | 201 | 199 | ||
427 | 202 | void MirSurface::created(mir_surface_callback callback, void * context) | 200 | void MirSurface::created(mir_surface_callback callback, void * context) |
428 | 203 | { | 201 | { |
429 | 202 | auto platform = connection->get_client_platform(); | ||
430 | 203 | |||
431 | 204 | { | 204 | { |
433 | 205 | std::lock_guard<std::recursive_mutex> lock(mutex); | 205 | std::lock_guard<decltype(mutex)> lock(mutex); |
434 | 206 | 206 | ||
435 | 207 | process_incoming_buffer(); | 207 | process_incoming_buffer(); |
436 | 208 | |||
437 | 209 | auto platform = connection->get_client_platform(); | ||
438 | 210 | accelerated_window = platform->create_egl_native_window(this); | 208 | accelerated_window = platform->create_egl_native_window(this); |
439 | 211 | |||
440 | 212 | connection->on_surface_created(id(), this); | ||
441 | 213 | } | 209 | } |
442 | 214 | 210 | ||
443 | 211 | connection->on_surface_created(id(), this); | ||
444 | 215 | callback(this, context); | 212 | callback(this, context); |
445 | 216 | create_wait_handle.result_received(); | 213 | create_wait_handle.result_received(); |
446 | 217 | } | 214 | } |
447 | @@ -219,7 +216,7 @@ | |||
448 | 219 | void MirSurface::new_buffer(mir_surface_callback callback, void * context) | 216 | void MirSurface::new_buffer(mir_surface_callback callback, void * context) |
449 | 220 | { | 217 | { |
450 | 221 | { | 218 | { |
452 | 222 | std::lock_guard<std::recursive_mutex> lock(mutex); | 219 | std::lock_guard<decltype(mutex)> lock(mutex); |
453 | 223 | process_incoming_buffer(); | 220 | process_incoming_buffer(); |
454 | 224 | } | 221 | } |
455 | 225 | 222 | ||
456 | @@ -244,23 +241,21 @@ | |||
457 | 244 | 241 | ||
458 | 245 | std::shared_ptr<mcl::ClientBuffer> MirSurface::get_current_buffer() | 242 | std::shared_ptr<mcl::ClientBuffer> MirSurface::get_current_buffer() |
459 | 246 | { | 243 | { |
461 | 247 | std::lock_guard<std::recursive_mutex> lock(mutex); | 244 | std::lock_guard<decltype(mutex)> lock(mutex); |
462 | 248 | 245 | ||
463 | 249 | return buffer_depository->current_buffer(); | 246 | return buffer_depository->current_buffer(); |
464 | 250 | } | 247 | } |
465 | 251 | 248 | ||
466 | 252 | uint32_t MirSurface::get_current_buffer_id() const | 249 | uint32_t MirSurface::get_current_buffer_id() const |
467 | 253 | { | 250 | { |
469 | 254 | std::lock_guard<std::recursive_mutex> lock(mutex); | 251 | std::lock_guard<decltype(mutex)> lock(mutex); |
470 | 255 | 252 | ||
471 | 256 | return buffer_depository->current_buffer_id(); | 253 | return buffer_depository->current_buffer_id(); |
472 | 257 | } | 254 | } |
473 | 258 | 255 | ||
474 | 259 | void MirSurface::populate(MirBufferPackage& buffer_package) | 256 | void MirSurface::populate(MirBufferPackage& buffer_package) |
475 | 260 | { | 257 | { |
479 | 261 | std::lock_guard<std::recursive_mutex> lock(mutex); | 258 | if (!surface.has_error() && surface.has_buffer()) |
477 | 262 | |||
478 | 263 | if (is_valid() && surface.has_buffer()) | ||
480 | 264 | { | 259 | { |
481 | 265 | auto const& buffer = surface.buffer(); | 260 | auto const& buffer = surface.buffer(); |
482 | 266 | 261 | ||
483 | @@ -292,19 +287,19 @@ | |||
484 | 292 | 287 | ||
485 | 293 | EGLNativeWindowType MirSurface::generate_native_window() | 288 | EGLNativeWindowType MirSurface::generate_native_window() |
486 | 294 | { | 289 | { |
488 | 295 | std::lock_guard<std::recursive_mutex> lock(mutex); | 290 | std::lock_guard<decltype(mutex)> lock(mutex); |
489 | 296 | 291 | ||
490 | 297 | return *accelerated_window; | 292 | return *accelerated_window; |
491 | 298 | } | 293 | } |
492 | 299 | 294 | ||
493 | 300 | MirWaitHandle* MirSurface::configure(MirSurfaceAttrib at, int value) | 295 | MirWaitHandle* MirSurface::configure(MirSurfaceAttrib at, int value) |
494 | 301 | { | 296 | { |
497 | 302 | std::lock_guard<std::recursive_mutex> lock(mutex); | 297 | std::unique_lock<decltype(mutex)> lock(mutex); |
496 | 303 | |||
498 | 304 | mp::SurfaceSetting setting; | 298 | mp::SurfaceSetting setting; |
499 | 305 | setting.mutable_surfaceid()->CopyFrom(surface.id()); | 299 | setting.mutable_surfaceid()->CopyFrom(surface.id()); |
500 | 306 | setting.set_attrib(at); | 300 | setting.set_attrib(at); |
501 | 307 | setting.set_ivalue(value); | 301 | setting.set_ivalue(value); |
502 | 302 | lock.unlock(); | ||
503 | 308 | 303 | ||
504 | 309 | configure_wait_handle.expect_result(); | 304 | configure_wait_handle.expect_result(); |
505 | 310 | server.configure_surface(0, &setting, &configure_result, | 305 | server.configure_surface(0, &setting, &configure_result, |
506 | @@ -315,7 +310,7 @@ | |||
507 | 315 | 310 | ||
508 | 316 | void MirSurface::on_configured() | 311 | void MirSurface::on_configured() |
509 | 317 | { | 312 | { |
511 | 318 | std::lock_guard<std::recursive_mutex> lock(mutex); | 313 | std::lock_guard<decltype(mutex)> lock(mutex); |
512 | 319 | 314 | ||
513 | 320 | if (configure_result.has_surfaceid() && | 315 | if (configure_result.has_surfaceid() && |
514 | 321 | configure_result.surfaceid().value() == surface.id().value() && | 316 | configure_result.surfaceid().value() == surface.id().value() && |
515 | @@ -345,14 +340,14 @@ | |||
516 | 345 | 340 | ||
517 | 346 | int MirSurface::attrib(MirSurfaceAttrib at) const | 341 | int MirSurface::attrib(MirSurfaceAttrib at) const |
518 | 347 | { | 342 | { |
520 | 348 | std::lock_guard<std::recursive_mutex> lock(mutex); | 343 | std::lock_guard<decltype(mutex)> lock(mutex); |
521 | 349 | 344 | ||
522 | 350 | return attrib_cache[at]; | 345 | return attrib_cache[at]; |
523 | 351 | } | 346 | } |
524 | 352 | 347 | ||
525 | 353 | void MirSurface::set_event_handler(MirEventDelegate const* delegate) | 348 | void MirSurface::set_event_handler(MirEventDelegate const* delegate) |
526 | 354 | { | 349 | { |
528 | 355 | std::lock_guard<std::recursive_mutex> lock(mutex); | 350 | std::lock_guard<decltype(mutex)> lock(mutex); |
529 | 356 | 351 | ||
530 | 357 | if (input_thread) | 352 | if (input_thread) |
531 | 358 | { | 353 | { |
532 | @@ -378,7 +373,7 @@ | |||
533 | 378 | 373 | ||
534 | 379 | void MirSurface::handle_event(MirEvent const& e) | 374 | void MirSurface::handle_event(MirEvent const& e) |
535 | 380 | { | 375 | { |
537 | 381 | std::unique_lock<std::recursive_mutex> lock(mutex); | 376 | std::unique_lock<decltype(mutex)> lock(mutex); |
538 | 382 | 377 | ||
539 | 383 | if (e.type == mir_event_type_surface) | 378 | if (e.type == mir_event_type_surface) |
540 | 384 | { | 379 | { |
541 | @@ -397,7 +392,7 @@ | |||
542 | 397 | 392 | ||
543 | 398 | MirPlatformType MirSurface::platform_type() | 393 | MirPlatformType MirSurface::platform_type() |
544 | 399 | { | 394 | { |
546 | 400 | std::lock_guard<std::recursive_mutex> lock(mutex); | 395 | std::lock_guard<decltype(mutex)> lock(mutex); |
547 | 401 | 396 | ||
548 | 402 | auto platform = connection->get_client_platform(); | 397 | auto platform = connection->get_client_platform(); |
549 | 403 | return platform->platform_type(); | 398 | return platform->platform_type(); |
550 | 404 | 399 | ||
551 | === modified file 'src/client/mir_surface.h' | |||
552 | --- src/client/mir_surface.h 2013-12-18 02:19:19 +0000 | |||
553 | +++ src/client/mir_surface.h 2014-01-07 15:59:47 +0000 | |||
554 | @@ -83,7 +83,6 @@ | |||
555 | 83 | std::shared_ptr<mir::client::ClientBuffer> get_current_buffer(); | 83 | std::shared_ptr<mir::client::ClientBuffer> get_current_buffer(); |
556 | 84 | uint32_t get_current_buffer_id() const; | 84 | uint32_t get_current_buffer_id() const; |
557 | 85 | void get_cpu_region(MirGraphicsRegion& region); | 85 | void get_cpu_region(MirGraphicsRegion& region); |
558 | 86 | void release_cpu_region(); | ||
559 | 87 | EGLNativeWindowType generate_native_window(); | 86 | EGLNativeWindowType generate_native_window(); |
560 | 88 | 87 | ||
561 | 89 | MirWaitHandle* configure(MirSurfaceAttrib a, int value); | 88 | MirWaitHandle* configure(MirSurfaceAttrib a, int value); |
562 | @@ -93,7 +92,7 @@ | |||
563 | 93 | void handle_event(MirEvent const& e); | 92 | void handle_event(MirEvent const& e); |
564 | 94 | 93 | ||
565 | 95 | private: | 94 | private: |
567 | 96 | mutable std::recursive_mutex mutex; // Protects all members of *this | 95 | mutable std::mutex mutex; // Protects all members of *this |
568 | 97 | 96 | ||
569 | 98 | void on_configured(); | 97 | void on_configured(); |
570 | 99 | void process_incoming_buffer(); | 98 | void process_incoming_buffer(); |
571 | @@ -101,6 +100,7 @@ | |||
572 | 101 | void created(mir_surface_callback callback, void * context); | 100 | void created(mir_surface_callback callback, void * context); |
573 | 102 | void new_buffer(mir_surface_callback callback, void * context); | 101 | void new_buffer(mir_surface_callback callback, void * context); |
574 | 103 | MirPixelFormat convert_ipc_pf_to_geometry(google::protobuf::int32 pf); | 102 | MirPixelFormat convert_ipc_pf_to_geometry(google::protobuf::int32 pf); |
575 | 103 | void release_cpu_region(); | ||
576 | 104 | 104 | ||
577 | 105 | /* todo: race condition. protobuf does not guarantee that callbacks will be synchronized. potential | 105 | /* todo: race condition. protobuf does not guarantee that callbacks will be synchronized. potential |
578 | 106 | race in surface, last_buffer_id */ | 106 | race in surface, last_buffer_id */ |
579 | @@ -108,7 +108,7 @@ | |||
580 | 108 | mir::protobuf::Surface surface; | 108 | mir::protobuf::Surface surface; |
581 | 109 | std::string error_message; | 109 | std::string error_message; |
582 | 110 | 110 | ||
584 | 111 | MirConnection *connection; | 111 | MirConnection* const connection; |
585 | 112 | MirWaitHandle create_wait_handle; | 112 | MirWaitHandle create_wait_handle; |
586 | 113 | MirWaitHandle next_buffer_wait_handle; | 113 | MirWaitHandle next_buffer_wait_handle; |
587 | 114 | MirWaitHandle configure_wait_handle; | 114 | MirWaitHandle configure_wait_handle; |
588 | 115 | 115 | ||
589 | === modified file 'src/client/rpc/mir_basic_rpc_channel.cpp' | |||
590 | --- src/client/rpc/mir_basic_rpc_channel.cpp 2013-09-26 13:23:44 +0000 | |||
591 | +++ src/client/rpc/mir_basic_rpc_channel.cpp 2014-01-07 15:59:47 +0000 | |||
592 | @@ -33,40 +33,39 @@ | |||
593 | 33 | { | 33 | { |
594 | 34 | } | 34 | } |
595 | 35 | 35 | ||
597 | 36 | mclrd::SendBuffer& mclrd::PendingCallCache::save_completion_details( | 36 | void mclrd::PendingCallCache::save_completion_details( |
598 | 37 | mir::protobuf::wire::Invocation& invoke, | 37 | mir::protobuf::wire::Invocation& invoke, |
599 | 38 | google::protobuf::Message* response, | 38 | google::protobuf::Message* response, |
600 | 39 | std::shared_ptr<google::protobuf::Closure> const& complete) | 39 | std::shared_ptr<google::protobuf::Closure> const& complete) |
601 | 40 | { | 40 | { |
602 | 41 | std::unique_lock<std::mutex> lock(mutex); | 41 | std::unique_lock<std::mutex> lock(mutex); |
603 | 42 | 42 | ||
606 | 43 | auto& current = pending_calls[invoke.id()] = PendingCall(response, complete); | 43 | pending_calls[invoke.id()] = PendingCall(response, complete); |
605 | 44 | return current.send_buffer; | ||
607 | 45 | } | 44 | } |
608 | 46 | 45 | ||
609 | 47 | void mclrd::PendingCallCache::complete_response(mir::protobuf::wire::Result& result) | 46 | void mclrd::PendingCallCache::complete_response(mir::protobuf::wire::Result& result) |
610 | 48 | { | 47 | { |
614 | 49 | std::unique_lock<std::mutex> lock(mutex); | 48 | PendingCall completion; |
615 | 50 | auto call = pending_calls.find(result.id()); | 49 | |
616 | 51 | if (call == pending_calls.end()) | 50 | { |
617 | 51 | std::unique_lock<std::mutex> lock(mutex); | ||
618 | 52 | auto call = pending_calls.find(result.id()); | ||
619 | 53 | if (call != pending_calls.end()) | ||
620 | 54 | { | ||
621 | 55 | completion = call->second; | ||
622 | 56 | pending_calls.erase(call); | ||
623 | 57 | } | ||
624 | 58 | } | ||
625 | 59 | |||
626 | 60 | if (!completion.complete) | ||
627 | 52 | { | 61 | { |
628 | 53 | rpc_report->orphaned_result(result); | 62 | rpc_report->orphaned_result(result); |
629 | 54 | } | 63 | } |
630 | 55 | else | 64 | else |
631 | 56 | { | 65 | { |
632 | 57 | auto& completion = call->second; | ||
633 | 58 | |||
634 | 59 | rpc_report->complete_response(result); | 66 | rpc_report->complete_response(result); |
635 | 60 | |||
636 | 61 | completion.response->ParseFromString(result.response()); | 67 | completion.response->ParseFromString(result.response()); |
645 | 62 | 68 | completion.complete->Run(); | |
638 | 63 | // Let the completion closure live a bit longer than our lock... | ||
639 | 64 | std::shared_ptr<google::protobuf::Closure> complete = | ||
640 | 65 | completion.complete; | ||
641 | 66 | pending_calls.erase(call); | ||
642 | 67 | |||
643 | 68 | lock.unlock(); // Avoid deadlocks in callbacks | ||
644 | 69 | complete->Run(); | ||
646 | 70 | } | 69 | } |
647 | 71 | } | 70 | } |
648 | 72 | 71 | ||
649 | 73 | 72 | ||
650 | === modified file 'src/client/rpc/mir_basic_rpc_channel.h' | |||
651 | --- src/client/rpc/mir_basic_rpc_channel.h 2013-09-26 13:23:44 +0000 | |||
652 | +++ src/client/rpc/mir_basic_rpc_channel.h 2014-01-07 15:59:47 +0000 | |||
653 | @@ -54,7 +54,7 @@ | |||
654 | 54 | public: | 54 | public: |
655 | 55 | PendingCallCache(std::shared_ptr<RpcReport> const& rpc_report); | 55 | PendingCallCache(std::shared_ptr<RpcReport> const& rpc_report); |
656 | 56 | 56 | ||
658 | 57 | SendBuffer& save_completion_details( | 57 | void save_completion_details( |
659 | 58 | mir::protobuf::wire::Invocation& invoke, | 58 | mir::protobuf::wire::Invocation& invoke, |
660 | 59 | google::protobuf::Message* response, | 59 | google::protobuf::Message* response, |
661 | 60 | std::shared_ptr<google::protobuf::Closure> const& complete); | 60 | std::shared_ptr<google::protobuf::Closure> const& complete); |
662 | @@ -78,7 +78,6 @@ | |||
663 | 78 | PendingCall() | 78 | PendingCall() |
664 | 79 | : response(0), complete() {} | 79 | : response(0), complete() {} |
665 | 80 | 80 | ||
666 | 81 | SendBuffer send_buffer; | ||
667 | 82 | google::protobuf::Message* response; | 81 | google::protobuf::Message* response; |
668 | 83 | std::shared_ptr<google::protobuf::Closure> complete; | 82 | std::shared_ptr<google::protobuf::Closure> complete; |
669 | 84 | }; | 83 | }; |
670 | 85 | 84 | ||
671 | === modified file 'src/client/rpc/mir_socket_rpc_channel.cpp' | |||
672 | --- src/client/rpc/mir_socket_rpc_channel.cpp 2013-12-18 02:19:19 +0000 | |||
673 | +++ src/client/rpc/mir_socket_rpc_channel.cpp 2014-01-07 15:59:47 +0000 | |||
674 | @@ -267,15 +267,14 @@ | |||
675 | 267 | google::protobuf::NewPermanentCallback(this, &MirSocketRpcChannel::receive_file_descriptors, response, complete)); | 267 | google::protobuf::NewPermanentCallback(this, &MirSocketRpcChannel::receive_file_descriptors, response, complete)); |
676 | 268 | 268 | ||
677 | 269 | // Only save details after serialization succeeds | 269 | // Only save details after serialization succeeds |
679 | 270 | auto& send_buffer = pending_calls.save_completion_details(invocation, response, callback); | 270 | pending_calls.save_completion_details(invocation, response, callback); |
680 | 271 | 271 | ||
681 | 272 | // Only send message when details saved for handling response | 272 | // Only send message when details saved for handling response |
683 | 273 | send_message(invocation, send_buffer, invocation); | 273 | send_message(invocation, invocation); |
684 | 274 | } | 274 | } |
685 | 275 | 275 | ||
686 | 276 | void mclr::MirSocketRpcChannel::send_message( | 276 | void mclr::MirSocketRpcChannel::send_message( |
687 | 277 | mir::protobuf::wire::Invocation const& body, | 277 | mir::protobuf::wire::Invocation const& body, |
688 | 278 | detail::SendBuffer& send_buffer, | ||
689 | 279 | mir::protobuf::wire::Invocation const& invocation) | 278 | mir::protobuf::wire::Invocation const& invocation) |
690 | 280 | { | 279 | { |
691 | 281 | const size_t size = body.ByteSize(); | 280 | const size_t size = body.ByteSize(); |
692 | @@ -285,7 +284,7 @@ | |||
693 | 285 | static_cast<unsigned char>((size >> 0) & 0xff) | 284 | static_cast<unsigned char>((size >> 0) & 0xff) |
694 | 286 | }; | 285 | }; |
695 | 287 | 286 | ||
697 | 288 | send_buffer.resize(sizeof header_bytes + size); | 287 | detail::SendBuffer send_buffer(sizeof header_bytes + size); |
698 | 289 | std::copy(header_bytes, header_bytes + sizeof header_bytes, send_buffer.begin()); | 288 | std::copy(header_bytes, header_bytes + sizeof header_bytes, send_buffer.begin()); |
699 | 290 | body.SerializeToArray(send_buffer.data() + sizeof header_bytes, size); | 289 | body.SerializeToArray(send_buffer.data() + sizeof header_bytes, size); |
700 | 291 | 290 | ||
701 | 292 | 291 | ||
702 | === modified file 'src/client/rpc/mir_socket_rpc_channel.h' | |||
703 | --- src/client/rpc/mir_socket_rpc_channel.h 2013-12-18 02:19:19 +0000 | |||
704 | +++ src/client/rpc/mir_socket_rpc_channel.h 2014-01-07 15:59:47 +0000 | |||
705 | @@ -83,7 +83,7 @@ | |||
706 | 83 | 83 | ||
707 | 84 | void receive_file_descriptors(google::protobuf::Message* response, google::protobuf::Closure* complete); | 84 | void receive_file_descriptors(google::protobuf::Message* response, google::protobuf::Closure* complete); |
708 | 85 | void receive_file_descriptors(std::vector<int> &fds); | 85 | void receive_file_descriptors(std::vector<int> &fds); |
710 | 86 | void send_message(mir::protobuf::wire::Invocation const& body, detail::SendBuffer& buffer, | 86 | void send_message(mir::protobuf::wire::Invocation const& body, |
711 | 87 | mir::protobuf::wire::Invocation const& invocation); | 87 | mir::protobuf::wire::Invocation const& invocation); |
712 | 88 | void on_header_read(const boost::system::error_code& error); | 88 | void on_header_read(const boost::system::error_code& error); |
713 | 89 | 89 | ||
714 | 90 | 90 | ||
715 | === modified file 'tests/acceptance-tests/test_client_focus_notification.cpp' | |||
716 | --- tests/acceptance-tests/test_client_focus_notification.cpp 2013-12-18 02:19:19 +0000 | |||
717 | +++ tests/acceptance-tests/test_client_focus_notification.cpp 2014-01-07 15:59:47 +0000 | |||
718 | @@ -136,7 +136,7 @@ | |||
719 | 136 | 136 | ||
720 | 137 | } | 137 | } |
721 | 138 | 138 | ||
723 | 139 | TEST_F(BespokeDisplayServerTestFixture, two_scene_are_notified_of_gaining_and_losing_focus) | 139 | TEST_F(BespokeDisplayServerTestFixture, two_surfaces_are_notified_of_gaining_and_losing_focus) |
724 | 140 | { | 140 | { |
725 | 141 | using namespace ::testing; | 141 | using namespace ::testing; |
726 | 142 | 142 |
FAILED: Continuous integration, rev:1309 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- ci/572/ jenkins. qa.ubuntu. com/job/ mir-android- trusty- i386-build/ 507 jenkins. qa.ubuntu. com/job/ mir-clang- trusty- amd64-build/ 503 jenkins. qa.ubuntu. com/job/ mir-mediumtests -trusty- touch/111/ console jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- amd64-ci/ 298 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- amd64-ci/ 298/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- armhf-ci/ 301 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- armhf-ci/ 301/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- trusty- armhf/111 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- trusty- armhf/111/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/139/ console s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 2586
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- team-mir- development- branch- ci/572/ rebuild
http://