Mir

Merge lp:~mir-team/mir/catch-exceptions-at-android-driver-boundary into lp:mir

Proposed by Robert Carr
Status: Merged
Approved by: Robert Carr
Approved revision: no longer in the source branch.
Merged at revision: 2307
Proposed branch: lp:~mir-team/mir/catch-exceptions-at-android-driver-boundary
Merge into: lp:mir
Diff against target: 260 lines (+34/-32)
9 files modified
src/client/mir_buffer_stream_api.cpp (+1/-1)
src/client/mir_connection_api.cpp (+1/-1)
src/client/mir_cursor_api.cpp (+1/-1)
src/client/mir_prompt_session_api.cpp (+1/-1)
src/client/mir_screencast_api.cpp (+1/-1)
src/client/mir_surface_api.cpp (+1/-1)
src/common/graphics/android/mir_native_window.cpp (+13/-14)
src/include/common/mir/uncaught.h (+7/-1)
src/platforms/mesa/client/native_surface.cpp (+8/-11)
To merge this branch: bzr merge lp:~mir-team/mir/catch-exceptions-at-android-driver-boundary
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Review via email: mp+249124@code.launchpad.net

Commit message

Catch exceptions at android driver boundary

Description of the change

See the requirement described at:
https://code.launchpad.net/~mir-team/mir/squash-overzealous-exception-to-accomodate-underzealous-drivers/+merge/249112

It turns out this will only be called on startup so taking the more correct path of throwing and catching the exception is ok.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :
review: Needs Fixing
Revision history for this message
Kevin DuBois (kdub) wrote :

