Mir

Merge lp:~vanvugt/mir/eliminate-stream-casts into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3856
Proposed branch: lp:~vanvugt/mir/eliminate-stream-casts
Merge into: lp:mir
Diff against target: 1064 lines (+118/-158)
27 files modified
src/client/buffer_stream.h (+2/-2)
src/client/connection_surface_map.cpp (+3/-3)
src/client/connection_surface_map.h (+4/-4)
src/client/cursor_configuration.h (+2/-10)
src/client/error_stream.h (+2/-2)
src/client/mir_buffer_stream_api.cpp (+17/-38)
src/client/mir_connection.cpp (+9/-14)
src/client/mir_connection.h (+4/-5)
src/client/mir_cursor_api.cpp (+2/-4)
src/client/mir_debug_api.cpp (+1/-1)
src/client/mir_screencast.cpp (+2/-2)
src/client/mir_screencast.h (+3/-4)
src/client/mir_screencast_api.cpp (+1/-1)
src/client/mir_surface.cpp (+3/-3)
src/client/mir_surface.h (+5/-6)
src/client/mir_surface_api.cpp (+3/-4)
src/client/render_surface.cpp (+1/-2)
src/client/rpc/mir_protobuf_rpc_channel.cpp (+2/-2)
src/client/screencast_stream.h (+2/-2)
src/client/surface_map.h (+3/-3)
src/include/client/mir/mir_buffer_stream.h (+20/-18)
src/platforms/android/client/android_client_platform.cpp (+2/-3)
tests/include/mir/test/doubles/mock_mir_buffer_stream.h (+5/-5)
tests/unit-tests/client/test_client_mir_surface.cpp (+8/-8)
tests/unit-tests/client/test_connection_resource_map.cpp (+4/-4)
tests/unit-tests/client/test_mir_screencast.cpp (+2/-2)
tests/unit-tests/client/test_protobuf_rpc_channel.cpp (+6/-6)
To merge this branch: bzr merge lp:~vanvugt/mir/eliminate-stream-casts
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Approve
Kevin DuBois (community) Approve
Review via email: mp+312133@code.launchpad.net

Commit message

Simplify client buffer stream types and eliminate lots of casts.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3857
https://mir-jenkins.ubuntu.com/job/mir-ci/2287/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2971/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3036
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3028
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3028
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3028
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3000
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3000/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3000
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3000/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3000
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3000/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3000
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3000/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3000
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3000/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3000/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2287/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3858
https://mir-jenkins.ubuntu.com/job/mir-ci/2289/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2974
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3039
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3003
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3003/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3003
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3003/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3003
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3003/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3003
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3003/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3003
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3003/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3003
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3003/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2289/rebuild

review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

much cleaner, lgtm

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

