Merge lp:~alan-griffiths/mir/remove-force_requests_to_complete into lp:mir
- remove-force_requests_to_complete
- Merge into development-branch
Proposed by
Alan Griffiths
Status: | Work in progress |
---|---|
Proposed branch: | lp:~alan-griffiths/mir/remove-force_requests_to_complete |
Merge into: | lp:mir |
Prerequisite: | lp:~alan-griffiths/mir/SwitchingBundle-controls-completion-of-client_acquire-without-blocking |
Diff against target: |
1020 lines (+76/-217) 34 files modified
examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+0/-2) include/server/mir/compositor/buffer_stream.h (+0/-1) include/server/mir/default_server_configuration.h (+0/-1) include/server/mir/frontend/surface.h (+0/-2) include/server/mir/shell/session.h (+0/-2) include/test/mir_test_doubles/stub_buffer_stream.h (+0/-4) include/test/mir_test_doubles/stub_session.h (+0/-3) include/test/mir_test_doubles/stub_shell_session.h (+0/-3) src/server/compositor/buffer_bundle.h (+0/-1) src/server/compositor/buffer_stream_surfaces.cpp (+0/-6) src/server/compositor/buffer_stream_surfaces.h (+0/-1) src/server/compositor/switching_bundle.cpp (+0/-9) src/server/compositor/switching_bundle.h (+0/-1) src/server/frontend/default_configuration.cpp (+0/-4) src/server/frontend/published_socket_connector.cpp (+1/-10) src/server/frontend/published_socket_connector.h (+0/-3) src/server/frontend/session_mediator.cpp (+9/-5) src/server/frontend/session_mediator.h (+2/-1) src/server/scene/application_session.cpp (+0/-9) src/server/scene/application_session.h (+0/-2) src/server/scene/basic_surface.cpp (+0/-5) src/server/scene/basic_surface.h (+0/-1) src/server/scene/default_configuration.cpp (+0/-13) src/server/scene/surface_impl.cpp (+0/-5) src/server/scene/surface_impl.h (+0/-2) tests/integration-tests/compositor/test_buffer_stream.cpp (+0/-2) tests/integration-tests/test_swapinterval.cpp (+0/-1) tests/mir_test_doubles/test_protobuf_socket_server.cpp (+0/-1) tests/unit-tests/compositor/test_buffer_stream.cpp (+0/-21) tests/unit-tests/compositor/test_switching_bundle.cpp (+0/-4) tests/unit-tests/frontend/test_published_socket_connector.cpp (+0/-17) tests/unit-tests/frontend/test_session_mediator.cpp (+64/-64) tests/unit-tests/scene/test_surface.cpp (+0/-10) tests/unit-tests/scene/test_surface_stack.cpp (+0/-1) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/remove-force_requests_to_complete |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir development team | Pending | ||
Review via email: mp+205173@code.launchpad.net |
Commit message
Strip out all the force_requests_
Description of the change
Strip out all the force_requests_
To post a comment you must log in.
Unmerged revisions
- 1372. By Alan Griffiths
-
Try extending lifetime of session mediator until callback processed
- 1371. By Alan Griffiths
-
merge lp:~alan-griffiths/mir/SwitchingBundle-controls-completion-of-client_acquire-without-blocking
- 1370. By Alan Griffiths
-
Strip out all the force_requests_
to_complete( ) code that became obsolete with lp:~alan-griffiths/mir/SwitchingBundle-controls-completion-of-client_acquire-without-blocking - 1369. By Alan Griffiths
-
merge lp:~alan-griffiths/mir/SwitchingBundle-controls-completion-of-client_acquire-without-blocking
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp' | |||
2 | --- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-01-13 06:12:33 +0000 | |||
3 | +++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-02-06 14:45:58 +0000 | |||
4 | @@ -69,8 +69,6 @@ | |||
5 | 69 | { | 69 | { |
6 | 70 | terminate = true; | 70 | terminate = true; |
7 | 71 | auto session = focus_controller->focussed_application().lock(); | 71 | auto session = focus_controller->focussed_application().lock(); |
8 | 72 | if (session) | ||
9 | 73 | session->force_requests_to_complete(); | ||
10 | 74 | client_thread.join(); | 72 | client_thread.join(); |
11 | 75 | } | 73 | } |
12 | 76 | 74 | ||
13 | 77 | 75 | ||
14 | === modified file 'include/server/mir/compositor/buffer_stream.h' | |||
15 | --- include/server/mir/compositor/buffer_stream.h 2014-02-06 14:45:58 +0000 | |||
16 | +++ include/server/mir/compositor/buffer_stream.h 2014-02-06 14:45:58 +0000 | |||
17 | @@ -49,7 +49,6 @@ | |||
18 | 49 | virtual geometry::Size stream_size() = 0; | 49 | virtual geometry::Size stream_size() = 0; |
19 | 50 | virtual void resize(geometry::Size const& size) = 0; | 50 | virtual void resize(geometry::Size const& size) = 0; |
20 | 51 | virtual void allow_framedropping(bool) = 0; | 51 | virtual void allow_framedropping(bool) = 0; |
21 | 52 | virtual void force_requests_to_complete() = 0; | ||
22 | 53 | }; | 52 | }; |
23 | 54 | 53 | ||
24 | 55 | } | 54 | } |
25 | 56 | 55 | ||
26 | === modified file 'include/server/mir/default_server_configuration.h' | |||
27 | --- include/server/mir/default_server_configuration.h 2014-01-29 18:02:33 +0000 | |||
28 | +++ include/server/mir/default_server_configuration.h 2014-02-06 14:45:58 +0000 | |||
29 | @@ -313,7 +313,6 @@ | |||
30 | 313 | std::shared_ptr<scene::SessionManager> the_session_manager(); | 313 | std::shared_ptr<scene::SessionManager> the_session_manager(); |
31 | 314 | std::shared_ptr<scene::SurfaceBuilder> the_surface_builder(); | 314 | std::shared_ptr<scene::SurfaceBuilder> the_surface_builder(); |
32 | 315 | std::shared_ptr<scene::SurfaceController> the_surface_controller(); | 315 | std::shared_ptr<scene::SurfaceController> the_surface_controller(); |
33 | 316 | std::function<void()> force_threads_to_unblock_callback(); | ||
34 | 317 | }; | 316 | }; |
35 | 318 | } | 317 | } |
36 | 319 | 318 | ||
37 | 320 | 319 | ||
38 | === modified file 'include/server/mir/frontend/surface.h' | |||
39 | --- include/server/mir/frontend/surface.h 2014-02-06 14:45:58 +0000 | |||
40 | +++ include/server/mir/frontend/surface.h 2014-02-06 14:45:58 +0000 | |||
41 | @@ -51,8 +51,6 @@ | |||
42 | 51 | 51 | ||
43 | 52 | virtual ~Surface() {} | 52 | virtual ~Surface() {} |
44 | 53 | 53 | ||
45 | 54 | virtual void force_requests_to_complete() = 0; | ||
46 | 55 | |||
47 | 56 | virtual geometry::Size size() const = 0; | 54 | virtual geometry::Size size() const = 0; |
48 | 57 | virtual MirPixelFormat pixel_format() const = 0; | 55 | virtual MirPixelFormat pixel_format() const = 0; |
49 | 58 | 56 | ||
50 | 59 | 57 | ||
51 | === modified file 'include/server/mir/shell/session.h' | |||
52 | --- include/server/mir/shell/session.h 2014-01-13 06:12:33 +0000 | |||
53 | +++ include/server/mir/shell/session.h 2014-02-06 14:45:58 +0000 | |||
54 | @@ -33,8 +33,6 @@ | |||
55 | 33 | { | 33 | { |
56 | 34 | public: | 34 | public: |
57 | 35 | virtual std::string name() const = 0; | 35 | virtual std::string name() const = 0; |
58 | 36 | virtual void force_requests_to_complete() = 0; | ||
59 | 37 | |||
60 | 38 | virtual void take_snapshot(SnapshotCallback const& snapshot_taken) = 0; | 36 | virtual void take_snapshot(SnapshotCallback const& snapshot_taken) = 0; |
61 | 39 | virtual std::shared_ptr<Surface> default_surface() const = 0; | 37 | virtual std::shared_ptr<Surface> default_surface() const = 0; |
62 | 40 | virtual void set_lifecycle_state(MirLifecycleState state) = 0; | 38 | virtual void set_lifecycle_state(MirLifecycleState state) = 0; |
63 | 41 | 39 | ||
64 | === modified file 'include/test/mir_test_doubles/stub_buffer_stream.h' | |||
65 | --- include/test/mir_test_doubles/stub_buffer_stream.h 2014-02-06 14:45:58 +0000 | |||
66 | +++ include/test/mir_test_doubles/stub_buffer_stream.h 2014-02-06 14:45:58 +0000 | |||
67 | @@ -64,10 +64,6 @@ | |||
68 | 64 | { | 64 | { |
69 | 65 | } | 65 | } |
70 | 66 | 66 | ||
71 | 67 | void force_requests_to_complete() override | ||
72 | 68 | { | ||
73 | 69 | } | ||
74 | 70 | |||
75 | 71 | void allow_framedropping(bool) override | 67 | void allow_framedropping(bool) override |
76 | 72 | { | 68 | { |
77 | 73 | } | 69 | } |
78 | 74 | 70 | ||
79 | === modified file 'include/test/mir_test_doubles/stub_session.h' | |||
80 | --- include/test/mir_test_doubles/stub_session.h 2013-08-28 03:41:48 +0000 | |||
81 | +++ include/test/mir_test_doubles/stub_session.h 2014-02-06 14:45:58 +0000 | |||
82 | @@ -45,9 +45,6 @@ | |||
83 | 45 | { | 45 | { |
84 | 46 | return std::string(); | 46 | return std::string(); |
85 | 47 | } | 47 | } |
86 | 48 | void force_requests_to_complete() | ||
87 | 49 | { | ||
88 | 50 | } | ||
89 | 51 | void hide() | 48 | void hide() |
90 | 52 | { | 49 | { |
91 | 53 | } | 50 | } |
92 | 54 | 51 | ||
93 | === modified file 'include/test/mir_test_doubles/stub_shell_session.h' | |||
94 | --- include/test/mir_test_doubles/stub_shell_session.h 2014-01-13 06:12:33 +0000 | |||
95 | +++ include/test/mir_test_doubles/stub_shell_session.h 2014-02-06 14:45:58 +0000 | |||
96 | @@ -45,9 +45,6 @@ | |||
97 | 45 | { | 45 | { |
98 | 46 | return std::string(); | 46 | return std::string(); |
99 | 47 | } | 47 | } |
100 | 48 | void force_requests_to_complete() override | ||
101 | 49 | { | ||
102 | 50 | } | ||
103 | 51 | void hide() override | 48 | void hide() override |
104 | 52 | { | 49 | { |
105 | 53 | } | 50 | } |
106 | 54 | 51 | ||
107 | === modified file 'src/server/compositor/buffer_bundle.h' | |||
108 | --- src/server/compositor/buffer_bundle.h 2014-02-06 14:45:58 +0000 | |||
109 | +++ src/server/compositor/buffer_bundle.h 2014-02-06 14:45:58 +0000 | |||
110 | @@ -44,7 +44,6 @@ | |||
111 | 44 | 44 | ||
112 | 45 | virtual graphics::BufferProperties properties() const = 0; | 45 | virtual graphics::BufferProperties properties() const = 0; |
113 | 46 | virtual void allow_framedropping(bool dropping_allowed) = 0; | 46 | virtual void allow_framedropping(bool dropping_allowed) = 0; |
114 | 47 | virtual void force_requests_to_complete() = 0; | ||
115 | 48 | virtual void resize(const geometry::Size &newsize) = 0; | 47 | virtual void resize(const geometry::Size &newsize) = 0; |
116 | 49 | protected: | 48 | protected: |
117 | 50 | BufferBundle() = default; | 49 | BufferBundle() = default; |
118 | 51 | 50 | ||
119 | === modified file 'src/server/compositor/buffer_stream_surfaces.cpp' | |||
120 | --- src/server/compositor/buffer_stream_surfaces.cpp 2014-02-06 14:45:58 +0000 | |||
121 | +++ src/server/compositor/buffer_stream_surfaces.cpp 2014-02-06 14:45:58 +0000 | |||
122 | @@ -34,7 +34,6 @@ | |||
123 | 34 | 34 | ||
124 | 35 | mc::BufferStreamSurfaces::~BufferStreamSurfaces() | 35 | mc::BufferStreamSurfaces::~BufferStreamSurfaces() |
125 | 36 | { | 36 | { |
126 | 37 | force_requests_to_complete(); | ||
127 | 38 | } | 37 | } |
128 | 39 | 38 | ||
129 | 40 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_compositor_buffer( | 39 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_compositor_buffer( |
130 | @@ -74,11 +73,6 @@ | |||
131 | 74 | buffer_bundle->resize(size); | 73 | buffer_bundle->resize(size); |
132 | 75 | } | 74 | } |
133 | 76 | 75 | ||
134 | 77 | void mc::BufferStreamSurfaces::force_requests_to_complete() | ||
135 | 78 | { | ||
136 | 79 | buffer_bundle->force_requests_to_complete(); | ||
137 | 80 | } | ||
138 | 81 | |||
139 | 82 | void mc::BufferStreamSurfaces::allow_framedropping(bool allow) | 76 | void mc::BufferStreamSurfaces::allow_framedropping(bool allow) |
140 | 83 | { | 77 | { |
141 | 84 | buffer_bundle->allow_framedropping(allow); | 78 | buffer_bundle->allow_framedropping(allow); |
142 | 85 | 79 | ||
143 | === modified file 'src/server/compositor/buffer_stream_surfaces.h' | |||
144 | --- src/server/compositor/buffer_stream_surfaces.h 2014-02-06 14:45:58 +0000 | |||
145 | +++ src/server/compositor/buffer_stream_surfaces.h 2014-02-06 14:45:58 +0000 | |||
146 | @@ -49,7 +49,6 @@ | |||
147 | 49 | geometry::Size stream_size() override; | 49 | geometry::Size stream_size() override; |
148 | 50 | void resize(geometry::Size const& size) override; | 50 | void resize(geometry::Size const& size) override; |
149 | 51 | void allow_framedropping(bool) override; | 51 | void allow_framedropping(bool) override; |
150 | 52 | void force_requests_to_complete() override; | ||
151 | 53 | 52 | ||
152 | 54 | protected: | 53 | protected: |
153 | 55 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; | 54 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; |
154 | 56 | 55 | ||
155 | === modified file 'src/server/compositor/switching_bundle.cpp' | |||
156 | --- src/server/compositor/switching_bundle.cpp 2014-02-06 14:45:58 +0000 | |||
157 | +++ src/server/compositor/switching_bundle.cpp 2014-02-06 14:45:58 +0000 | |||
158 | @@ -398,15 +398,6 @@ | |||
159 | 398 | cond.notify_all(); | 398 | cond.notify_all(); |
160 | 399 | } | 399 | } |
161 | 400 | 400 | ||
162 | 401 | void mc::SwitchingBundle::force_requests_to_complete() | ||
163 | 402 | { | ||
164 | 403 | std::unique_lock<std::mutex> lock(guard); | ||
165 | 404 | client_acquire_todo = nullptr; | ||
166 | 405 | drop_frames(nready); | ||
167 | 406 | force_drop = nbuffers + 1; | ||
168 | 407 | cond.notify_all(); | ||
169 | 408 | } | ||
170 | 409 | |||
171 | 410 | void mc::SwitchingBundle::allow_framedropping(bool allow_dropping) | 401 | void mc::SwitchingBundle::allow_framedropping(bool allow_dropping) |
172 | 411 | { | 402 | { |
173 | 412 | std::unique_lock<std::mutex> lock(guard); | 403 | std::unique_lock<std::mutex> lock(guard); |
174 | 413 | 404 | ||
175 | === modified file 'src/server/compositor/switching_bundle.h' | |||
176 | --- src/server/compositor/switching_bundle.h 2014-02-06 14:45:58 +0000 | |||
177 | +++ src/server/compositor/switching_bundle.h 2014-02-06 14:45:58 +0000 | |||
178 | @@ -56,7 +56,6 @@ | |||
179 | 56 | void compositor_release(std::shared_ptr<graphics::Buffer> const& released_buffer); | 56 | void compositor_release(std::shared_ptr<graphics::Buffer> const& released_buffer); |
180 | 57 | std::shared_ptr<graphics::Buffer> snapshot_acquire(); | 57 | std::shared_ptr<graphics::Buffer> snapshot_acquire(); |
181 | 58 | void snapshot_release(std::shared_ptr<graphics::Buffer> const& released_buffer); | 58 | void snapshot_release(std::shared_ptr<graphics::Buffer> const& released_buffer); |
182 | 59 | void force_requests_to_complete(); | ||
183 | 60 | void allow_framedropping(bool dropping_allowed); | 59 | void allow_framedropping(bool dropping_allowed); |
184 | 61 | bool framedropping_allowed() const; | 60 | bool framedropping_allowed() const; |
185 | 62 | 61 | ||
186 | 63 | 62 | ||
187 | === modified file 'src/server/frontend/default_configuration.cpp' | |||
188 | --- src/server/frontend/default_configuration.cpp 2014-01-30 13:27:59 +0000 | |||
189 | +++ src/server/frontend/default_configuration.cpp 2014-02-06 14:45:58 +0000 | |||
190 | @@ -114,14 +114,11 @@ | |||
191 | 114 | { | 114 | { |
192 | 115 | auto const threads = the_options()->get<int>(frontend_threads_opt); | 115 | auto const threads = the_options()->get<int>(frontend_threads_opt); |
193 | 116 | 116 | ||
194 | 117 | auto const& force_threads_to_unblock = force_threads_to_unblock_callback(); | ||
195 | 118 | |||
196 | 119 | if (the_options()->is_set(no_server_socket_opt)) | 117 | if (the_options()->is_set(no_server_socket_opt)) |
197 | 120 | { | 118 | { |
198 | 121 | return std::make_shared<mf::BasicConnector>( | 119 | return std::make_shared<mf::BasicConnector>( |
199 | 122 | the_session_creator(), | 120 | the_session_creator(), |
200 | 123 | threads, | 121 | threads, |
201 | 124 | force_threads_to_unblock, | ||
202 | 125 | the_connector_report()); | 122 | the_connector_report()); |
203 | 126 | } | 123 | } |
204 | 127 | else | 124 | else |
205 | @@ -130,7 +127,6 @@ | |||
206 | 130 | the_socket_file(), | 127 | the_socket_file(), |
207 | 131 | the_session_creator(), | 128 | the_session_creator(), |
208 | 132 | threads, | 129 | threads, |
209 | 133 | force_threads_to_unblock, | ||
210 | 134 | the_connector_report()); | 130 | the_connector_report()); |
211 | 135 | } | 131 | } |
212 | 136 | }); | 132 | }); |
213 | 137 | 133 | ||
214 | === modified file 'src/server/frontend/published_socket_connector.cpp' | |||
215 | --- src/server/frontend/published_socket_connector.cpp 2014-01-22 17:05:48 +0000 | |||
216 | +++ src/server/frontend/published_socket_connector.cpp 2014-02-06 14:45:58 +0000 | |||
217 | @@ -35,9 +35,8 @@ | |||
218 | 35 | const std::string& socket_file, | 35 | const std::string& socket_file, |
219 | 36 | std::shared_ptr<SessionCreator> const& session_creator, | 36 | std::shared_ptr<SessionCreator> const& session_creator, |
220 | 37 | int threads, | 37 | int threads, |
221 | 38 | std::function<void()> const& force_threads_to_unblock, | ||
222 | 39 | std::shared_ptr<ConnectorReport> const& report) | 38 | std::shared_ptr<ConnectorReport> const& report) |
224 | 40 | : BasicConnector(session_creator, threads, force_threads_to_unblock, report), | 39 | : BasicConnector(session_creator, threads, report), |
225 | 41 | socket_file(socket_file), | 40 | socket_file(socket_file), |
226 | 42 | acceptor(io_service, socket_file) | 41 | acceptor(io_service, socket_file) |
227 | 43 | { | 42 | { |
228 | @@ -83,12 +82,10 @@ | |||
229 | 83 | mf::BasicConnector::BasicConnector( | 82 | mf::BasicConnector::BasicConnector( |
230 | 84 | std::shared_ptr<SessionCreator> const& session_creator, | 83 | std::shared_ptr<SessionCreator> const& session_creator, |
231 | 85 | int threads, | 84 | int threads, |
232 | 86 | std::function<void()> const& force_threads_to_unblock, | ||
233 | 87 | std::shared_ptr<ConnectorReport> const& report) | 85 | std::shared_ptr<ConnectorReport> const& report) |
234 | 88 | : work(io_service), | 86 | : work(io_service), |
235 | 89 | report(report), | 87 | report(report), |
236 | 90 | io_service_threads(threads), | 88 | io_service_threads(threads), |
237 | 91 | force_threads_to_unblock(force_threads_to_unblock), | ||
238 | 92 | session_creator{session_creator} | 89 | session_creator{session_creator} |
239 | 93 | { | 90 | { |
240 | 94 | } | 91 | } |
241 | @@ -123,12 +120,6 @@ | |||
242 | 123 | /* Stop processing new requests */ | 120 | /* Stop processing new requests */ |
243 | 124 | io_service.stop(); | 121 | io_service.stop(); |
244 | 125 | 122 | ||
245 | 126 | /* | ||
246 | 127 | * Ensure that any pending requests will complete (i.e., that they | ||
247 | 128 | * will not block indefinitely waiting for a resource from the server) | ||
248 | 129 | */ | ||
249 | 130 | force_threads_to_unblock(); | ||
250 | 131 | |||
251 | 132 | report->stopping_threads(io_service_threads.size()); | 123 | report->stopping_threads(io_service_threads.size()); |
252 | 133 | 124 | ||
253 | 134 | /* Wait for all io processing threads to finish */ | 125 | /* Wait for all io processing threads to finish */ |
254 | 135 | 126 | ||
255 | === modified file 'src/server/frontend/published_socket_connector.h' | |||
256 | --- src/server/frontend/published_socket_connector.h 2014-01-22 17:05:48 +0000 | |||
257 | +++ src/server/frontend/published_socket_connector.h 2014-02-06 14:45:58 +0000 | |||
258 | @@ -50,7 +50,6 @@ | |||
259 | 50 | explicit BasicConnector( | 50 | explicit BasicConnector( |
260 | 51 | std::shared_ptr<SessionCreator> const& session_creator, | 51 | std::shared_ptr<SessionCreator> const& session_creator, |
261 | 52 | int threads, | 52 | int threads, |
262 | 53 | std::function<void()> const& force_threads_to_unblock, | ||
263 | 54 | std::shared_ptr<ConnectorReport> const& report); | 53 | std::shared_ptr<ConnectorReport> const& report); |
264 | 55 | ~BasicConnector() noexcept; | 54 | ~BasicConnector() noexcept; |
265 | 56 | void start() override; | 55 | void start() override; |
266 | @@ -67,7 +66,6 @@ | |||
267 | 67 | 66 | ||
268 | 68 | private: | 67 | private: |
269 | 69 | std::vector<std::thread> io_service_threads; | 68 | std::vector<std::thread> io_service_threads; |
270 | 70 | std::function<void()> const force_threads_to_unblock; | ||
271 | 71 | std::shared_ptr<SessionCreator> const session_creator; | 69 | std::shared_ptr<SessionCreator> const session_creator; |
272 | 72 | }; | 70 | }; |
273 | 73 | 71 | ||
274 | @@ -79,7 +77,6 @@ | |||
275 | 79 | const std::string& socket_file, | 77 | const std::string& socket_file, |
276 | 80 | std::shared_ptr<SessionCreator> const& session_creator, | 78 | std::shared_ptr<SessionCreator> const& session_creator, |
277 | 81 | int threads, | 79 | int threads, |
278 | 82 | std::function<void()> const& force_threads_to_unblock, | ||
279 | 83 | std::shared_ptr<ConnectorReport> const& report); | 80 | std::shared_ptr<ConnectorReport> const& report); |
280 | 84 | ~PublishedSocketConnector() noexcept; | 81 | ~PublishedSocketConnector() noexcept; |
281 | 85 | 82 | ||
282 | 86 | 83 | ||
283 | === modified file 'src/server/frontend/session_mediator.cpp' | |||
284 | --- src/server/frontend/session_mediator.cpp 2014-02-06 14:45:58 +0000 | |||
285 | +++ src/server/frontend/session_mediator.cpp 2014-02-06 14:45:58 +0000 | |||
286 | @@ -174,20 +174,22 @@ | |||
287 | 174 | if (surface->supports_input()) | 174 | if (surface->supports_input()) |
288 | 175 | response->add_fd(surface->client_input_fd()); | 175 | response->add_fd(surface->client_input_fd()); |
289 | 176 | 176 | ||
290 | 177 | auto const self = shared_from_this(); | ||
291 | 178 | |||
292 | 177 | advance_buffer(surf_id, *surface, | 179 | advance_buffer(surf_id, *surface, |
294 | 178 | [lock, this, response, done, session](graphics::Buffer* client_buffer, bool need_full_ipc) | 180 | [lock, self, response, done, session](graphics::Buffer* client_buffer, bool need_full_ipc) |
295 | 179 | { | 181 | { |
296 | 180 | lock->unlock(); | 182 | lock->unlock(); |
297 | 181 | 183 | ||
298 | 182 | auto buffer = response->mutable_buffer(); | 184 | auto buffer = response->mutable_buffer(); |
300 | 183 | pack_protobuf_buffer(*buffer, client_buffer, need_full_ipc); | 185 | self->pack_protobuf_buffer(*buffer, client_buffer, need_full_ipc); |
301 | 184 | 186 | ||
302 | 185 | // TODO: NOTE: We use the ordering here to ensure the shell acts on the surface after the surface ID is sent over the wire. | 187 | // TODO: NOTE: We use the ordering here to ensure the shell acts on the surface after the surface ID is sent over the wire. |
303 | 186 | // This guarantees that notifications such as, gained focus, etc, can be correctly interpreted by the client. | 188 | // This guarantees that notifications such as, gained focus, etc, can be correctly interpreted by the client. |
304 | 187 | // To achieve this order we rely on done->Run() sending messages synchronously. As documented in mfd::SocketMessenger::send. | 189 | // To achieve this order we rely on done->Run() sending messages synchronously. As documented in mfd::SocketMessenger::send. |
305 | 188 | // this will require additional synchronization if mfd::SocketMessenger::send changes. | 190 | // this will require additional synchronization if mfd::SocketMessenger::send changes. |
306 | 189 | done->Run(); | 191 | done->Run(); |
308 | 190 | shell->handle_surface_created(session); | 192 | self->shell->handle_surface_created(session); |
309 | 191 | }); | 193 | }); |
310 | 192 | } | 194 | } |
311 | 193 | 195 | ||
312 | @@ -216,12 +218,14 @@ | |||
313 | 216 | 218 | ||
314 | 217 | auto surface = session->get_surface(surf_id); | 219 | auto surface = session->get_surface(surf_id); |
315 | 218 | 220 | ||
316 | 221 | auto const self = shared_from_this(); | ||
317 | 222 | |||
318 | 219 | advance_buffer(surf_id, *surface, | 223 | advance_buffer(surf_id, *surface, |
320 | 220 | [lock, this, response, done, session](graphics::Buffer* client_buffer, bool need_full_ipc) | 224 | [lock, self, response, done, session](graphics::Buffer* client_buffer, bool need_full_ipc) |
321 | 221 | { | 225 | { |
322 | 222 | lock->unlock(); | 226 | lock->unlock(); |
323 | 223 | 227 | ||
325 | 224 | pack_protobuf_buffer(*response, client_buffer, need_full_ipc); | 228 | self->pack_protobuf_buffer(*response, client_buffer, need_full_ipc); |
326 | 225 | 229 | ||
327 | 226 | done->Run(); | 230 | done->Run(); |
328 | 227 | }); | 231 | }); |
329 | 228 | 232 | ||
330 | === modified file 'src/server/frontend/session_mediator.h' | |||
331 | --- src/server/frontend/session_mediator.h 2014-02-06 14:45:58 +0000 | |||
332 | +++ src/server/frontend/session_mediator.h 2014-02-06 14:45:58 +0000 | |||
333 | @@ -56,7 +56,8 @@ | |||
334 | 56 | class Screencast; | 56 | class Screencast; |
335 | 57 | 57 | ||
336 | 58 | // SessionMediator relays requests from the client process into the server. | 58 | // SessionMediator relays requests from the client process into the server. |
338 | 59 | class SessionMediator : public mir::protobuf::DisplayServer | 59 | class SessionMediator : public mir::protobuf::DisplayServer, |
339 | 60 | public std::enable_shared_from_this<SessionMediator> | ||
340 | 60 | { | 61 | { |
341 | 61 | public: | 62 | public: |
342 | 62 | SessionMediator( | 63 | SessionMediator( |
343 | 63 | 64 | ||
344 | === modified file 'src/server/scene/application_session.cpp' | |||
345 | --- src/server/scene/application_session.cpp 2014-01-13 06:12:33 +0000 | |||
346 | +++ src/server/scene/application_session.cpp 2014-02-06 14:45:58 +0000 | |||
347 | @@ -125,15 +125,6 @@ | |||
348 | 125 | return session_name; | 125 | return session_name; |
349 | 126 | } | 126 | } |
350 | 127 | 127 | ||
351 | 128 | void ms::ApplicationSession::force_requests_to_complete() | ||
352 | 129 | { | ||
353 | 130 | std::unique_lock<std::mutex> lock(surfaces_mutex); | ||
354 | 131 | for (auto& id_s : surfaces) | ||
355 | 132 | { | ||
356 | 133 | id_s.second->force_requests_to_complete(); | ||
357 | 134 | } | ||
358 | 135 | } | ||
359 | 136 | |||
360 | 137 | void ms::ApplicationSession::hide() | 128 | void ms::ApplicationSession::hide() |
361 | 138 | { | 129 | { |
362 | 139 | std::unique_lock<std::mutex> lock(surfaces_mutex); | 130 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
363 | 140 | 131 | ||
364 | === modified file 'src/server/scene/application_session.h' | |||
365 | --- src/server/scene/application_session.h 2014-01-13 06:12:33 +0000 | |||
366 | +++ src/server/scene/application_session.h 2014-02-06 14:45:58 +0000 | |||
367 | @@ -61,8 +61,6 @@ | |||
368 | 61 | 61 | ||
369 | 62 | std::string name() const; | 62 | std::string name() const; |
370 | 63 | 63 | ||
371 | 64 | void force_requests_to_complete(); | ||
372 | 65 | |||
373 | 66 | void hide(); | 64 | void hide(); |
374 | 67 | void show(); | 65 | void show(); |
375 | 68 | 66 | ||
376 | 69 | 67 | ||
377 | === modified file 'src/server/scene/basic_surface.cpp' | |||
378 | --- src/server/scene/basic_surface.cpp 2014-02-06 14:45:58 +0000 | |||
379 | +++ src/server/scene/basic_surface.cpp 2014-02-06 14:45:58 +0000 | |||
380 | @@ -49,11 +49,6 @@ | |||
381 | 49 | report->surface_created(this); | 49 | report->surface_created(this); |
382 | 50 | } | 50 | } |
383 | 51 | 51 | ||
384 | 52 | void ms::BasicSurface::force_requests_to_complete() | ||
385 | 53 | { | ||
386 | 54 | surface_buffer_stream->force_requests_to_complete(); | ||
387 | 55 | } | ||
388 | 56 | |||
389 | 57 | ms::BasicSurface::~BasicSurface() | 52 | ms::BasicSurface::~BasicSurface() |
390 | 58 | { | 53 | { |
391 | 59 | report->surface_deleted(this); | 54 | report->surface_deleted(this); |
392 | 60 | 55 | ||
393 | === modified file 'src/server/scene/basic_surface.h' | |||
394 | --- src/server/scene/basic_surface.h 2014-02-06 14:45:58 +0000 | |||
395 | +++ src/server/scene/basic_surface.h 2014-02-06 14:45:58 +0000 | |||
396 | @@ -74,7 +74,6 @@ | |||
397 | 74 | 74 | ||
398 | 75 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const; | 75 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const; |
399 | 76 | virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete); | 76 | virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete); |
400 | 77 | virtual void force_requests_to_complete(); | ||
401 | 78 | 77 | ||
402 | 79 | virtual bool supports_input() const; | 78 | virtual bool supports_input() const; |
403 | 80 | virtual int client_input_fd() const; | 79 | virtual int client_input_fd() const; |
404 | 81 | 80 | ||
405 | === modified file 'src/server/scene/default_configuration.cpp' | |||
406 | --- src/server/scene/default_configuration.cpp 2014-01-29 15:20:07 +0000 | |||
407 | +++ src/server/scene/default_configuration.cpp 2014-02-06 14:45:58 +0000 | |||
408 | @@ -205,19 +205,6 @@ | |||
409 | 205 | return the_mediating_display_changer(); | 205 | return the_mediating_display_changer(); |
410 | 206 | } | 206 | } |
411 | 207 | 207 | ||
412 | 208 | std::function<void()> | ||
413 | 209 | mir::DefaultServerConfiguration::force_threads_to_unblock_callback() | ||
414 | 210 | { | ||
415 | 211 | auto shell_sessions = the_session_container(); | ||
416 | 212 | return [shell_sessions] | ||
417 | 213 | { | ||
418 | 214 | shell_sessions->for_each([](std::shared_ptr<msh::Session> const& session) | ||
419 | 215 | { | ||
420 | 216 | session->force_requests_to_complete(); | ||
421 | 217 | }); | ||
422 | 218 | }; | ||
423 | 219 | } | ||
424 | 220 | |||
425 | 221 | std::shared_ptr<mf::EventSink> | 208 | std::shared_ptr<mf::EventSink> |
426 | 222 | mir::DefaultServerConfiguration::the_global_event_sink() | 209 | mir::DefaultServerConfiguration::the_global_event_sink() |
427 | 223 | { | 210 | { |
428 | 224 | 211 | ||
429 | === modified file 'src/server/scene/surface_impl.cpp' | |||
430 | --- src/server/scene/surface_impl.cpp 2014-02-06 14:45:58 +0000 | |||
431 | +++ src/server/scene/surface_impl.cpp 2014-02-06 14:45:58 +0000 | |||
432 | @@ -73,11 +73,6 @@ | |||
433 | 73 | surface->set_hidden(false); | 73 | surface->set_hidden(false); |
434 | 74 | } | 74 | } |
435 | 75 | 75 | ||
436 | 76 | void ms::SurfaceImpl::force_requests_to_complete() | ||
437 | 77 | { | ||
438 | 78 | surface->force_requests_to_complete(); | ||
439 | 79 | } | ||
440 | 80 | |||
441 | 81 | mir::geometry::Size ms::SurfaceImpl::size() const | 76 | mir::geometry::Size ms::SurfaceImpl::size() const |
442 | 82 | { | 77 | { |
443 | 83 | return surface->size(); | 78 | return surface->size(); |
444 | 84 | 79 | ||
445 | === modified file 'src/server/scene/surface_impl.h' | |||
446 | --- src/server/scene/surface_impl.h 2014-02-06 14:45:58 +0000 | |||
447 | +++ src/server/scene/surface_impl.h 2014-02-06 14:45:58 +0000 | |||
448 | @@ -57,8 +57,6 @@ | |||
449 | 57 | virtual void hide(); | 57 | virtual void hide(); |
450 | 58 | virtual void show(); | 58 | virtual void show(); |
451 | 59 | 59 | ||
452 | 60 | virtual void force_requests_to_complete(); | ||
453 | 61 | |||
454 | 62 | virtual std::string name() const; | 60 | virtual std::string name() const; |
455 | 63 | 61 | ||
456 | 64 | virtual void move_to(geometry::Point const& top_left); | 62 | virtual void move_to(geometry::Point const& top_left); |
457 | 65 | 63 | ||
458 | === modified file 'tests/integration-tests/compositor/test_buffer_stream.cpp' | |||
459 | --- tests/integration-tests/compositor/test_buffer_stream.cpp 2014-02-06 14:45:58 +0000 | |||
460 | +++ tests/integration-tests/compositor/test_buffer_stream.cpp 2014-02-06 14:45:58 +0000 | |||
461 | @@ -326,8 +326,6 @@ | |||
462 | 326 | 326 | ||
463 | 327 | done = true; | 327 | done = true; |
464 | 328 | 328 | ||
465 | 329 | buffer_stream.force_requests_to_complete(); | ||
466 | 330 | |||
467 | 331 | compositor.join(); | 329 | compositor.join(); |
468 | 332 | 330 | ||
469 | 333 | for (auto &s : snapshotters) | 331 | for (auto &s : snapshotters) |
470 | 334 | 332 | ||
471 | === modified file 'tests/integration-tests/test_swapinterval.cpp' | |||
472 | --- tests/integration-tests/test_swapinterval.cpp 2014-02-06 14:45:58 +0000 | |||
473 | +++ tests/integration-tests/test_swapinterval.cpp 2014-02-06 14:45:58 +0000 | |||
474 | @@ -70,7 +70,6 @@ | |||
475 | 70 | 70 | ||
476 | 71 | geom::Size stream_size() override { return geom::Size{}; } | 71 | geom::Size stream_size() override { return geom::Size{}; } |
477 | 72 | void resize(geom::Size const&) override {} | 72 | void resize(geom::Size const&) override {} |
478 | 73 | void force_requests_to_complete() override {} | ||
479 | 74 | void allow_framedropping(bool) override | 73 | void allow_framedropping(bool) override |
480 | 75 | { | 74 | { |
481 | 76 | while (write(render_operations_fd, "a", 1) != 1) continue; | 75 | while (write(render_operations_fd, "a", 1) != 1) continue; |
482 | 77 | 76 | ||
483 | === modified file 'tests/mir_test_doubles/test_protobuf_socket_server.cpp' | |||
484 | --- tests/mir_test_doubles/test_protobuf_socket_server.cpp 2014-01-22 15:54:11 +0000 | |||
485 | +++ tests/mir_test_doubles/test_protobuf_socket_server.cpp 2014-02-06 14:45:58 +0000 | |||
486 | @@ -42,7 +42,6 @@ | |||
487 | 42 | std::make_shared<mtd::StubSessionAuthorizer>(), | 42 | std::make_shared<mtd::StubSessionAuthorizer>(), |
488 | 43 | std::make_shared<mf::NullMessageProcessorReport>()), | 43 | std::make_shared<mf::NullMessageProcessorReport>()), |
489 | 44 | 10, | 44 | 10, |
490 | 45 | []{}, | ||
491 | 46 | report); | 45 | report); |
492 | 47 | } | 46 | } |
493 | 48 | } | 47 | } |
494 | 49 | 48 | ||
495 | === modified file 'tests/unit-tests/compositor/test_buffer_stream.cpp' | |||
496 | --- tests/unit-tests/compositor/test_buffer_stream.cpp 2014-02-06 14:45:58 +0000 | |||
497 | +++ tests/unit-tests/compositor/test_buffer_stream.cpp 2014-02-06 14:45:58 +0000 | |||
498 | @@ -39,10 +39,6 @@ | |||
499 | 39 | { | 39 | { |
500 | 40 | mock_buffer = std::make_shared<mtd::StubBuffer>(); | 40 | mock_buffer = std::make_shared<mtd::StubBuffer>(); |
501 | 41 | mock_bundle = std::make_shared<mtd::MockBufferBundle>(); | 41 | mock_bundle = std::make_shared<mtd::MockBufferBundle>(); |
502 | 42 | |||
503 | 43 | // Two of the tests care about this, the rest should not... | ||
504 | 44 | EXPECT_CALL(*mock_bundle, force_requests_to_complete()) | ||
505 | 45 | .Times(::testing::AnyNumber()); | ||
506 | 46 | } | 42 | } |
507 | 47 | 43 | ||
508 | 48 | std::shared_ptr<mtd::StubBuffer> mock_buffer; | 44 | std::shared_ptr<mtd::StubBuffer> mock_buffer; |
509 | @@ -75,23 +71,6 @@ | |||
510 | 75 | EXPECT_EQ(format, returned_pf); | 71 | EXPECT_EQ(format, returned_pf); |
511 | 76 | } | 72 | } |
512 | 77 | 73 | ||
513 | 78 | TEST_F(BufferStreamTest, force_requests_to_complete) | ||
514 | 79 | { | ||
515 | 80 | EXPECT_CALL(*mock_bundle, force_requests_to_complete()) | ||
516 | 81 | .Times(2); // Once explcit, once on destruction | ||
517 | 82 | |||
518 | 83 | mc::BufferStreamSurfaces buffer_stream(mock_bundle); | ||
519 | 84 | buffer_stream.force_requests_to_complete(); | ||
520 | 85 | } | ||
521 | 86 | |||
522 | 87 | TEST_F(BufferStreamTest, requests_are_completed_before_destruction) | ||
523 | 88 | { | ||
524 | 89 | EXPECT_CALL(*mock_bundle, force_requests_to_complete()) | ||
525 | 90 | .Times(1); | ||
526 | 91 | |||
527 | 92 | mc::BufferStreamSurfaces buffer_stream(mock_bundle); | ||
528 | 93 | } | ||
529 | 94 | |||
530 | 95 | TEST_F(BufferStreamTest, get_buffer_for_compositor_handles_resources) | 74 | TEST_F(BufferStreamTest, get_buffer_for_compositor_handles_resources) |
531 | 96 | { | 75 | { |
532 | 97 | using namespace testing; | 76 | using namespace testing; |
533 | 98 | 77 | ||
534 | === modified file 'tests/unit-tests/compositor/test_switching_bundle.cpp' | |||
535 | --- tests/unit-tests/compositor/test_switching_bundle.cpp 2014-02-06 14:45:58 +0000 | |||
536 | +++ tests/unit-tests/compositor/test_switching_bundle.cpp 2014-02-06 14:45:58 +0000 | |||
537 | @@ -293,8 +293,6 @@ | |||
538 | 293 | unsigned long frameno = 0; | 293 | unsigned long frameno = 0; |
539 | 294 | const int N = 100; | 294 | const int N = 100; |
540 | 295 | 295 | ||
541 | 296 | bundle.force_requests_to_complete(); | ||
542 | 297 | |||
543 | 298 | std::shared_ptr<mg::Buffer> buf[N]; | 296 | std::shared_ptr<mg::Buffer> buf[N]; |
544 | 299 | for (int i = 0; i < N; i++) | 297 | for (int i = 0; i < N; i++) |
545 | 300 | buf[i] = bundle.compositor_acquire(++frameno); | 298 | buf[i] = bundle.compositor_acquire(++frameno); |
546 | @@ -713,7 +711,6 @@ | |||
547 | 713 | * unblock clients. The latter only temporarily unblock clients. | 711 | * unblock clients. The latter only temporarily unblock clients. |
548 | 714 | * But that requires interface changes all over the place... | 712 | * But that requires interface changes all over the place... |
549 | 715 | */ | 713 | */ |
550 | 716 | bundle.force_requests_to_complete(); | ||
551 | 717 | client.join(); | 714 | client.join(); |
552 | 718 | } | 715 | } |
553 | 719 | } | 716 | } |
554 | @@ -729,7 +726,6 @@ | |||
555 | 729 | bundle.allow_framedropping(false); | 726 | bundle.allow_framedropping(false); |
556 | 730 | 727 | ||
557 | 731 | std::thread client(client_thread, std::ref(bundle), nbuffers); | 728 | std::thread client(client_thread, std::ref(bundle), nbuffers); |
558 | 732 | bundle.force_requests_to_complete(); | ||
559 | 733 | client.join(); | 729 | client.join(); |
560 | 734 | 730 | ||
561 | 735 | EXPECT_FALSE(bundle.framedropping_allowed()); | 731 | EXPECT_FALSE(bundle.framedropping_allowed()); |
562 | 736 | 732 | ||
563 | === modified file 'tests/unit-tests/frontend/test_published_socket_connector.cpp' | |||
564 | --- tests/unit-tests/frontend/test_published_socket_connector.cpp 2014-01-22 15:54:11 +0000 | |||
565 | +++ tests/unit-tests/frontend/test_published_socket_connector.cpp 2014-02-06 14:45:58 +0000 | |||
566 | @@ -342,27 +342,11 @@ | |||
567 | 342 | EXPECT_EQ(magic.magic(), stub_server_tool->drm_magic); | 342 | EXPECT_EQ(magic.magic(), stub_server_tool->drm_magic); |
568 | 343 | } | 343 | } |
569 | 344 | 344 | ||
570 | 345 | namespace | ||
571 | 346 | { | ||
572 | 347 | |||
573 | 348 | class MockForceRequests | ||
574 | 349 | { | ||
575 | 350 | public: | ||
576 | 351 | MOCK_METHOD0(force_requests_to_complete, void()); | ||
577 | 352 | }; | ||
578 | 353 | |||
579 | 354 | } | ||
580 | 355 | |||
581 | 356 | TEST_F(PublishedSocketConnector, forces_requests_to_complete_when_stopping) | 345 | TEST_F(PublishedSocketConnector, forces_requests_to_complete_when_stopping) |
582 | 357 | { | 346 | { |
583 | 358 | MockForceRequests mock_force_requests; | ||
584 | 359 | auto stub_server_tool = std::make_shared<mt::StubServerTool>(); | 347 | auto stub_server_tool = std::make_shared<mt::StubServerTool>(); |
585 | 360 | auto ipc_factory = std::make_shared<mtd::StubIpcFactory>(*stub_server_tool); | 348 | auto ipc_factory = std::make_shared<mtd::StubIpcFactory>(*stub_server_tool); |
586 | 361 | 349 | ||
587 | 362 | /* Once for the explicit stop() and once when the communicator is destroyed */ | ||
588 | 363 | EXPECT_CALL(mock_force_requests, force_requests_to_complete()) | ||
589 | 364 | .Times(2); | ||
590 | 365 | |||
591 | 366 | auto comms = std::make_shared<mf::PublishedSocketConnector>( | 350 | auto comms = std::make_shared<mf::PublishedSocketConnector>( |
592 | 367 | "./test_socket1", | 351 | "./test_socket1", |
593 | 368 | std::make_shared<mf::ProtobufSessionCreator>( | 352 | std::make_shared<mf::ProtobufSessionCreator>( |
594 | @@ -370,7 +354,6 @@ | |||
595 | 370 | std::make_shared<mtd::StubSessionAuthorizer>(), | 354 | std::make_shared<mtd::StubSessionAuthorizer>(), |
596 | 371 | std::make_shared<mf::NullMessageProcessorReport>()), | 355 | std::make_shared<mf::NullMessageProcessorReport>()), |
597 | 372 | 10, | 356 | 10, |
598 | 373 | std::bind(&MockForceRequests::force_requests_to_complete, &mock_force_requests), | ||
599 | 374 | std::make_shared<mf::NullConnectorReport>()); | 357 | std::make_shared<mf::NullConnectorReport>()); |
600 | 375 | 358 | ||
601 | 376 | comms->start(); | 359 | comms->start(); |
602 | 377 | 360 | ||
603 | === modified file 'tests/unit-tests/frontend/test_session_mediator.cpp' | |||
604 | --- tests/unit-tests/frontend/test_session_mediator.cpp 2014-02-06 14:45:58 +0000 | |||
605 | +++ tests/unit-tests/frontend/test_session_mediator.cpp 2014-02-06 14:45:58 +0000 | |||
606 | @@ -206,10 +206,10 @@ | |||
607 | 206 | report{std::make_shared<mf::NullSessionMediatorReport>()}, | 206 | report{std::make_shared<mf::NullSessionMediatorReport>()}, |
608 | 207 | resource_cache{std::make_shared<mf::ResourceCache>()}, | 207 | resource_cache{std::make_shared<mf::ResourceCache>()}, |
609 | 208 | stub_screencast{std::make_shared<StubScreencast>()}, | 208 | stub_screencast{std::make_shared<StubScreencast>()}, |
611 | 209 | mediator{shell, graphics_platform, graphics_changer, | 209 | mediator{std::make_shared<mf::SessionMediator>(shell, graphics_platform, graphics_changer, |
612 | 210 | surface_pixel_formats, report, | 210 | surface_pixel_formats, report, |
613 | 211 | std::make_shared<mtd::NullEventSink>(), | 211 | std::make_shared<mtd::NullEventSink>(), |
615 | 212 | resource_cache, stub_screencast}, | 212 | resource_cache, stub_screencast)}, |
616 | 213 | stubbed_session{std::make_shared<StubbedSession>()}, | 213 | stubbed_session{std::make_shared<StubbedSession>()}, |
617 | 214 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} | 214 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} |
618 | 215 | { | 215 | { |
619 | @@ -227,7 +227,7 @@ | |||
620 | 227 | std::shared_ptr<mf::SessionMediatorReport> const report; | 227 | std::shared_ptr<mf::SessionMediatorReport> const report; |
621 | 228 | std::shared_ptr<mf::ResourceCache> const resource_cache; | 228 | std::shared_ptr<mf::ResourceCache> const resource_cache; |
622 | 229 | std::shared_ptr<StubScreencast> const stub_screencast; | 229 | std::shared_ptr<StubScreencast> const stub_screencast; |
624 | 230 | mf::SessionMediator mediator; | 230 | std::shared_ptr<mf::SessionMediator> const mediator; |
625 | 231 | std::shared_ptr<StubbedSession> const stubbed_session; | 231 | std::shared_ptr<StubbedSession> const stubbed_session; |
626 | 232 | 232 | ||
627 | 233 | std::unique_ptr<google::protobuf::Closure> null_callback; | 233 | std::unique_ptr<google::protobuf::Closure> null_callback; |
628 | @@ -243,8 +243,8 @@ | |||
629 | 243 | 243 | ||
630 | 244 | EXPECT_CALL(*shell, close_session(_)).Times(1); | 244 | EXPECT_CALL(*shell, close_session(_)).Times(1); |
631 | 245 | 245 | ||
634 | 246 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 246 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
635 | 247 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 247 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
636 | 248 | } | 248 | } |
637 | 249 | 249 | ||
638 | 250 | TEST_F(SessionMediatorTest, calling_methods_before_connect_throws) | 250 | TEST_F(SessionMediatorTest, calling_methods_before_connect_throws) |
639 | @@ -253,31 +253,31 @@ | |||
640 | 253 | mp::SurfaceParameters request; | 253 | mp::SurfaceParameters request; |
641 | 254 | mp::Surface response; | 254 | mp::Surface response; |
642 | 255 | 255 | ||
644 | 256 | mediator.create_surface(nullptr, &request, &response, null_callback.get()); | 256 | mediator->create_surface(nullptr, &request, &response, null_callback.get()); |
645 | 257 | }, std::logic_error); | 257 | }, std::logic_error); |
646 | 258 | 258 | ||
647 | 259 | EXPECT_THROW({ | 259 | EXPECT_THROW({ |
648 | 260 | mp::SurfaceId request; | 260 | mp::SurfaceId request; |
649 | 261 | mp::Buffer response; | 261 | mp::Buffer response; |
650 | 262 | 262 | ||
652 | 263 | mediator.next_buffer(nullptr, &request, &response, null_callback.get()); | 263 | mediator->next_buffer(nullptr, &request, &response, null_callback.get()); |
653 | 264 | }, std::logic_error); | 264 | }, std::logic_error); |
654 | 265 | 265 | ||
655 | 266 | EXPECT_THROW({ | 266 | EXPECT_THROW({ |
656 | 267 | mp::SurfaceId request; | 267 | mp::SurfaceId request; |
657 | 268 | 268 | ||
659 | 269 | mediator.release_surface(nullptr, &request, nullptr, null_callback.get()); | 269 | mediator->release_surface(nullptr, &request, nullptr, null_callback.get()); |
660 | 270 | }, std::logic_error); | 270 | }, std::logic_error); |
661 | 271 | 271 | ||
662 | 272 | EXPECT_THROW({ | 272 | EXPECT_THROW({ |
663 | 273 | mp::DRMMagic request; | 273 | mp::DRMMagic request; |
664 | 274 | mp::DRMAuthMagicStatus response; | 274 | mp::DRMAuthMagicStatus response; |
665 | 275 | 275 | ||
667 | 276 | mediator.drm_auth_magic(nullptr, &request, &response, null_callback.get()); | 276 | mediator->drm_auth_magic(nullptr, &request, &response, null_callback.get()); |
668 | 277 | }, std::logic_error); | 277 | }, std::logic_error); |
669 | 278 | 278 | ||
670 | 279 | EXPECT_THROW({ | 279 | EXPECT_THROW({ |
672 | 280 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 280 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
673 | 281 | }, std::logic_error); | 281 | }, std::logic_error); |
674 | 282 | } | 282 | } |
675 | 283 | 283 | ||
676 | @@ -286,23 +286,23 @@ | |||
677 | 286 | mp::ConnectParameters connect_parameters; | 286 | mp::ConnectParameters connect_parameters; |
678 | 287 | mp::Connection connection; | 287 | mp::Connection connection; |
679 | 288 | 288 | ||
681 | 289 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 289 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
682 | 290 | 290 | ||
683 | 291 | { | 291 | { |
684 | 292 | mp::SurfaceParameters request; | 292 | mp::SurfaceParameters request; |
685 | 293 | mp::Surface surface_response; | 293 | mp::Surface surface_response; |
686 | 294 | 294 | ||
688 | 295 | mediator.create_surface(nullptr, &request, &surface_response, null_callback.get()); | 295 | mediator->create_surface(nullptr, &request, &surface_response, null_callback.get()); |
689 | 296 | 296 | ||
690 | 297 | mp::SurfaceId surface = surface_response.id(); | 297 | mp::SurfaceId surface = surface_response.id(); |
691 | 298 | mp::Buffer buffer_response; | 298 | mp::Buffer buffer_response; |
692 | 299 | 299 | ||
694 | 300 | mediator.next_buffer(nullptr, &surface, &buffer_response, null_callback.get()); | 300 | mediator->next_buffer(nullptr, &surface, &buffer_response, null_callback.get()); |
695 | 301 | 301 | ||
697 | 302 | mediator.release_surface(nullptr, &surface, nullptr, null_callback.get()); | 302 | mediator->release_surface(nullptr, &surface, nullptr, null_callback.get()); |
698 | 303 | } | 303 | } |
699 | 304 | 304 | ||
701 | 305 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 305 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
702 | 306 | } | 306 | } |
703 | 307 | 307 | ||
704 | 308 | TEST_F(SessionMediatorTest, calling_methods_after_disconnect_throws) | 308 | TEST_F(SessionMediatorTest, calling_methods_after_disconnect_throws) |
705 | @@ -310,39 +310,39 @@ | |||
706 | 310 | mp::ConnectParameters connect_parameters; | 310 | mp::ConnectParameters connect_parameters; |
707 | 311 | mp::Connection connection; | 311 | mp::Connection connection; |
708 | 312 | 312 | ||
710 | 313 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 313 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
711 | 314 | 314 | ||
713 | 315 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 315 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
714 | 316 | 316 | ||
715 | 317 | EXPECT_THROW({ | 317 | EXPECT_THROW({ |
716 | 318 | mp::SurfaceParameters surface_parameters; | 318 | mp::SurfaceParameters surface_parameters; |
717 | 319 | mp::Surface surface; | 319 | mp::Surface surface; |
718 | 320 | 320 | ||
720 | 321 | mediator.create_surface(nullptr, &surface_parameters, &surface, null_callback.get()); | 321 | mediator->create_surface(nullptr, &surface_parameters, &surface, null_callback.get()); |
721 | 322 | }, std::logic_error); | 322 | }, std::logic_error); |
722 | 323 | 323 | ||
723 | 324 | EXPECT_THROW({ | 324 | EXPECT_THROW({ |
724 | 325 | mp::SurfaceId request; | 325 | mp::SurfaceId request; |
725 | 326 | mp::Buffer response; | 326 | mp::Buffer response; |
726 | 327 | 327 | ||
728 | 328 | mediator.next_buffer(nullptr, &request, &response, null_callback.get()); | 328 | mediator->next_buffer(nullptr, &request, &response, null_callback.get()); |
729 | 329 | }, std::logic_error); | 329 | }, std::logic_error); |
730 | 330 | 330 | ||
731 | 331 | EXPECT_THROW({ | 331 | EXPECT_THROW({ |
732 | 332 | mp::SurfaceId request; | 332 | mp::SurfaceId request; |
733 | 333 | 333 | ||
735 | 334 | mediator.release_surface(nullptr, &request, nullptr, null_callback.get()); | 334 | mediator->release_surface(nullptr, &request, nullptr, null_callback.get()); |
736 | 335 | }, std::logic_error); | 335 | }, std::logic_error); |
737 | 336 | 336 | ||
738 | 337 | EXPECT_THROW({ | 337 | EXPECT_THROW({ |
739 | 338 | mp::DRMMagic request; | 338 | mp::DRMMagic request; |
740 | 339 | mp::DRMAuthMagicStatus response; | 339 | mp::DRMAuthMagicStatus response; |
741 | 340 | 340 | ||
743 | 341 | mediator.drm_auth_magic(nullptr, &request, &response, null_callback.get()); | 341 | mediator->drm_auth_magic(nullptr, &request, &response, null_callback.get()); |
744 | 342 | }, std::logic_error); | 342 | }, std::logic_error); |
745 | 343 | 343 | ||
746 | 344 | EXPECT_THROW({ | 344 | EXPECT_THROW({ |
748 | 345 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 345 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
749 | 346 | }, std::logic_error); | 346 | }, std::logic_error); |
750 | 347 | } | 347 | } |
751 | 348 | 348 | ||
752 | @@ -351,11 +351,11 @@ | |||
753 | 351 | mp::ConnectParameters connect_parameters; | 351 | mp::ConnectParameters connect_parameters; |
754 | 352 | mp::Connection connection; | 352 | mp::Connection connection; |
755 | 353 | 353 | ||
761 | 354 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 354 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
762 | 355 | 355 | ||
763 | 356 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 356 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
764 | 357 | 357 | ||
765 | 358 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 358 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
766 | 359 | } | 359 | } |
767 | 360 | 360 | ||
768 | 361 | TEST_F(SessionMediatorTest, connect_packs_display_configuration) | 361 | TEST_F(SessionMediatorTest, connect_packs_display_configuration) |
769 | @@ -369,7 +369,7 @@ | |||
770 | 369 | EXPECT_CALL(*mock_display, active_configuration()) | 369 | EXPECT_CALL(*mock_display, active_configuration()) |
771 | 370 | .Times(1) | 370 | .Times(1) |
772 | 371 | .WillOnce(Return(mt::fake_shared(config))); | 371 | .WillOnce(Return(mt::fake_shared(config))); |
774 | 372 | mf::SessionMediator mediator( | 372 | auto const mediator = std::make_shared<mf::SessionMediator>( |
775 | 373 | shell, graphics_platform, mock_display, | 373 | shell, graphics_platform, mock_display, |
776 | 374 | surface_pixel_formats, report, | 374 | surface_pixel_formats, report, |
777 | 375 | std::make_shared<mtd::NullEventSink>(), | 375 | std::make_shared<mtd::NullEventSink>(), |
778 | @@ -382,7 +382,7 @@ | |||
779 | 382 | connection.clear_display_output(); | 382 | connection.clear_display_output(); |
780 | 383 | connection.clear_display_configuration(); | 383 | connection.clear_display_configuration(); |
781 | 384 | 384 | ||
783 | 385 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 385 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
784 | 386 | 386 | ||
785 | 387 | EXPECT_THAT(connection.display_configuration(), | 387 | EXPECT_THAT(connection.display_configuration(), |
786 | 388 | mt::DisplayConfigMatches(std::cref(config))); | 388 | mt::DisplayConfigMatches(std::cref(config))); |
787 | @@ -393,17 +393,17 @@ | |||
788 | 393 | mp::ConnectParameters connect_parameters; | 393 | mp::ConnectParameters connect_parameters; |
789 | 394 | mp::Connection connection; | 394 | mp::Connection connection; |
790 | 395 | 395 | ||
792 | 396 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 396 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
793 | 397 | 397 | ||
794 | 398 | { | 398 | { |
795 | 399 | mp::SurfaceParameters request; | 399 | mp::SurfaceParameters request; |
796 | 400 | mp::Surface response; | 400 | mp::Surface response; |
797 | 401 | 401 | ||
799 | 402 | mediator.create_surface(nullptr, &request, &response, null_callback.get()); | 402 | mediator->create_surface(nullptr, &request, &response, null_callback.get()); |
800 | 403 | EXPECT_EQ(StubbedSession::testing_client_input_fd, response.fd(0)); | 403 | EXPECT_EQ(StubbedSession::testing_client_input_fd, response.fd(0)); |
801 | 404 | } | 404 | } |
802 | 405 | 405 | ||
804 | 406 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 406 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
805 | 407 | } | 407 | } |
806 | 408 | 408 | ||
807 | 409 | TEST_F(SessionMediatorTest, no_input_channel_is_nonfatal) | 409 | TEST_F(SessionMediatorTest, no_input_channel_is_nonfatal) |
808 | @@ -416,16 +416,16 @@ | |||
809 | 416 | EXPECT_CALL(*stubbed_session->mock_surface, client_input_fd()) | 416 | EXPECT_CALL(*stubbed_session->mock_surface, client_input_fd()) |
810 | 417 | .Times(0); | 417 | .Times(0); |
811 | 418 | 418 | ||
813 | 419 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 419 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
814 | 420 | 420 | ||
815 | 421 | { | 421 | { |
816 | 422 | mp::SurfaceParameters request; | 422 | mp::SurfaceParameters request; |
817 | 423 | mp::Surface response; | 423 | mp::Surface response; |
818 | 424 | 424 | ||
820 | 425 | mediator.create_surface(nullptr, &request, &response, null_callback.get()); | 425 | mediator->create_surface(nullptr, &request, &response, null_callback.get()); |
821 | 426 | } | 426 | } |
822 | 427 | 427 | ||
824 | 428 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 428 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
825 | 429 | } | 429 | } |
826 | 430 | 430 | ||
827 | 431 | TEST_F(SessionMediatorTest, session_only_sends_needed_buffers) | 431 | TEST_F(SessionMediatorTest, session_only_sends_needed_buffers) |
828 | @@ -435,7 +435,7 @@ | |||
829 | 435 | mp::ConnectParameters connect_parameters; | 435 | mp::ConnectParameters connect_parameters; |
830 | 436 | mp::Connection connection; | 436 | mp::Connection connection; |
831 | 437 | 437 | ||
833 | 438 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 438 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
834 | 439 | 439 | ||
835 | 440 | { | 440 | { |
836 | 441 | EXPECT_CALL(*stubbed_session->mock_buffer, id()) | 441 | EXPECT_CALL(*stubbed_session->mock_buffer, id()) |
837 | @@ -456,14 +456,14 @@ | |||
838 | 456 | .Times(2); | 456 | .Times(2); |
839 | 457 | 457 | ||
840 | 458 | mp::SurfaceParameters surface_request; | 458 | mp::SurfaceParameters surface_request; |
842 | 459 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); | 459 | mediator->create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); |
843 | 460 | buffer_request = surface_response.id(); | 460 | buffer_request = surface_response.id(); |
847 | 461 | mediator.next_buffer(nullptr, &buffer_request, &buffer_response[0], null_callback.get()); | 461 | mediator->next_buffer(nullptr, &buffer_request, &buffer_response[0], null_callback.get()); |
848 | 462 | mediator.next_buffer(nullptr, &buffer_request, &buffer_response[1], null_callback.get()); | 462 | mediator->next_buffer(nullptr, &buffer_request, &buffer_response[1], null_callback.get()); |
849 | 463 | mediator.next_buffer(nullptr, &buffer_request, &buffer_response[2], null_callback.get()); | 463 | mediator->next_buffer(nullptr, &buffer_request, &buffer_response[2], null_callback.get()); |
850 | 464 | } | 464 | } |
851 | 465 | 465 | ||
853 | 466 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 466 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
854 | 467 | } | 467 | } |
855 | 468 | 468 | ||
856 | 469 | TEST_F(SessionMediatorTest, session_with_multiple_surfaces_only_sends_needed_buffers) | 469 | TEST_F(SessionMediatorTest, session_with_multiple_surfaces_only_sends_needed_buffers) |
857 | @@ -473,7 +473,7 @@ | |||
858 | 473 | mp::ConnectParameters connect_parameters; | 473 | mp::ConnectParameters connect_parameters; |
859 | 474 | mp::Connection connection; | 474 | mp::Connection connection; |
860 | 475 | 475 | ||
862 | 476 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 476 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
863 | 477 | 477 | ||
864 | 478 | { | 478 | { |
865 | 479 | // AFAICS these values are stubs to set up the test condition, | 479 | // AFAICS these values are stubs to set up the test condition, |
866 | @@ -504,19 +504,19 @@ | |||
867 | 504 | .Times(4); | 504 | .Times(4); |
868 | 505 | 505 | ||
869 | 506 | mp::SurfaceParameters surface_request; | 506 | mp::SurfaceParameters surface_request; |
872 | 507 | mediator.create_surface(nullptr, &surface_request, &surface_response[0], null_callback.get()); | 507 | mediator->create_surface(nullptr, &surface_request, &surface_response[0], null_callback.get()); |
873 | 508 | mediator.create_surface(nullptr, &surface_request, &surface_response[1], null_callback.get()); | 508 | mediator->create_surface(nullptr, &surface_request, &surface_response[1], null_callback.get()); |
874 | 509 | buffer_request[0] = surface_response[0].id(); | 509 | buffer_request[0] = surface_response[0].id(); |
875 | 510 | buffer_request[1] = surface_response[1].id(); | 510 | buffer_request[1] = surface_response[1].id(); |
882 | 511 | mediator.next_buffer(nullptr, &buffer_request[0], &buffer_response[0], null_callback.get()); | 511 | mediator->next_buffer(nullptr, &buffer_request[0], &buffer_response[0], null_callback.get()); |
883 | 512 | mediator.next_buffer(nullptr, &buffer_request[1], &buffer_response[1], null_callback.get()); | 512 | mediator->next_buffer(nullptr, &buffer_request[1], &buffer_response[1], null_callback.get()); |
884 | 513 | mediator.next_buffer(nullptr, &buffer_request[0], &buffer_response[2], null_callback.get()); | 513 | mediator->next_buffer(nullptr, &buffer_request[0], &buffer_response[2], null_callback.get()); |
885 | 514 | mediator.next_buffer(nullptr, &buffer_request[1], &buffer_response[3], null_callback.get()); | 514 | mediator->next_buffer(nullptr, &buffer_request[1], &buffer_response[3], null_callback.get()); |
886 | 515 | mediator.next_buffer(nullptr, &buffer_request[0], &buffer_response[4], null_callback.get()); | 515 | mediator->next_buffer(nullptr, &buffer_request[0], &buffer_response[4], null_callback.get()); |
887 | 516 | mediator.next_buffer(nullptr, &buffer_request[1], &buffer_response[5], null_callback.get()); | 516 | mediator->next_buffer(nullptr, &buffer_request[1], &buffer_response[5], null_callback.get()); |
888 | 517 | } | 517 | } |
889 | 518 | 518 | ||
891 | 519 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 519 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
892 | 520 | } | 520 | } |
893 | 521 | 521 | ||
894 | 522 | TEST_F(SessionMediatorTest, buffer_resource_for_surface_unaffected_by_other_surfaces) | 522 | TEST_F(SessionMediatorTest, buffer_resource_for_surface_unaffected_by_other_surfaces) |
895 | @@ -527,7 +527,7 @@ | |||
896 | 527 | mp::ConnectParameters connect_parameters; | 527 | mp::ConnectParameters connect_parameters; |
897 | 528 | mp::Connection connection; | 528 | mp::Connection connection; |
898 | 529 | 529 | ||
900 | 530 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 530 | mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
901 | 531 | mp::SurfaceParameters surface_request; | 531 | mp::SurfaceParameters surface_request; |
902 | 532 | mp::Surface surface_response; | 532 | mp::Surface surface_response; |
903 | 533 | 533 | ||
904 | @@ -539,28 +539,28 @@ | |||
905 | 539 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_, _)) | 539 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_, _)) |
906 | 540 | .WillOnce(InvokeArgument<1>(&buffer)); | 540 | .WillOnce(InvokeArgument<1>(&buffer)); |
907 | 541 | 541 | ||
909 | 542 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); | 542 | mediator->create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); |
910 | 543 | mp::SurfaceId our_surface{surface_response.id()}; | 543 | mp::SurfaceId our_surface{surface_response.id()}; |
911 | 544 | 544 | ||
912 | 545 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); | 545 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); |
913 | 546 | 546 | ||
914 | 547 | /* Creating a new surface should not affect our surfaces' buffers */ | 547 | /* Creating a new surface should not affect our surfaces' buffers */ |
915 | 548 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_, _)).Times(0); | 548 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_, _)).Times(0); |
917 | 549 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); | 549 | mediator->create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); |
918 | 550 | 550 | ||
919 | 551 | mp::SurfaceId new_surface{surface_response.id()}; | 551 | mp::SurfaceId new_surface{surface_response.id()}; |
920 | 552 | mp::Buffer buffer_response; | 552 | mp::Buffer buffer_response; |
921 | 553 | 553 | ||
922 | 554 | /* Getting the next buffer of new surface should not affect our surfaces' buffers */ | 554 | /* Getting the next buffer of new surface should not affect our surfaces' buffers */ |
924 | 555 | mediator.next_buffer(nullptr, &new_surface, &buffer_response, null_callback.get()); | 555 | mediator->next_buffer(nullptr, &new_surface, &buffer_response, null_callback.get()); |
925 | 556 | 556 | ||
926 | 557 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); | 557 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); |
927 | 558 | 558 | ||
928 | 559 | /* Getting the next buffer of our surface should post the original */ | 559 | /* Getting the next buffer of our surface should post the original */ |
929 | 560 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(Eq(&buffer), _)).Times(1); | 560 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(Eq(&buffer), _)).Times(1); |
930 | 561 | 561 | ||
933 | 562 | mediator.next_buffer(nullptr, &our_surface, &buffer_response, null_callback.get()); | 562 | mediator->next_buffer(nullptr, &our_surface, &buffer_response, null_callback.get()); |
934 | 563 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 563 | mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
935 | 564 | } | 564 | } |
936 | 565 | 565 | ||
937 | 566 | TEST_F(SessionMediatorTest, display_config_request) | 566 | TEST_F(SessionMediatorTest, display_config_request) |
938 | @@ -601,13 +601,13 @@ | |||
939 | 601 | .InSequence(seq) | 601 | .InSequence(seq) |
940 | 602 | .WillOnce(Return(mt::fake_shared(stub_display_config))); | 602 | .WillOnce(Return(mt::fake_shared(stub_display_config))); |
941 | 603 | 603 | ||
943 | 604 | mf::SessionMediator session_mediator{ | 604 | auto const session_mediator = std::make_shared<mf::SessionMediator>( |
944 | 605 | shell, graphics_platform, mock_display_selector, | 605 | shell, graphics_platform, mock_display_selector, |
945 | 606 | surface_pixel_formats, report, | 606 | surface_pixel_formats, report, |
946 | 607 | std::make_shared<mtd::NullEventSink>(), resource_cache, | 607 | std::make_shared<mtd::NullEventSink>(), resource_cache, |
948 | 608 | std::make_shared<mtd::NullScreencast>()}; | 608 | std::make_shared<mtd::NullScreencast>()); |
949 | 609 | 609 | ||
951 | 610 | session_mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 610 | session_mediator->connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
952 | 611 | 611 | ||
953 | 612 | mp::DisplayConfiguration configuration_response; | 612 | mp::DisplayConfiguration configuration_response; |
954 | 613 | mp::DisplayConfiguration configuration; | 613 | mp::DisplayConfiguration configuration; |
955 | @@ -631,12 +631,12 @@ | |||
956 | 631 | disp1->set_power_mode(static_cast<uint32_t>(mir_power_mode_off)); | 631 | disp1->set_power_mode(static_cast<uint32_t>(mir_power_mode_off)); |
957 | 632 | disp1->set_orientation(mir_orientation_inverted); | 632 | disp1->set_orientation(mir_orientation_inverted); |
958 | 633 | 633 | ||
960 | 634 | session_mediator.configure_display(nullptr, &configuration, | 634 | session_mediator->configure_display(nullptr, &configuration, |
961 | 635 | &configuration_response, null_callback.get()); | 635 | &configuration_response, null_callback.get()); |
962 | 636 | 636 | ||
963 | 637 | EXPECT_THAT(configuration_response, mt::DisplayConfigMatches(std::cref(stub_display_config))); | 637 | EXPECT_THAT(configuration_response, mt::DisplayConfigMatches(std::cref(stub_display_config))); |
964 | 638 | 638 | ||
966 | 639 | session_mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 639 | session_mediator->disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
967 | 640 | } | 640 | } |
968 | 641 | 641 | ||
969 | 642 | TEST_F(SessionMediatorTest, fully_packs_buffer_for_create_screencast) | 642 | TEST_F(SessionMediatorTest, fully_packs_buffer_for_create_screencast) |
970 | @@ -649,7 +649,7 @@ | |||
971 | 649 | 649 | ||
972 | 650 | EXPECT_CALL(*graphics_platform, fill_ipc_package(_, &stub_buffer)); | 650 | EXPECT_CALL(*graphics_platform, fill_ipc_package(_, &stub_buffer)); |
973 | 651 | 651 | ||
975 | 652 | mediator.create_screencast(nullptr, &screencast_parameters, | 652 | mediator->create_screencast(nullptr, &screencast_parameters, |
976 | 653 | &screencast, null_callback.get()); | 653 | &screencast, null_callback.get()); |
977 | 654 | 654 | ||
978 | 655 | EXPECT_EQ(stub_buffer.id().as_uint32_t(), | 655 | EXPECT_EQ(stub_buffer.id().as_uint32_t(), |
979 | @@ -667,7 +667,7 @@ | |||
980 | 667 | EXPECT_CALL(*graphics_platform, fill_ipc_package(_, &stub_buffer)) | 667 | EXPECT_CALL(*graphics_platform, fill_ipc_package(_, &stub_buffer)) |
981 | 668 | .Times(0); | 668 | .Times(0); |
982 | 669 | 669 | ||
984 | 670 | mediator.screencast_buffer(nullptr, &screencast_id, | 670 | mediator->screencast_buffer(nullptr, &screencast_id, |
985 | 671 | &protobuf_buffer, null_callback.get()); | 671 | &protobuf_buffer, null_callback.get()); |
986 | 672 | 672 | ||
987 | 673 | EXPECT_EQ(stub_buffer.id().as_uint32_t(), | 673 | EXPECT_EQ(stub_buffer.id().as_uint32_t(), |
988 | 674 | 674 | ||
989 | === modified file 'tests/unit-tests/scene/test_surface.cpp' | |||
990 | --- tests/unit-tests/scene/test_surface.cpp 2014-02-06 14:45:58 +0000 | |||
991 | +++ tests/unit-tests/scene/test_surface.cpp 2014-02-06 14:45:58 +0000 | |||
992 | @@ -377,16 +377,6 @@ | |||
993 | 377 | EXPECT_FLOAT_EQ(alpha, compositing_criteria->alpha()); | 377 | EXPECT_FLOAT_EQ(alpha, compositing_criteria->alpha()); |
994 | 378 | } | 378 | } |
995 | 379 | 379 | ||
996 | 380 | TEST_F(SurfaceCreation, test_surface_force_requests_to_complete) | ||
997 | 381 | { | ||
998 | 382 | using namespace testing; | ||
999 | 383 | |||
1000 | 384 | EXPECT_CALL(*mock_buffer_stream, force_requests_to_complete()).Times(Exactly(1)); | ||
1001 | 385 | |||
1002 | 386 | ms::BasicSurface surf(stub_data, mock_buffer_stream, std::shared_ptr<mi::InputChannel>(), report); | ||
1003 | 387 | surf.force_requests_to_complete(); | ||
1004 | 388 | } | ||
1005 | 389 | |||
1006 | 390 | TEST_F(SurfaceCreation, test_surface_allow_framedropping) | 380 | TEST_F(SurfaceCreation, test_surface_allow_framedropping) |
1007 | 391 | { | 381 | { |
1008 | 392 | using namespace testing; | 382 | using namespace testing; |
1009 | 393 | 383 | ||
1010 | === modified file 'tests/unit-tests/scene/test_surface_stack.cpp' | |||
1011 | --- tests/unit-tests/scene/test_surface_stack.cpp 2014-02-06 14:45:58 +0000 | |||
1012 | +++ tests/unit-tests/scene/test_surface_stack.cpp 2014-02-06 14:45:58 +0000 | |||
1013 | @@ -75,7 +75,6 @@ | |||
1014 | 75 | virtual std::shared_ptr<mg::Buffer> snapshot_acquire(){ return std::shared_ptr<mg::Buffer>(); }; | 75 | virtual std::shared_ptr<mg::Buffer> snapshot_acquire(){ return std::shared_ptr<mg::Buffer>(); }; |
1015 | 76 | virtual void snapshot_release(std::shared_ptr<mg::Buffer> const&){} | 76 | virtual void snapshot_release(std::shared_ptr<mg::Buffer> const&){} |
1016 | 77 | virtual void force_client_abort() {} | 77 | virtual void force_client_abort() {} |
1017 | 78 | void force_requests_to_complete() {} | ||
1018 | 79 | virtual void allow_framedropping(bool) {} | 78 | virtual void allow_framedropping(bool) {} |
1019 | 80 | virtual mg::BufferProperties properties() const { return mg::BufferProperties{}; }; | 79 | virtual mg::BufferProperties properties() const { return mg::BufferProperties{}; }; |
1020 | 81 | void resize(const geom::Size &) override {} | 80 | void resize(const geom::Size &) override {} |