Although, if this is holding up a release, consider the above an 'abstain'

Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/mir_buffer_stream_api.cpp'
2--- src/client/mir_buffer_stream_api.cpp 2015-02-03 10:43:51 +0000
3+++ src/client/mir_buffer_stream_api.cpp 2015-02-09 21:06:09 +0000
4@@ -25,7 +25,7 @@
5
6 #include "mir/client_buffer.h"
7
8-#include "uncaught.h"
9+#include "mir/uncaught.h"
10
11 #include <stdexcept>
12 #include <boost/throw_exception.hpp>
13
14=== modified file 'src/client/mir_connection_api.cpp'
15--- src/client/mir_connection_api.cpp 2015-02-04 15:01:59 +0000
16+++ src/client/mir_connection_api.cpp 2015-02-09 21:06:09 +0000
17@@ -29,7 +29,7 @@
18 #include "default_connection_configuration.h"
19 #include "display_configuration.h"
20 #include "error_connections.h"
21-#include "uncaught.h"
22+#include "mir/uncaught.h"
23
24 // Temporary include to ease client transition from mir_connection_drm* APIs.
25 // to mir_connection_platform_operation().
26
27=== modified file 'src/client/mir_cursor_api.cpp'
28--- src/client/mir_cursor_api.cpp 2015-01-21 07:34:50 +0000
29+++ src/client/mir_cursor_api.cpp 2015-02-09 21:06:09 +0000
30@@ -21,7 +21,7 @@
31 #include "mir_toolkit/mir_cursor_configuration.h"
32 #include "cursor_configuration.h"
33
34-#include "uncaught.h"
35+#include "mir/uncaught.h"
36
37 #include <memory>
38
39
40=== modified file 'src/client/mir_prompt_session_api.cpp'
41--- src/client/mir_prompt_session_api.cpp 2015-01-21 07:34:50 +0000
42+++ src/client/mir_prompt_session_api.cpp 2015-02-09 21:06:09 +0000
43@@ -22,7 +22,7 @@
44 #include "mir_prompt_session.h"
45 #include "mir_connection.h"
46
47-#include "uncaught.h"
48+#include "mir/uncaught.h"
49
50 #include <stdexcept>
51 #include <boost/throw_exception.hpp>
52
53=== modified file 'src/client/mir_screencast_api.cpp'
54--- src/client/mir_screencast_api.cpp 2015-02-05 16:37:37 +0000
55+++ src/client/mir_screencast_api.cpp 2015-02-09 21:06:09 +0000
56@@ -23,7 +23,7 @@
57 #include "mir_connection.h"
58 #include "mir/raii.h"
59
60-#include "uncaught.h"
61+#include "mir/uncaught.h"
62
63 #include <stdexcept>
64 #include <boost/throw_exception.hpp>
65
66=== modified file 'src/client/mir_surface_api.cpp'
67--- src/client/mir_surface_api.cpp 2015-02-04 13:42:03 +0000
68+++ src/client/mir_surface_api.cpp 2015-02-09 21:06:09 +0000
69@@ -25,7 +25,7 @@
70 #include "mir_connection.h"
71 #include "mir_surface.h"
72 #include "error_connections.h"
73-#include "uncaught.h"
74+#include "mir/uncaught.h"
75
76 #include <boost/exception/diagnostic_information.hpp>
77 #include <functional>
78
79=== modified file 'src/common/graphics/android/mir_native_window.cpp'
80--- src/common/graphics/android/mir_native_window.cpp 2015-02-04 08:45:38 +0000
81+++ src/common/graphics/android/mir_native_window.cpp 2015-02-09 21:06:09 +0000
82@@ -20,7 +20,7 @@
83 #include "mir/graphics/android/android_driver_interpreter.h"
84 #include "mir/graphics/android/sync_fence.h"
85
86-#include <boost/exception/diagnostic_information.hpp>
87+#include "mir/uncaught.h"
88
89 #include <iostream>
90
91@@ -123,13 +123,6 @@
92 auto self = static_cast<mga::MirNativeWindow*>(window);
93 return self->cancelBuffer(buffer, fence_fd);
94 }
95-
96-void report_exception_at_driver_boundary(std::exception const& e)
97-{
98- std::cerr << "Caught exception at Mir/EGL driver boundary: "
99- << boost::diagnostic_information(e) << std::endl;
100-}
101-
102 }
103
104 mga::MirNativeWindow::MirNativeWindow(std::shared_ptr<AndroidDriverInterpreter> const& interpreter)
105@@ -154,6 +147,7 @@
106 }
107
108 int mga::MirNativeWindow::setSwapInterval(int interval)
109+try
110 {
111 if (interval == 0)
112 {
113@@ -165,6 +159,11 @@
114 }
115 return 0;
116 }
117+catch (std::exception const& e)
118+{
119+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
120+ return -1;
121+}
122
123 int mga::MirNativeWindow::dequeueBuffer(struct ANativeWindowBuffer** buffer_to_driver, int* fence_fd)
124 try
125@@ -187,7 +186,7 @@
126 }
127 catch (std::exception const& e)
128 {
129- report_exception_at_driver_boundary(e);
130+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
131 return -1;
132 }
133
134@@ -209,7 +208,7 @@
135 }
136 catch (std::exception const& e)
137 {
138- report_exception_at_driver_boundary(e);
139+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
140 return -1;
141 }
142
143@@ -221,7 +220,7 @@
144 }
145 catch (std::exception const& e)
146 {
147- report_exception_at_driver_boundary(e);
148+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
149 return -1;
150 }
151
152@@ -236,7 +235,7 @@
153 }
154 catch (std::exception const& e)
155 {
156- report_exception_at_driver_boundary(e);
157+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
158 return -1;
159 }
160
161@@ -248,7 +247,7 @@
162 }
163 catch (std::exception const& e)
164 {
165- report_exception_at_driver_boundary(e);
166+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
167 return -1;
168 }
169
170@@ -275,6 +274,6 @@
171 }
172 catch (std::exception const& e)
173 {
174- report_exception_at_driver_boundary(e);
175+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
176 return -1;
177 }
178
179=== renamed file 'src/client/uncaught.h' => 'src/include/common/mir/uncaught.h'
180--- src/client/uncaught.h 2015-01-05 16:36:29 +0000
181+++ src/include/common/mir/uncaught.h 2015-02-09 21:06:09 +0000
182@@ -19,10 +19,16 @@
183 #ifndef MIR_CLIENT_API_HELPERS_H_
184 #define MIR_CLIENT_API_HELPERS_H_
185
186+#include <boost/exception/diagnostic_information.hpp>
187+
188 #include "mir/log.h"
189
190 #define MIR_LOG_UNCAUGHT_EXCEPTION(ex) { \
191 mir::log_error("Caught exception at client library boundary (in %s): %s", \
192- __FUNCTION__, ex.what()); }
193+ __FUNCTION__, boost::diagnostic_information(ex).c_str()); }
194+
195+#define MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(ex) { \
196+ mir::log_error("Caught exception at Mir/EGL driver boundary (in %s): %s", \
197+ __FUNCTION__, boost::diagnostic_information(ex).c_str()); }
198
199 #endif // MIR_CLIENT_API_HELPERS_H_
200
201=== modified file 'src/platforms/mesa/client/native_surface.cpp'
202--- src/platforms/mesa/client/native_surface.cpp 2015-02-04 08:45:38 +0000
203+++ src/platforms/mesa/client/native_surface.cpp 2015-02-09 21:06:09 +0000
204@@ -16,12 +16,15 @@
205 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
206 */
207
208+#define MIR_LOG_COMPONENT "Mesa/NativeSurface"
209+
210 #include <cstring>
211+
212 #include "mir/client_buffer.h"
213+#include "mir/uncaught.h"
214+
215 #include "native_surface.h"
216
217-#include <boost/exception/diagnostic_information.hpp>
218-
219 namespace mclm=mir::client::mesa;
220
221 namespace
222@@ -45,12 +48,6 @@
223 auto s = static_cast<mclm::NativeSurface*>(surface);
224 return s->set_swapinterval(interval);
225 }
226-
227-void report_exception_at_driver_boundary(std::exception const& e)
228-{
229- std::cerr << "Caught exception at Mir/EGL driver boundary: "
230- << boost::diagnostic_information(e) << std::endl;
231-}
232 }
233
234 mclm::NativeSurface::NativeSurface(EGLNativeSurface& surface)
235@@ -83,7 +80,7 @@
236 }
237 catch (std::exception const& e)
238 {
239- report_exception_at_driver_boundary(e);
240+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
241 return MIR_MESA_FALSE;
242 }
243
244@@ -96,7 +93,7 @@
245 }
246 catch (std::exception const& e)
247 {
248- report_exception_at_driver_boundary(e);
249+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
250 return MIR_MESA_FALSE;
251 }
252
253@@ -111,6 +108,6 @@
254 }
255 catch (std::exception const& e)
256 {
257- report_exception_at_driver_boundary(e);
258+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
259 return MIR_MESA_FALSE;
260 }

Subscribers

People subscribed via source and target branches