yes

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/825/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2978/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/872/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3043
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3035
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3035
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3035
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3007
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3007/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3007
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3007/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3007/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3007
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3007/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3007
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3007/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3007
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3007/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Mir CI Bot (mir-ci-bot) :
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/buffer_stream.h'
2--- src/client/buffer_stream.h 2016-11-24 10:17:52 +0000
3+++ src/client/buffer_stream.h 2016-11-30 09:56:15 +0000
4@@ -22,7 +22,7 @@
5 #include "mir_wait_handle.h"
6 #include "mir/egl_native_surface.h"
7 #include "mir/client_buffer.h"
8-#include "mir/client_buffer_stream.h"
9+#include "mir/mir_buffer_stream.h"
10 #include "mir/geometry/size.h"
11 #include "mir/optional_value.h"
12 #include "buffer_stream_configuration.h"
13@@ -69,7 +69,7 @@
14 struct MemoryRegion;
15 class SurfaceMap;
16 class BufferDepository;
17-class BufferStream : public EGLNativeSurface, public ClientBufferStream
18+class BufferStream : public EGLNativeSurface, public MirBufferStream
19 {
20 public:
21 BufferStream(
22
23=== modified file 'src/client/connection_surface_map.cpp'
24--- src/client/connection_surface_map.cpp 2016-10-13 16:32:59 +0000
25+++ src/client/connection_surface_map.cpp 2016-11-30 09:56:15 +0000
26@@ -58,7 +58,7 @@
27 }
28
29 void mcl::ConnectionSurfaceMap::with_stream_do(
30- mf::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const
31+ mf::BufferStreamId stream_id, std::function<void(MirBufferStream*)> const& exec) const
32 {
33 std::shared_lock<decltype(stream_guard)> lk(stream_guard);
34 auto const it = streams.find(stream_id);
35@@ -76,7 +76,7 @@
36 }
37 }
38
39-void mcl::ConnectionSurfaceMap::with_all_streams_do(std::function<void(ClientBufferStream*)> const& fn) const
40+void mcl::ConnectionSurfaceMap::with_all_streams_do(std::function<void(MirBufferStream*)> const& fn) const
41 {
42 std::shared_lock<decltype(stream_guard)> lk(stream_guard);
43 for(auto const& stream : streams)
44@@ -84,7 +84,7 @@
45 }
46
47 void mcl::ConnectionSurfaceMap::insert(
48- mf::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& stream)
49+ mf::BufferStreamId stream_id, std::shared_ptr<MirBufferStream> const& stream)
50 {
51 std::lock_guard<decltype(stream_guard)> lk(stream_guard);
52 streams[stream_id] = stream;
53
54=== modified file 'src/client/connection_surface_map.h'
55--- src/client/connection_surface_map.h 2016-10-11 18:59:08 +0000
56+++ src/client/connection_surface_map.h 2016-11-30 09:56:15 +0000
57@@ -38,10 +38,10 @@
58 void insert(frontend::SurfaceId surface_id, std::shared_ptr<MirSurface> const& surface);
59 void erase(frontend::SurfaceId surface_id);
60
61- void with_stream_do(frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const override;
62- void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const override;
63+ void with_stream_do(frontend::BufferStreamId stream_id, std::function<void(MirBufferStream*)> const& exec) const override;
64+ void with_all_streams_do(std::function<void(MirBufferStream*)> const&) const override;
65
66- void insert(frontend::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& chain);
67+ void insert(frontend::BufferStreamId stream_id, std::shared_ptr<MirBufferStream> const& chain);
68 void insert(frontend::BufferStreamId stream_id, std::shared_ptr<MirPresentationChain> const& chain);
69 void erase(frontend::BufferStreamId surface_id);
70
71@@ -57,7 +57,7 @@
72 std::shared_timed_mutex mutable guard;
73 std::unordered_map<frontend::SurfaceId, std::shared_ptr<MirSurface>> surfaces;
74 std::shared_timed_mutex mutable stream_guard;
75- std::unordered_map<frontend::BufferStreamId, std::shared_ptr<ClientBufferStream>> streams;
76+ std::unordered_map<frontend::BufferStreamId, std::shared_ptr<MirBufferStream>> streams;
77 std::unordered_map<frontend::BufferStreamId, std::shared_ptr<MirPresentationChain>> chains;
78 std::shared_timed_mutex mutable buffer_guard;
79 std::unordered_map<int, std::shared_ptr<MirBuffer>> buffers;
80
81=== modified file 'src/client/cursor_configuration.h'
82--- src/client/cursor_configuration.h 2015-04-28 07:54:10 +0000
83+++ src/client/cursor_configuration.h 2016-11-30 09:56:15 +0000
84@@ -21,23 +21,15 @@
85
86 #include <string>
87
88-namespace mir
89-{
90-namespace client
91-{
92-class ClientBufferStream;
93-}
94-}
95-
96 // Parameters for configuring the apperance and behavior of the system cursor.
97 // Will grow to include cursors specified by raw RGBA data, hotspots, etc...
98 struct MirCursorConfiguration
99 {
100 MirCursorConfiguration(char const* name);
101- MirCursorConfiguration(mir::client::ClientBufferStream const* stream, int hotspot_x, int hotspot_y);
102+ MirCursorConfiguration(MirBufferStream const* stream, int hotspot_x, int hotspot_y);
103
104 std::string name;
105- mir::client::ClientBufferStream const* stream;
106+ MirBufferStream const* stream;
107 int hotspot_x;
108 int hotspot_y;
109 };
110
111=== modified file 'src/client/error_stream.h'
112--- src/client/error_stream.h 2016-11-23 04:37:50 +0000
113+++ src/client/error_stream.h 2016-11-30 09:56:15 +0000
114@@ -19,13 +19,13 @@
115 #ifndef MIR_CLIENT_ERROR_STREAM_H_
116 #define MIR_CLIENT_ERROR_STREAM_H_
117
118-#include "mir/client_buffer_stream.h"
119+#include "mir/mir_buffer_stream.h"
120
121 namespace mir
122 {
123 namespace client
124 {
125-class ErrorStream : public ClientBufferStream
126+class ErrorStream : public MirBufferStream
127 {
128 public:
129 ErrorStream(
130
131=== modified file 'src/client/mir_buffer_stream_api.cpp'
132--- src/client/mir_buffer_stream_api.cpp 2016-11-14 21:59:19 +0000
133+++ src/client/mir_buffer_stream_api.cpp 2016-11-30 09:56:15 +0000
134@@ -88,9 +88,8 @@
135 mir_buffer_stream_callback callback,
136 void* context)
137 {
138- auto bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
139- auto connection = bs->connection();
140- return connection->release_buffer_stream(bs, callback, context);
141+ auto connection = buffer_stream->connection();
142+ return connection->release_buffer_stream(buffer_stream, callback, context);
143 }
144
145 void mir_buffer_stream_release_sync(MirBufferStream *buffer_stream)
146@@ -101,8 +100,7 @@
147 void mir_buffer_stream_get_current_buffer(MirBufferStream* buffer_stream, MirNativeBuffer** buffer_package_out)
148 try
149 {
150- mcl::ClientBufferStream *bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
151- *buffer_package_out = bs->get_current_buffer_package();
152+ *buffer_package_out = buffer_stream->get_current_buffer_package();
153 }
154 catch (std::exception const& ex)
155 {
156@@ -115,10 +113,9 @@
157 void* context)
158 try
159 {
160- mcl::ClientBufferStream *bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
161- return bs->next_buffer([bs, callback, context]{
162+ return buffer_stream->next_buffer([buffer_stream, callback, context]{
163 if (callback)
164- callback(reinterpret_cast<MirBufferStream*>(bs), context);
165+ callback(buffer_stream, context);
166 });
167 }
168 catch (std::exception const& ex)
169@@ -146,9 +143,7 @@
170 MirGraphicsRegion *region_out)
171 try
172 {
173- mcl::ClientBufferStream *bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
174-
175- auto secured_region = bs->secure_for_cpu_write();
176+ auto secured_region = buffer_stream->secure_for_cpu_write();
177 region_out->width = secured_region->width.as_uint32_t();
178 region_out->height = secured_region->height.as_uint32_t();
179 region_out->stride = secured_region->stride.as_uint32_t();
180@@ -163,8 +158,7 @@
181 MirEGLNativeWindowType mir_buffer_stream_get_egl_native_window(MirBufferStream* buffer_stream)
182 try
183 {
184- mcl::ClientBufferStream *bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
185- return reinterpret_cast<MirEGLNativeWindowType>(bs->egl_native_window());
186+ return reinterpret_cast<MirEGLNativeWindowType>(buffer_stream->egl_native_window());
187 }
188 catch (std::exception const& ex)
189 {
190@@ -175,8 +169,7 @@
191 MirPlatformType mir_buffer_stream_get_platform_type(MirBufferStream* buffer_stream)
192 try
193 {
194- mcl::ClientBufferStream *bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
195- return bs->platform_type();
196+ return buffer_stream->platform_type();
197 }
198 catch (std::exception const& ex)
199 {
200@@ -186,14 +179,12 @@
201
202 bool mir_buffer_stream_is_valid(MirBufferStream* opaque_stream)
203 {
204- auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(opaque_stream);
205- return buffer_stream->valid();
206+ return opaque_stream->valid();
207 }
208
209-MirWaitHandle* mir_buffer_stream_set_scale(MirBufferStream* opaque_stream, float scale)
210+MirWaitHandle* mir_buffer_stream_set_scale(MirBufferStream* buffer_stream, float scale)
211 try
212 {
213- auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(opaque_stream);
214 if (!buffer_stream)
215 return nullptr;
216
217@@ -212,19 +203,17 @@
218 wh->wait_for_all();
219 }
220
221-char const* mir_buffer_stream_get_error_message(MirBufferStream* opaque_stream)
222+char const* mir_buffer_stream_get_error_message(MirBufferStream* buffer_stream)
223 {
224- auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(opaque_stream);
225 return buffer_stream->get_error_message();
226 }
227
228-MirWaitHandle* mir_buffer_stream_set_swapinterval(MirBufferStream* stream, int interval)
229+MirWaitHandle* mir_buffer_stream_set_swapinterval(MirBufferStream* buffer_stream, int interval)
230 try
231 {
232 if ((interval < 0) || (interval > 1))
233 return nullptr;
234
235- auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(stream);
236 if (!buffer_stream)
237 return nullptr;
238
239@@ -236,10 +225,9 @@
240 return nullptr;
241 }
242
243-int mir_buffer_stream_get_swapinterval(MirBufferStream* stream)
244+int mir_buffer_stream_get_swapinterval(MirBufferStream* buffer_stream)
245 try
246 {
247- auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(stream);
248 if (buffer_stream)
249 return buffer_stream->swap_interval();
250 else
251@@ -255,8 +243,7 @@
252 try
253 {
254 mir::require(stream);
255- if (auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(stream))
256- return buffer_stream->set_size(mir::geometry::Size{width, height});
257+ return stream->set_size(mir::geometry::Size{width, height});
258 }
259 catch (std::exception const& ex)
260 {
261@@ -269,17 +256,9 @@
262 mir::require(stream);
263 mir::require(width);
264 mir::require(height);
265- if (auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(stream))
266- {
267- auto size = buffer_stream->size();
268- *width = size.width.as_int();
269- *height = size.height.as_int();
270- }
271- else
272- {
273- *width = -1;
274- *height = -1;
275- }
276+ auto size = stream->size();
277+ *width = size.width.as_int();
278+ *height = size.height.as_int();
279 }
280 catch (std::exception const& ex)
281 {
282
283=== modified file 'src/client/mir_connection.cpp'
284--- src/client/mir_connection.cpp 2016-11-22 18:18:59 +0000
285+++ src/client/mir_connection.cpp 2016-11-30 09:56:15 +0000
286@@ -386,7 +386,7 @@
287 std::string name{spec.surface_name.is_set() ?
288 spec.surface_name.value() : ""};
289
290- std::shared_ptr<mcl::ClientBufferStream> default_stream {nullptr};
291+ std::shared_ptr<MirBufferStream> default_stream {nullptr};
292 if (surface_proto->buffer_stream().has_id())
293 {
294 try
295@@ -465,7 +465,7 @@
296
297 struct MirConnection::StreamRelease
298 {
299- mcl::ClientBufferStream* stream;
300+ MirBufferStream* stream;
301 MirWaitHandle* handle;
302 mir_buffer_stream_callback callback;
303 void* context;
304@@ -476,7 +476,7 @@
305 void MirConnection::released(StreamRelease data)
306 {
307 if (data.callback)
308- data.callback(reinterpret_cast<MirBufferStream*>(data.stream), data.context);
309+ data.callback(data.stream, data.context);
310 if (data.handle)
311 data.handle->result_received();
312
313@@ -634,7 +634,7 @@
314 std::lock_guard<decltype(mutex)> lock(mutex);
315 disconnecting = true;
316 }
317- surface_map->with_all_streams_do([](mcl::ClientBufferStream* receiver)
318+ surface_map->with_all_streams_do([](MirBufferStream* receiver)
319 {
320 receiver->buffer_unavailable();
321 });
322@@ -839,10 +839,7 @@
323 surface_map->insert(mf::BufferStreamId(protobuf_bs->id().value()), stream);
324
325 if (request->mbs_callback)
326- request->mbs_callback(
327- reinterpret_cast<MirBufferStream*>(
328- dynamic_cast<mcl::ClientBufferStream*>(stream.get())),
329- request->context);
330+ request->mbs_callback(stream.get(), request->context);
331
332 request->wh->result_received();
333 }
334@@ -931,15 +928,13 @@
335
336 if (request->mbs_callback)
337 {
338- request->mbs_callback(
339- reinterpret_cast<MirBufferStream*>(
340- dynamic_cast<mcl::ClientBufferStream*>(stream.get())), request->context);
341+ request->mbs_callback(stream.get(), request->context);
342 }
343
344 request->wh->result_received();
345 }
346
347-std::shared_ptr<mir::client::ClientBufferStream> MirConnection::make_consumer_stream(
348+std::shared_ptr<MirBufferStream> MirConnection::make_consumer_stream(
349 mp::BufferStream const& protobuf_bs)
350 {
351 return std::make_shared<mcl::ScreencastStream>(
352@@ -1144,7 +1139,7 @@
353 }
354
355 MirWaitHandle* MirConnection::release_buffer_stream(
356- mir::client::ClientBufferStream* stream,
357+ MirBufferStream* stream,
358 mir_buffer_stream_callback callback,
359 void *context)
360 {
361@@ -1167,7 +1162,7 @@
362 return new_wait_handle;
363 }
364
365-void MirConnection::release_consumer_stream(mir::client::ClientBufferStream* stream)
366+void MirConnection::release_consumer_stream(MirBufferStream* stream)
367 {
368 surface_map->erase(stream->rpc_id());
369 }
370
371=== modified file 'src/client/mir_connection.h'
372--- src/client/mir_connection.h 2016-11-14 21:59:19 +0000
373+++ src/client/mir_connection.h 2016-11-30 09:56:15 +0000
374@@ -60,7 +60,6 @@
375 {
376 class ConnectionConfiguration;
377 class ClientPlatformFactory;
378-class ClientBufferStream;
379 class ConnectionSurfaceMap;
380 class DisplayConfiguration;
381 class EventHandlerRegister;
382@@ -146,7 +145,7 @@
383 void available_surface_formats(MirPixelFormat* formats,
384 unsigned int formats_size, unsigned int& valid_formats);
385
386- std::shared_ptr<mir::client::ClientBufferStream> make_consumer_stream(
387+ std::shared_ptr<MirBufferStream> make_consumer_stream(
388 mir::protobuf::BufferStream const& protobuf_bs);
389
390 typedef void (*buffer_stream_callback)(mir::client::BufferStream* stream, void* context);
391@@ -163,7 +162,7 @@
392 MirRenderSurface* render_surface,
393 mir::protobuf::BufferStream const& a_protobuf_bs);
394 MirWaitHandle* release_buffer_stream(
395- mir::client::ClientBufferStream*,
396+ MirBufferStream*,
397 mir_buffer_stream_callback callback,
398 void *context);
399
400@@ -172,14 +171,14 @@
401 void *context);
402 void release_presentation_chain(MirPresentationChain* context);
403
404- void release_consumer_stream(mir::client::ClientBufferStream*);
405+ void release_consumer_stream(MirBufferStream*);
406
407 static bool is_valid(MirConnection *connection);
408
409 EGLNativeDisplayType egl_native_display();
410 MirPixelFormat egl_pixel_format(EGLDisplay, EGLConfig) const;
411
412- void on_stream_created(int id, mir::client::ClientBufferStream* stream);
413+ void on_stream_created(int id, MirBufferStream* stream);
414
415 MirWaitHandle* configure_display(MirDisplayConfiguration* configuration);
416 void done_display_configure();
417
418=== modified file 'src/client/mir_cursor_api.cpp'
419--- src/client/mir_cursor_api.cpp 2016-10-12 10:12:15 +0000
420+++ src/client/mir_cursor_api.cpp 2016-11-30 09:56:15 +0000
421@@ -25,8 +25,6 @@
422
423 #include <memory>
424
425-namespace mcl = mir::client;
426-
427 // Cursor names are from CSS3: https://www.w3.org/TR/css-ui-3/#propdef-cursor
428 extern "C" char const* const mir_default_cursor_name = "default";
429 extern "C" char const* const mir_disabled_cursor_name = "none";
430@@ -51,7 +49,7 @@
431 {
432 }
433
434-MirCursorConfiguration::MirCursorConfiguration(mcl::ClientBufferStream const* stream, int hotspot_x, int hotspot_y) :
435+MirCursorConfiguration::MirCursorConfiguration(MirBufferStream const* stream, int hotspot_x, int hotspot_y) :
436 stream(stream),
437 hotspot_x(hotspot_x),
438 hotspot_y(hotspot_y)
439@@ -81,7 +79,7 @@
440 {
441 try
442 {
443- return new MirCursorConfiguration(reinterpret_cast<mcl::ClientBufferStream const*>(stream), hotspot_x, hotspot_y);
444+ return new MirCursorConfiguration(stream, hotspot_x, hotspot_y);
445 }
446 catch (std::exception const& ex)
447 {
448
449=== modified file 'src/client/mir_debug_api.cpp'
450--- src/client/mir_debug_api.cpp 2016-11-22 03:42:44 +0000
451+++ src/client/mir_debug_api.cpp 2016-11-30 09:56:15 +0000
452@@ -19,7 +19,7 @@
453 #include "mir_toolkit/debug/surface.h"
454
455 #include "mir_surface.h"
456-#include "mir/client_buffer_stream.h"
457+#include "mir/mir_buffer_stream.h"
458
459 uint32_t mir_debug_surface_current_buffer_id(MirSurface* surface)
460 {
461
462=== modified file 'src/client/mir_screencast.cpp'
463--- src/client/mir_screencast.cpp 2016-11-22 03:42:44 +0000
464+++ src/client/mir_screencast.cpp 2016-11-30 09:56:15 +0000
465@@ -20,7 +20,7 @@
466 #include "mir_connection.h"
467 #include "mir_protobuf.pb.h"
468 #include "make_protobuf_object.h"
469-#include "mir/client_buffer_stream.h"
470+#include "mir/mir_buffer_stream.h"
471 #include "mir/frontend/client_constants.h"
472 #include "mir_toolkit/mir_native_buffer.h"
473
474@@ -205,7 +205,7 @@
475 release_wait_handle.result_received();
476 }
477
478-mir::client::ClientBufferStream* MirScreencast::get_buffer_stream()
479+MirBufferStream* MirScreencast::get_buffer_stream()
480 {
481 std::lock_guard<decltype(mutex)> lock(mutex);
482 return buffer_stream.get();
483
484=== modified file 'src/client/mir_screencast.h'
485--- src/client/mir_screencast.h 2016-07-18 07:38:38 +0000
486+++ src/client/mir_screencast.h 2016-11-30 09:56:15 +0000
487@@ -42,8 +42,7 @@
488 {
489 class DisplayServer;
490 }
491-class ClientBufferStreamFactory;
492-class ClientBufferStream;
493+class MirBufferStreamFactory;
494 }
495 }
496
497@@ -84,7 +83,7 @@
498
499 EGLNativeWindowType egl_native_window();
500
501- mir::client::ClientBufferStream* get_buffer_stream();
502+ MirBufferStream* get_buffer_stream();
503
504 private:
505 void screencast_created(
506@@ -95,7 +94,7 @@
507 std::mutex mutable mutex;
508 mir::client::rpc::DisplayServer* const server{nullptr};
509 MirConnection* const connection{nullptr};
510- std::shared_ptr<mir::client::ClientBufferStream> buffer_stream;
511+ std::shared_ptr<MirBufferStream> buffer_stream;
512
513 std::unique_ptr<mir::protobuf::Screencast> const protobuf_screencast;
514 std::unique_ptr<mir::protobuf::Void> const protobuf_void;
515
516=== modified file 'src/client/mir_screencast_api.cpp'
517--- src/client/mir_screencast_api.cpp 2016-07-18 07:38:38 +0000
518+++ src/client/mir_screencast_api.cpp 2016-11-30 09:56:15 +0000
519@@ -124,7 +124,7 @@
520 MirBufferStream *mir_screencast_get_buffer_stream(MirScreencast *screencast)
521 try
522 {
523- return reinterpret_cast<MirBufferStream*>(screencast->get_buffer_stream());
524+ return screencast->get_buffer_stream();
525 }
526 catch (std::exception const& ex)
527 {
528
529=== modified file 'src/client/mir_surface.cpp'
530--- src/client/mir_surface.cpp 2016-11-22 03:42:44 +0000
531+++ src/client/mir_surface.cpp 2016-11-30 09:56:15 +0000
532@@ -25,7 +25,7 @@
533 #include "mir_toolkit/mir_client_library.h"
534 #include "mir/frontend/client_constants.h"
535 #include "mir/client_buffer.h"
536-#include "mir/client_buffer_stream.h"
537+#include "mir/mir_buffer_stream.h"
538 #include "mir/dispatch/threaded_dispatcher.h"
539 #include "mir/input/input_platform.h"
540 #include "mir/input/xkb_mapper.h"
541@@ -109,7 +109,7 @@
542 MirConnection *allocating_connection,
543 mclr::DisplayServer& the_server,
544 mclr::DisplayServerDebug* debug,
545- std::shared_ptr<mcl::ClientBufferStream> const& buffer_stream,
546+ std::shared_ptr<MirBufferStream> const& buffer_stream,
547 std::shared_ptr<mircv::InputPlatform> const& input_platform,
548 MirSurfaceSpec const& spec,
549 mir::protobuf::Surface const& surface_proto,
550@@ -504,7 +504,7 @@
551 google::protobuf::NewCallback(google::protobuf::DoNothing));
552 }
553
554-mir::client::ClientBufferStream* MirSurface::get_buffer_stream()
555+MirBufferStream* MirSurface::get_buffer_stream()
556 {
557 std::lock_guard<decltype(mutex)> lock(mutex);
558
559
560=== modified file 'src/client/mir_surface.h'
561--- src/client/mir_surface.h 2016-11-22 03:42:44 +0000
562+++ src/client/mir_surface.h 2016-11-30 09:56:15 +0000
563@@ -18,7 +18,7 @@
564 #ifndef MIR_CLIENT_MIR_SURFACE_H_
565 #define MIR_CLIENT_MIR_SURFACE_H_
566
567-#include "mir/client_buffer_stream.h"
568+#include "mir/mir_buffer_stream.h"
569 #include "mir_wait_handle.h"
570 #include "rpc/mir_display_server.h"
571 #include "rpc/mir_display_server_debug.h"
572@@ -68,8 +68,7 @@
573 }
574
575 class ClientBuffer;
576-class ClientBufferStream;
577-class ClientBufferStreamFactory;
578+class MirBufferStreamFactory;
579
580 struct MemoryRegion;
581 }
582@@ -164,7 +163,7 @@
583 MirConnection *allocating_connection,
584 mir::client::rpc::DisplayServer& server,
585 mir::client::rpc::DisplayServerDebug* debug,
586- std::shared_ptr<mir::client::ClientBufferStream> const& buffer_stream,
587+ std::shared_ptr<MirBufferStream> const& buffer_stream,
588 std::shared_ptr<mir::input::receiver::InputPlatform> const& input_platform,
589 MirSurfaceSpec const& spec, mir::protobuf::Surface const& surface_proto,
590 std::shared_ptr<MirWaitHandle> const& handle);
591@@ -198,7 +197,7 @@
592
593 void request_and_wait_for_configure(MirSurfaceAttrib a, int value);
594
595- mir::client::ClientBufferStream* get_buffer_stream();
596+ MirBufferStream* get_buffer_stream();
597
598 MirWaitHandle* modify(MirSurfaceSpec const& changes);
599
600@@ -233,7 +232,7 @@
601 MirWaitHandle persistent_id_wait_handle;
602
603 //Deprecated functions can cause MirSurfaces to be created with a default stream
604- std::shared_ptr<mir::client::ClientBufferStream> default_stream;
605+ std::shared_ptr<MirBufferStream> default_stream;
606 std::shared_ptr<mir::input::receiver::InputPlatform> const input_platform;
607 std::shared_ptr<mir::input::receiver::XKBMapper> const keymapper;
608
609
610=== modified file 'src/client/mir_surface_api.cpp'
611--- src/client/mir_surface_api.cpp 2016-11-17 21:37:04 +0000
612+++ src/client/mir_surface_api.cpp 2016-11-30 09:56:15 +0000
613@@ -524,7 +524,7 @@
614 MirBufferStream *mir_surface_get_buffer_stream(MirSurface *surface)
615 try
616 {
617- return reinterpret_cast<MirBufferStream*>(surface->get_buffer_stream());
618+ return surface->get_buffer_stream();
619 }
620 catch (std::exception const& ex)
621 {
622@@ -576,7 +576,7 @@
623 mir::require(mir_buffer_stream_is_valid(streams[i].stream));
624 copy.emplace_back(ContentInfo{
625 mir::geometry::Displacement{streams[i].displacement_x, streams[i].displacement_y},
626- reinterpret_cast<mcl::ClientBufferStream*>(streams[i].stream)->rpc_id().as_value(),
627+ streams[i].stream->rpc_id().as_value(),
628 {}});
629 }
630 spec->streams = copy;
631@@ -616,8 +616,7 @@
632 try
633 {
634 mir::require(spec && stream);
635- auto bs = reinterpret_cast<mcl::ClientBufferStream*>(stream);
636- ContentInfo info{{displacement_x, displacement_y}, bs->rpc_id().as_value(), mir::geometry::Size{width, height}};
637+ ContentInfo info{{displacement_x, displacement_y}, stream->rpc_id().as_value(), mir::geometry::Size{width, height}};
638
639 if (spec->streams.is_set())
640 spec->streams.value().push_back(info);
641
642=== modified file 'src/client/render_surface.cpp'
643--- src/client/render_surface.cpp 2016-11-22 18:44:52 +0000
644+++ src/client/render_surface.cpp 2016-11-30 09:56:15 +0000
645@@ -76,8 +76,7 @@
646 }
647 }
648
649- return reinterpret_cast<MirBufferStream*>(
650- dynamic_cast<ClientBufferStream*>(stream_from_id.get()));
651+ return stream_from_id.get();
652 }
653
654 geom::Size mcl::RenderSurface::size() const
655
656=== modified file 'src/client/rpc/mir_protobuf_rpc_channel.cpp'
657--- src/client/rpc/mir_protobuf_rpc_channel.cpp 2016-11-15 20:53:57 +0000
658+++ src/client/rpc/mir_protobuf_rpc_channel.cpp 2016-11-30 09:56:15 +0000
659@@ -105,7 +105,7 @@
660 if (auto map = surface_map.lock())
661 {
662 map->with_all_streams_do(
663- [](mcl::ClientBufferStream* receiver) {
664+ [](MirBufferStream* receiver) {
665 if (receiver) receiver->buffer_unavailable();
666 });
667 }
668@@ -313,7 +313,7 @@
669 if (seq.buffer_request().has_id())
670 {
671 map->with_stream_do(mf::BufferStreamId(seq.buffer_request().id().value()),
672- [&] (mcl::ClientBufferStream* receiver) {
673+ [&] (MirBufferStream* receiver) {
674 receiver->buffer_available(seq.buffer_request().buffer());
675 });
676 }
677
678=== modified file 'src/client/screencast_stream.h'
679--- src/client/screencast_stream.h 2016-11-22 03:42:44 +0000
680+++ src/client/screencast_stream.h 2016-11-30 09:56:15 +0000
681@@ -22,7 +22,7 @@
682 #include "mir_wait_handle.h"
683 #include "mir/egl_native_surface.h"
684 #include "mir/client_buffer.h"
685-#include "mir/client_buffer_stream.h"
686+#include "mir/mir_buffer_stream.h"
687 #include "mir/geometry/size.h"
688
689 #include "mir_toolkit/client_types.h"
690@@ -63,7 +63,7 @@
691 class ClientPlatform;
692 class PerfReport;
693 struct MemoryRegion;
694-class ScreencastStream : public EGLNativeSurface, public ClientBufferStream
695+class ScreencastStream : public EGLNativeSurface, public MirBufferStream
696 {
697 public:
698 ScreencastStream(
699
700=== modified file 'src/client/surface_map.h'
701--- src/client/surface_map.h 2016-07-18 07:38:38 +0000
702+++ src/client/surface_map.h 2016-11-30 09:56:15 +0000
703@@ -25,6 +25,7 @@
704 #include <memory>
705
706 struct MirSurface;
707+struct MirBufferStream;
708
709 namespace mir
710 {
711@@ -35,7 +36,6 @@
712 namespace client
713 {
714 class MirBuffer;
715-class ClientBufferStream;
716
717 class SurfaceMap
718 {
719@@ -43,8 +43,8 @@
720 virtual void with_surface_do(
721 frontend::SurfaceId surface_id, std::function<void(MirSurface*)> const& exec) const = 0;
722 virtual void with_stream_do(
723- frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const = 0;
724- virtual void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const = 0;
725+ frontend::BufferStreamId stream_id, std::function<void(MirBufferStream*)> const& exec) const = 0;
726+ virtual void with_all_streams_do(std::function<void(MirBufferStream*)> const&) const = 0;
727 virtual std::shared_ptr<MirBuffer> buffer(int buffer_id) const = 0;
728 virtual void insert(int buffer_id, std::shared_ptr<MirBuffer> const& buffer) = 0;
729 virtual void erase(int buffer_id) = 0;
730
731=== renamed file 'src/include/client/mir/client_buffer_stream.h' => 'src/include/client/mir/mir_buffer_stream.h'
732--- src/include/client/mir/client_buffer_stream.h 2016-11-22 03:42:44 +0000
733+++ src/include/client/mir/mir_buffer_stream.h 2016-11-30 09:56:15 +0000
734@@ -16,8 +16,11 @@
735 * Authored by: Robert Carr <robert.carr@canonical.com>
736 */
737
738-#ifndef MIR_CLIENT_CLIENT_BUFFER_STREAM_H_
739-#define MIR_CLIENT_CLIENT_BUFFER_STREAM_H_
740+// MIR_MIR_? Yes.
741+// The internal interface is mir/mir_buffer_stream.h
742+// The public client API is mir_toolkit/mir_buffer_stream.h
743+#ifndef MIR_MIR_BUFFER_STREAM_H_
744+#define MIR_MIR_BUFFER_STREAM_H_
745
746 #include "mir/frontend/buffer_stream_id.h"
747 #include "mir/geometry/size.h"
748@@ -30,7 +33,7 @@
749 #include <EGL/eglplatform.h>
750
751 /*
752- * ClientBufferStream::egl_native_window() returns EGLNativeWindowType.
753+ * MirBufferStream::egl_native_window() returns EGLNativeWindowType.
754 *
755 * EGLNativeWindowType is an EGL platform-specific type that is typically a
756 * (possibly slightly obfuscated) pointer. This makes our client module ABI
757@@ -48,7 +51,7 @@
758 static_assert(
759 sizeof(EGLNativeWindowType) == sizeof(void*) &&
760 std::is_pod<EGLNativeWindowType>::value,
761- "The ClientBufferStream requires that EGLNativeWindowType be no-op convertible to void*");
762+ "The MirBufferStream requires that EGLNativeWindowType be no-op convertible to void*");
763
764 #undef EGLNativeWindowType
765 #define EGLNativeWindowType void*
766@@ -66,19 +69,21 @@
767 {
768 class ClientBuffer;
769 class MemoryRegion;
770+}
771+}
772
773-class ClientBufferStream
774+struct MirBufferStream
775 {
776 public:
777- virtual ~ClientBufferStream() = default;
778+ virtual ~MirBufferStream() = default;
779
780 virtual MirSurfaceParameters get_parameters() const = 0;
781- virtual std::shared_ptr<ClientBuffer> get_current_buffer() = 0;
782+ virtual std::shared_ptr<mir::client::ClientBuffer> get_current_buffer() = 0;
783 virtual uint32_t get_current_buffer_id() = 0;
784 virtual EGLNativeWindowType egl_native_window() = 0;
785 virtual MirWaitHandle* next_buffer(std::function<void()> const& done) = 0;
786
787- virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;
788+ virtual std::shared_ptr<mir::client::MemoryRegion> secure_for_cpu_write() = 0;
789
790 virtual int swap_interval() const = 0;
791 virtual MirWaitHandle* set_swap_interval(int interval) = 0;
792@@ -86,11 +91,11 @@
793 virtual MirNativeBuffer* get_current_buffer_package() = 0;
794 virtual MirPlatformType platform_type() = 0;
795
796- virtual frontend::BufferStreamId rpc_id() const = 0;
797+ virtual mir::frontend::BufferStreamId rpc_id() const = 0;
798
799 virtual bool valid() const = 0;
800- virtual void set_size(geometry::Size) = 0;
801- virtual geometry::Size size() const = 0;
802+ virtual void set_size(mir::geometry::Size) = 0;
803+ virtual mir::geometry::Size size() const = 0;
804 virtual MirWaitHandle* set_scale(float) = 0;
805 virtual char const* get_error_message() const = 0;
806 virtual MirConnection* connection() const = 0;
807@@ -99,12 +104,9 @@
808 virtual void buffer_available(mir::protobuf::Buffer const& buffer) = 0;
809 virtual void buffer_unavailable() = 0;
810 protected:
811- ClientBufferStream() = default;
812- ClientBufferStream(const ClientBufferStream&) = delete;
813- ClientBufferStream& operator=(const ClientBufferStream&) = delete;
814+ MirBufferStream() = default;
815+ MirBufferStream(const MirBufferStream&) = delete;
816+ MirBufferStream& operator=(const MirBufferStream&) = delete;
817 };
818
819-}
820-}
821-
822-#endif /* MIR_CLIENT_CLIENT_BUFFER_STREAM_H_ */
823+#endif /* MIR_MIR_BUFFER_STREAM_H_ */
824
825=== modified file 'src/platforms/android/client/android_client_platform.cpp'
826--- src/platforms/android/client/android_client_platform.cpp 2016-11-23 04:37:50 +0000
827+++ src/platforms/android/client/android_client_platform.cpp 2016-11-30 09:56:15 +0000
828@@ -22,7 +22,7 @@
829 #include "mir/client_context.h"
830 #include "mir/mir_buffer.h"
831 #include "mir/client_buffer.h"
832-#include "mir/client_buffer_stream.h"
833+#include "mir/mir_buffer_stream.h"
834 #include "android_client_platform.h"
835 #include "gralloc_registrar.h"
836 #include "android_client_buffer_factory.h"
837@@ -66,8 +66,7 @@
838
839 ANativeWindow* create_anw(MirBufferStream* buffer_stream)
840 {
841- mcl::ClientBufferStream *bs = reinterpret_cast<mcl::ClientBufferStream*>(buffer_stream);
842- return static_cast<ANativeWindow*>(bs->egl_native_window());
843+ return static_cast<ANativeWindow*>(buffer_stream->egl_native_window());
844 }
845
846 void destroy_anw(ANativeWindow*)
847
848=== renamed file 'tests/include/mir/test/doubles/mock_client_buffer_stream.h' => 'tests/include/mir/test/doubles/mock_mir_buffer_stream.h'
849--- tests/include/mir/test/doubles/mock_client_buffer_stream.h 2016-11-22 03:42:44 +0000
850+++ tests/include/mir/test/doubles/mock_mir_buffer_stream.h 2016-11-30 09:56:15 +0000
851@@ -16,10 +16,10 @@
852 * Authored by: Robert Carr <robert.carr@canonical.com>
853 */
854
855-#ifndef MIR_TEST_DOUBLES_MOCK_CLIENT_BUFFER_STREAM_H_
856-#define MIR_TEST_DOUBLES_MOCK_CLIENT_BUFFER_STREAM_H_
857+#ifndef MIR_TEST_DOUBLES_MOCK_MIR_BUFFER_STREAM_H_
858+#define MIR_TEST_DOUBLES_MOCK_MIR_BUFFER_STREAM_H_
859
860-#include "src/include/client/mir/client_buffer_stream.h"
861+#include "src/include/client/mir/mir_buffer_stream.h"
862
863 #include <gmock/gmock.h>
864
865@@ -30,7 +30,7 @@
866 namespace doubles
867 {
868
869-struct MockClientBufferStream : public client::ClientBufferStream
870+struct MockMirBufferStream : public MirBufferStream
871 {
872 MOCK_METHOD2(release, MirWaitHandle*(mir_buffer_stream_callback, void*));
873
874@@ -61,4 +61,4 @@
875 }
876 }
877
878-#endif // MIR_TEST_DOUBLES_MOCK_CLIENT_BUFFER_STREAM_H_
879+#endif // MIR_TEST_DOUBLES_MOCK_MIR_BUFFER_STREAM_H_
880
881=== modified file 'tests/unit-tests/client/test_client_mir_surface.cpp'
882--- tests/unit-tests/client/test_client_mir_surface.cpp 2016-11-09 02:30:14 +0000
883+++ tests/unit-tests/client/test_client_mir_surface.cpp 2016-11-30 09:56:15 +0000
884@@ -52,7 +52,7 @@
885 #include <boost/throw_exception.hpp>
886 #include "mir/test/doubles/stub_client_buffer_factory.h"
887 #include "mir/test/doubles/stub_buffer_stream.h"
888-#include "mir/test/doubles/mock_client_buffer_stream.h"
889+#include "mir/test/doubles/mock_mir_buffer_stream.h"
890
891 #include "mir_test_framework/stub_client_platform_factory.h"
892
893@@ -329,7 +329,7 @@
894
895 std::shared_ptr<MirSurface> create_surface_with(
896 mclr::DisplayServer& server_stub,
897- std::shared_ptr<mcl::ClientBufferStream> const& buffer_stream)
898+ std::shared_ptr<MirBufferStream> const& buffer_stream)
899 {
900 return std::make_shared<MirSurface>(
901 connection.get(),
902@@ -351,7 +351,7 @@
903
904 std::shared_ptr<MirSurface> create_and_wait_for_surface_with(
905 mclr::DisplayServer& server_stub,
906- std::shared_ptr<mcl::ClientBufferStream> const& buffer_stream)
907+ std::shared_ptr<MirBufferStream> const& buffer_stream)
908 {
909 auto surface = create_surface_with(server_stub, buffer_stream);
910 return surface;
911@@ -360,7 +360,7 @@
912 std::shared_ptr<MirConnection> connection;
913
914 MirSurfaceSpec const spec{nullptr, 33, 45, mir_pixel_format_abgr_8888};
915- std::shared_ptr<mtd::MockClientBufferStream> stub_buffer_stream{std::make_shared<mtd::MockClientBufferStream>()};
916+ std::shared_ptr<mtd::MockMirBufferStream> stub_buffer_stream{std::make_shared<mtd::MockMirBufferStream>()};
917 std::shared_ptr<StubClientInputPlatform> const input_platform =
918 std::make_shared<StubClientInputPlatform>();
919 std::shared_ptr<MockServerPackageGenerator> const mock_server_tool =
920@@ -494,7 +494,7 @@
921 TEST_F(MirClientSurfaceTest, resizes_streams_and_calls_callback_if_no_customized_streams)
922 {
923 using namespace testing;
924- auto mock_stream = std::make_shared<mtd::MockClientBufferStream>();
925+ auto mock_stream = std::make_shared<mtd::MockMirBufferStream>();
926 auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>();
927 ON_CALL(*mock_input_platform, create_input_receiver(_,_,_))
928 .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{})));
929@@ -513,7 +513,7 @@
930 TEST_F(MirClientSurfaceTest, resizes_streams_and_calls_callback_if_customized_streams)
931 {
932 using namespace testing;
933- auto mock_stream = std::make_shared<NiceMock<mtd::MockClientBufferStream>>();
934+ auto mock_stream = std::make_shared<NiceMock<mtd::MockMirBufferStream>>();
935 auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>();
936 ON_CALL(*mock_stream, rpc_id()).WillByDefault(Return(mir::frontend::BufferStreamId(2)));
937 ON_CALL(*mock_input_platform, create_input_receiver(_,_,_))
938@@ -537,7 +537,7 @@
939 TEST_F(MirClientSurfaceTest, parameters_are_unhooked_from_stream_sizes)
940 {
941 using namespace testing;
942- auto mock_stream = std::make_shared<mtd::MockClientBufferStream>();
943+ auto mock_stream = std::make_shared<mtd::MockMirBufferStream>();
944 auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>();
945 ON_CALL(*mock_input_platform, create_input_receiver(_,_,_))
946 .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{})));
947@@ -565,7 +565,7 @@
948 TEST_F(MirClientSurfaceTest, initial_sizes_are_from_response_from_server)
949 {
950 using namespace testing;
951- auto mock_stream = std::make_shared<mtd::MockClientBufferStream>();
952+ auto mock_stream = std::make_shared<mtd::MockMirBufferStream>();
953 auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>();
954 ON_CALL(*mock_input_platform, create_input_receiver(_,_,_))
955 .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{})));
956
957=== modified file 'tests/unit-tests/client/test_connection_resource_map.cpp'
958--- tests/unit-tests/client/test_connection_resource_map.cpp 2016-11-14 15:44:53 +0000
959+++ tests/unit-tests/client/test_connection_resource_map.cpp 2016-11-30 09:56:15 +0000
960@@ -20,7 +20,7 @@
961 #include "src/client/mir_surface.h"
962 #include "src/client/presentation_chain.h"
963 #include "src/client/render_surface.h"
964-#include "mir/test/doubles/mock_client_buffer_stream.h"
965+#include "mir/test/doubles/mock_mir_buffer_stream.h"
966 #include "mir/test/doubles/mock_protobuf_server.h"
967 #include <gtest/gtest.h>
968
969@@ -38,7 +38,7 @@
970 {
971 std::shared_ptr<MirWaitHandle> wh { std::make_shared<MirWaitHandle>() };
972 std::shared_ptr<MirSurface> surface{std::make_shared<MirSurface>("a string", nullptr, mf::SurfaceId{2}, wh)};
973- std::shared_ptr<mcl::ClientBufferStream> stream{ std::make_shared<mtd::MockClientBufferStream>() };
974+ std::shared_ptr<MirBufferStream> stream{ std::make_shared<mtd::MockMirBufferStream>() };
975 std::shared_ptr<mcl::Buffer> buffer {
976 std::make_shared<mcl::Buffer>(buffer_cb, nullptr, 0, nullptr, nullptr, mir_buffer_usage_software) };
977 mtd::MockProtobufServer mock_server;
978@@ -74,7 +74,7 @@
979 map.insert(surface_id, surface);
980 map.erase(surface_id);
981 EXPECT_THROW({
982- map.with_stream_do(stream_id, [](mcl::ClientBufferStream*){});
983+ map.with_stream_do(stream_id, [](MirBufferStream*){});
984 }, std::runtime_error);
985 }
986
987@@ -84,7 +84,7 @@
988 auto stream_called = false;
989 mcl::ConnectionSurfaceMap map;
990 map.insert(stream_id, stream);
991- map.with_stream_do(stream_id, [&](mcl::ClientBufferStream* str) {
992+ map.with_stream_do(stream_id, [&](MirBufferStream* str) {
993 EXPECT_THAT(str, Eq(stream.get()));
994 stream_called = true;
995 });
996
997=== modified file 'tests/unit-tests/client/test_mir_screencast.cpp'
998--- tests/unit-tests/client/test_mir_screencast.cpp 2016-07-18 07:38:38 +0000
999+++ tests/unit-tests/client/test_mir_screencast.cpp 2016-11-30 09:56:15 +0000
1000@@ -22,7 +22,7 @@
1001 #include "mir/client_buffer_factory.h"
1002 #include "mir/client_platform.h"
1003
1004-#include "mir/test/doubles/mock_client_buffer_stream.h"
1005+#include "mir/test/doubles/mock_mir_buffer_stream.h"
1006 #include "mir/test/doubles/null_client_buffer.h"
1007 #include "mir/test/doubles/stub_display_server.h"
1008 #include "mir/test/fake_shared.h"
1009@@ -179,7 +179,7 @@
1010 mir::geometry::Rectangle default_region;
1011 MirPixelFormat default_pixel_format;
1012 MirScreencastSpec default_spec;
1013- mtd::MockClientBufferStream mock_bs;
1014+ mtd::MockMirBufferStream mock_bs;
1015 };
1016
1017 }
1018
1019=== modified file 'tests/unit-tests/client/test_protobuf_rpc_channel.cpp'
1020--- tests/unit-tests/client/test_protobuf_rpc_channel.cpp 2016-11-24 09:45:22 +0000
1021+++ tests/unit-tests/client/test_protobuf_rpc_channel.cpp 2016-11-30 09:56:15 +0000
1022@@ -32,7 +32,7 @@
1023 #include "mir/input/input_devices.h"
1024
1025 #include "mir/test/doubles/null_client_event_sink.h"
1026-#include "mir/test/doubles/mock_client_buffer_stream.h"
1027+#include "mir/test/doubles/mock_mir_buffer_stream.h"
1028 #include "mir/test/doubles/mock_client_buffer.h"
1029 #include "mir/test/fd_utils.h"
1030 #include "mir/test/gmock_fixes.h"
1031@@ -62,9 +62,9 @@
1032 MOCK_CONST_METHOD2(with_surface_do,
1033 void(mir::frontend::SurfaceId, std::function<void(MirSurface*)> const&));
1034 MOCK_CONST_METHOD2(with_stream_do,
1035- void(mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&));
1036+ void(mir::frontend::BufferStreamId, std::function<void(MirBufferStream*)> const&));
1037 MOCK_CONST_METHOD1(with_all_streams_do,
1038- void(std::function<void(mcl::ClientBufferStream*)> const&));
1039+ void(std::function<void(MirBufferStream*)> const&));
1040 MOCK_CONST_METHOD1(buffer, std::shared_ptr<mcl::MirBuffer>(int));
1041 MOCK_METHOD2(insert, void(int, std::shared_ptr<mcl::MirBuffer> const&));
1042 MOCK_METHOD2(insert, void(mir::frontend::BufferStreamId, std::shared_ptr<MirPresentationChain> const&));
1043@@ -79,10 +79,10 @@
1044 {
1045 }
1046 void with_stream_do(
1047- mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&) const override
1048+ mir::frontend::BufferStreamId, std::function<void(MirBufferStream*)> const&) const override
1049 {
1050 }
1051- void with_all_streams_do(std::function<void(mcl::ClientBufferStream*)> const&) const override
1052+ void with_all_streams_do(std::function<void(MirBufferStream*)> const&) const override
1053 {
1054 }
1055 void insert(mir::frontend::BufferStreamId, std::shared_ptr<MirPresentationChain> const&)
1056@@ -254,7 +254,7 @@
1057 MockStreamTransport* transport;
1058 std::shared_ptr<mcl::LifecycleControl> lifecycle;
1059 std::shared_ptr<mclr::MirProtobufRpcChannel> channel;
1060- mtd::MockClientBufferStream stream;
1061+ mtd::MockMirBufferStream stream;
1062 };
1063
1064 }

Subscribers

People subscribed via source and target branches