Merge lp:~dandrader/qtmir/dbusClipboard into lp:qtmir
- dbusClipboard
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Robert Carr |
Approved revision: | 254 |
Merged at revision: | 260 |
Proposed branch: | lp:~dandrader/qtmir/dbusClipboard |
Merge into: | lp:qtmir |
Diff against target: |
2331 lines (+471/-1590) 20 files modified
src/platforms/mirserver/clipboard.cpp (+262/-0) src/platforms/mirserver/clipboard.h (+88/-0) src/platforms/mirserver/connectioncreator.cpp (+0/-42) src/platforms/mirserver/connectioncreator.h (+0/-46) src/platforms/mirserver/logging.h (+1/-0) src/platforms/mirserver/messageprocessor.cpp (+0/-49) src/platforms/mirserver/messageprocessor.h (+0/-44) src/platforms/mirserver/mirserver.pro (+4/-8) src/platforms/mirserver/mirserverconfiguration.cpp (+0/-19) src/platforms/mirserver/mirserverconfiguration.h (+0/-8) src/platforms/mirserver/mirserverintegration.cpp (+13/-2) src/platforms/mirserver/mirserverintegration.h (+10/-2) src/platforms/mirserver/unityprotobufservice.cpp (+0/-35) src/platforms/mirserver/unityprotobufservice.h (+0/-40) src/platforms/mirserver/unityrpc.cpp (+0/-742) src/platforms/mirserver/unityrpc.h (+0/-535) src/platforms/mirserver/unityrpc.proto (+0/-17) tests/mirserver/Clipboard/Clipboard.pro (+16/-0) tests/mirserver/Clipboard/clipboard_test.cpp (+76/-0) tests/mirserver/mirserver.pro (+1/-1) |
To merge this branch: | bzr merge lp:~dandrader/qtmir/dbusClipboard |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Carr (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+235501@code.launchpad.net |
Commit message
Provide a global clipboard via D-Bus
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
https:/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.
Until bug 1372579 is released, to make sure apparmor doesn't block d-bus communication to that new interface and object add the following to /usr/share/
"""
dbus (receive, send)
bus=session
path=
interface=
"""
And then run:
$ sudo aa-clickhook -f
Gerry Boland (gerboland) wrote : | # |
Daniel d'Andrada (dandrader) wrote : | # |
> You could create an MR for apparmor-
> exception
It's bug 1372579. That's the way jdstrand asked me to proceed.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:253
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
The comments and assert at 69/70 seems a little concerning...? Perhaps the data could be clipped? (even in Clipboard:
Beyond that seems ok as a temporary solution.
Robert Carr (robertcarr) wrote : | # |
I know this is a preexisting issue but when else to fix it "before release" as the comment references.
- 254. By Daniel d'Andrada
-
Implement contents size limitation in the D-Bus (global) clipboard
Daniel d'Andrada (dandrader) wrote : | # |
> The comments and assert at 69/70 seems a little concerning...? Perhaps the
> data could be clipped? (even in Clipboard:
> remain, becoming an actual precondition of the function).
Implemented by size limitation. Clipping would make the resulting contents unusable (imagine a half written jpg). So I went for simply refusing/ignoring oversized clipboard contents instead.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:254
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file 'src/platforms/mirserver/clipboard.cpp' |
2 | --- src/platforms/mirserver/clipboard.cpp 1970-01-01 00:00:00 +0000 |
3 | +++ src/platforms/mirserver/clipboard.cpp 2014-09-23 11:37:20 +0000 |
4 | @@ -0,0 +1,262 @@ |
5 | +/* |
6 | + * Copyright (C) 2014 Canonical, Ltd. |
7 | + * |
8 | + * This program is free software: you can redistribute it and/or modify it under |
9 | + * the terms of the GNU Lesser General Public License version 3, as published by |
10 | + * the Free Software Foundation. |
11 | + * |
12 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
13 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
14 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | + * Lesser General Public License for more details. |
16 | + * |
17 | + * You should have received a copy of the GNU Lesser General Public License |
18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | + * |
20 | + * Author: Daniel d'Andrada <daniel.dandrada@canonical.com> |
21 | + */ |
22 | + |
23 | +#include "clipboard.h" |
24 | +#include "logging.h" |
25 | + |
26 | +// C++ std lib |
27 | +#include <utility> |
28 | + |
29 | +#include <QDBusConnection> |
30 | +#include <QDBusError> |
31 | +#include <QMimeData> |
32 | + |
33 | +Q_LOGGING_CATEGORY(QTMIR_CLIPBOARD, "qtmir.clipboard") |
34 | + |
35 | +// FIXME(loicm) The clipboard data format is not defined by Ubuntu Platform API |
36 | +// which makes it impossible to have non-Qt applications communicate with Qt |
37 | +// applications through the clipboard API. The solution would be to have |
38 | +// Ubuntu Platform define the data format or propose an API that supports |
39 | +// embedding different mime types in the clipboard. |
40 | + |
41 | +// Data format: |
42 | +// number of mime types (sizeof(int)) |
43 | +// data layout ((4 * sizeof(int)) * number of mime types) |
44 | +// mime type string offset (sizeof(int)) |
45 | +// mime type string size (sizeof(int)) |
46 | +// data offset (sizeof(int)) |
47 | +// data size (sizeof(int)) |
48 | +// data (n bytes) |
49 | + |
50 | +namespace { |
51 | + |
52 | +const int maxFormatsCount = 16; |
53 | + |
54 | +} |
55 | + |
56 | +namespace qtmir { |
57 | + |
58 | +QByteArray serializeMimeData(QMimeData *mimeData) |
59 | +{ |
60 | + const QStringList formats = mimeData->formats(); |
61 | + const int formatCount = qMin(formats.size(), maxFormatsCount); |
62 | + const int headerSize = sizeof(int) + (formatCount * 4 * sizeof(int)); |
63 | + int bufferSize = headerSize; |
64 | + |
65 | + for (int i = 0; i < formatCount; i++) |
66 | + bufferSize += formats[i].size() + mimeData->data(formats[i]).size(); |
67 | + |
68 | + // Serialize data. |
69 | + QByteArray serializedMimeData(bufferSize, 0 /* char to fill with */); |
70 | + { |
71 | + char *buffer = serializedMimeData.data(); |
72 | + int* header = reinterpret_cast<int*>(serializedMimeData.data()); |
73 | + int offset = headerSize; |
74 | + header[0] = formatCount; |
75 | + for (int i = 0; i < formatCount; i++) { |
76 | + const int formatOffset = offset; |
77 | + const int formatSize = formats[i].size(); |
78 | + const int dataOffset = offset + formatSize; |
79 | + const int dataSize = mimeData->data(formats[i]).size(); |
80 | + memcpy(&buffer[formatOffset], formats[i].toLatin1().data(), formatSize); |
81 | + memcpy(&buffer[dataOffset], mimeData->data(formats[i]).data(), dataSize); |
82 | + header[i*4+1] = formatOffset; |
83 | + header[i*4+2] = formatSize; |
84 | + header[i*4+3] = dataOffset; |
85 | + header[i*4+4] = dataSize; |
86 | + offset += formatSize + dataSize; |
87 | + } |
88 | + } |
89 | + |
90 | + return serializedMimeData; |
91 | +} |
92 | + |
93 | +QMimeData *deserializeMimeData(const QByteArray &serializedMimeData) |
94 | +{ |
95 | + if (static_cast<std::size_t>(serializedMimeData.size()) < sizeof(int)) { |
96 | + // Data is invalid |
97 | + return nullptr; |
98 | + } |
99 | + |
100 | + QMimeData *mimeData = new QMimeData; |
101 | + |
102 | + const char* const buffer = serializedMimeData.constData(); |
103 | + const int* const header = reinterpret_cast<const int*>(serializedMimeData.constData()); |
104 | + |
105 | + const int count = qMin(header[0], maxFormatsCount); |
106 | + |
107 | + for (int i = 0; i < count; i++) { |
108 | + const int formatOffset = header[i*4+1]; |
109 | + const int formatSize = header[i*4+2]; |
110 | + const int dataOffset = header[i*4+3]; |
111 | + const int dataSize = header[i*4+4]; |
112 | + |
113 | + if (formatOffset + formatSize <= serializedMimeData.size() |
114 | + && dataOffset + dataSize <= serializedMimeData.size()) { |
115 | + |
116 | + QString mimeType = QString::fromLatin1(&buffer[formatOffset], formatSize); |
117 | + QByteArray mimeDataBytes(&buffer[dataOffset], dataSize); |
118 | + |
119 | + mimeData->setData(mimeType, mimeDataBytes); |
120 | + } |
121 | + } |
122 | + |
123 | + return mimeData; |
124 | +} |
125 | + |
126 | +/************************************ DBusClipboard *****************************************/ |
127 | + |
128 | +bool DBusClipboard::skipDBusRegistration = false; |
129 | + |
130 | +DBusClipboard::DBusClipboard(QObject *parent) |
131 | + : QObject(parent) |
132 | +{ |
133 | + if (!skipDBusRegistration) { |
134 | + performDBusRegistration(); |
135 | + } |
136 | +} |
137 | + |
138 | +void DBusClipboard::setContents(QByteArray newContents) |
139 | +{ |
140 | + setContentsHelper(std::move(newContents)); |
141 | +} |
142 | + |
143 | +void DBusClipboard::SetContents(QByteArray newContents) |
144 | +{ |
145 | + qCDebug(QTMIR_CLIPBOARD, "D-Bus SetContents - %d bytes", newContents.size()); |
146 | + |
147 | + if (setContentsHelper(std::move(newContents))) { |
148 | + Q_EMIT contentsChangedRemotely(); |
149 | + } |
150 | +} |
151 | + |
152 | +bool DBusClipboard::setContentsHelper(QByteArray newContents) |
153 | +{ |
154 | + if (newContents.size() > maxContentsSize) { |
155 | + qCWarning(QTMIR_CLIPBOARD, "D-Bus clipboard refused the new contents (%d bytes) as they're" |
156 | + " bigger than the maximum allowed size of %d bytes.", |
157 | + newContents.size(), maxContentsSize); |
158 | + return false; |
159 | + } |
160 | + |
161 | + if (newContents != m_contents) { |
162 | + m_contents = std::move(newContents); |
163 | + Q_EMIT ContentsChanged(m_contents); |
164 | + return true; |
165 | + } else { |
166 | + return false; |
167 | + } |
168 | +} |
169 | + |
170 | +QByteArray DBusClipboard::GetContents() const |
171 | +{ |
172 | + qCDebug(QTMIR_CLIPBOARD, "D-Bus GetContents - returning %d bytes", m_contents.size()); |
173 | + return m_contents; |
174 | +} |
175 | + |
176 | +void DBusClipboard::performDBusRegistration() |
177 | +{ |
178 | + QDBusConnection connection = QDBusConnection::sessionBus(); |
179 | + const char *serviceName = "com.canonical.QtMir"; |
180 | + const char *objectName = "/com/canonical/QtMir/Clipboard"; |
181 | + |
182 | + bool serviceOk = connection.registerService(serviceName); |
183 | + if (!serviceOk) { |
184 | + QDBusError error = connection.lastError(); |
185 | + QString errorMessage; |
186 | + if (error.isValid()) { |
187 | + errorMessage = error.message(); |
188 | + } |
189 | + qCCritical(QTMIR_CLIPBOARD, "Failed to register service %s. %s", serviceName, qPrintable(errorMessage)); |
190 | + } |
191 | + |
192 | + bool objectOk = connection.registerObject(objectName, this, |
193 | + QDBusConnection::ExportScriptableSignals |
194 | + | QDBusConnection::ExportScriptableSlots); |
195 | + if (!objectOk) { |
196 | + QDBusError error = connection.lastError(); |
197 | + QString errorMessage; |
198 | + if (error.isValid()) { |
199 | + errorMessage = error.message(); |
200 | + } |
201 | + qCCritical(QTMIR_CLIPBOARD, "Failed to register object %s. %s", objectName, qPrintable(errorMessage)); |
202 | + } |
203 | + |
204 | + if (serviceOk && objectOk) { |
205 | + qCDebug(QTMIR_CLIPBOARD, "D-Bus registration successful."); |
206 | + } |
207 | +} |
208 | + |
209 | +/************************************ Clipboard *****************************************/ |
210 | + |
211 | +Clipboard::Clipboard(QObject *parent) |
212 | + : QObject(parent) |
213 | + , m_dbusClipboard(nullptr) |
214 | +{ |
215 | +} |
216 | + |
217 | +QMimeData *Clipboard::mimeData(QClipboard::Mode mode) |
218 | +{ |
219 | + if (mode == QClipboard::Clipboard) { |
220 | + return QPlatformClipboard::mimeData(mode); |
221 | + } else { |
222 | + return nullptr; |
223 | + } |
224 | +} |
225 | + |
226 | +void Clipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) |
227 | +{ |
228 | + if (mode != QClipboard::Clipboard) |
229 | + return; |
230 | + |
231 | + if (m_dbusClipboard) { |
232 | + QByteArray serializedMimeData = serializeMimeData(data); |
233 | + m_dbusClipboard->setContents(std::move(serializedMimeData)); |
234 | + } |
235 | + |
236 | + QPlatformClipboard::setMimeData(data, mode); |
237 | +} |
238 | + |
239 | +void Clipboard::setupDBusService() |
240 | +{ |
241 | + Q_ASSERT(!m_dbusClipboard); |
242 | + |
243 | + m_dbusClipboard = new DBusClipboard(this); |
244 | + |
245 | + connect(m_dbusClipboard, &DBusClipboard::contentsChangedRemotely, |
246 | + this, &Clipboard::setMimeDataWithDBusClibpboardContents); |
247 | +} |
248 | + |
249 | +void Clipboard::setMimeDataWithDBusClibpboardContents() |
250 | +{ |
251 | + Q_ASSERT(m_dbusClipboard); |
252 | + QMimeData *newMimeData = deserializeMimeData(m_dbusClipboard->contents()); |
253 | + if (newMimeData) { |
254 | + // Don't call Clipboard::setMimeData as it will also propagate the change |
255 | + // to the D-Bus clipboard, which doesn't make sense here as we're doing |
256 | + // the other way round (propagating the D-Bus clipboard change to the local |
257 | + // clipboard). |
258 | + QPlatformClipboard::setMimeData(newMimeData, QClipboard::Clipboard); |
259 | + } else { |
260 | + qCWarning(QTMIR_CLIPBOARD, "Failed to deserialize D-Bus clipboard contents (%d bytes)", |
261 | + m_dbusClipboard->contents().size()); |
262 | + } |
263 | +} |
264 | + |
265 | +} // namespace qtmir |
266 | + |
267 | |
268 | === added file 'src/platforms/mirserver/clipboard.h' |
269 | --- src/platforms/mirserver/clipboard.h 1970-01-01 00:00:00 +0000 |
270 | +++ src/platforms/mirserver/clipboard.h 2014-09-23 11:37:20 +0000 |
271 | @@ -0,0 +1,88 @@ |
272 | +/* |
273 | + * Copyright (C) 2014 Canonical, Ltd. |
274 | + * |
275 | + * This program is free software: you can redistribute it and/or modify it under |
276 | + * the terms of the GNU Lesser General Public License version 3, as published by |
277 | + * the Free Software Foundation. |
278 | + * |
279 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
280 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
281 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
282 | + * Lesser General Public License for more details. |
283 | + * |
284 | + * You should have received a copy of the GNU Lesser General Public License |
285 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
286 | + * |
287 | + * Author: Daniel d'Andrada <daniel.dandrada@canonical.com> |
288 | + */ |
289 | + |
290 | +#ifndef QTMIR_CLIPBOARD_H |
291 | +#define QTMIR_CLIPBOARD_H |
292 | + |
293 | +#include <qpa/qplatformclipboard.h> |
294 | +#include <QObject> |
295 | + |
296 | +namespace qtmir { |
297 | + |
298 | +class DBusClipboard : public QObject { |
299 | + Q_OBJECT |
300 | + Q_CLASSINFO("D-Bus Interface", "com.canonical.QtMir.Clipboard") |
301 | +public: |
302 | + DBusClipboard(QObject *parent = nullptr); |
303 | + virtual ~DBusClipboard() {} |
304 | + |
305 | + void setContents(QByteArray contents); |
306 | + const QByteArray &contents() const { return m_contents; } |
307 | + |
308 | + static const int maxContentsSize = 4 * 1024 * 1024; // 4 Mb |
309 | + |
310 | + // To make it testable |
311 | + static bool skipDBusRegistration; |
312 | + |
313 | +Q_SIGNALS: |
314 | + Q_SCRIPTABLE void ContentsChanged(const QByteArray &contents); |
315 | + void contentsChangedRemotely(); |
316 | + |
317 | +public Q_SLOTS: |
318 | + Q_SCRIPTABLE QByteArray GetContents() const; |
319 | + Q_SCRIPTABLE void SetContents(QByteArray contents); |
320 | + |
321 | +private: |
322 | + void performDBusRegistration(); |
323 | + bool setContentsHelper(QByteArray newContents); |
324 | + |
325 | + // Contains a serialized QMimeData |
326 | + // Serialization and deserialization is done by the QPlatformClipboard |
327 | + // implementation. |
328 | + QByteArray m_contents; |
329 | +}; |
330 | + |
331 | +class Clipboard : public QObject, public QPlatformClipboard |
332 | +{ |
333 | + Q_OBJECT |
334 | +public: |
335 | + Clipboard(QObject *parent = nullptr); |
336 | + virtual ~Clipboard() {} |
337 | + |
338 | + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; |
339 | + void setMimeData(QMimeData *data, QClipboard::Mode mode) override; |
340 | + |
341 | + void setupDBusService(); |
342 | + |
343 | +private Q_SLOTS: |
344 | + void setMimeDataWithDBusClibpboardContents(); |
345 | + |
346 | +private: |
347 | + |
348 | + DBusClipboard *m_dbusClipboard; |
349 | +}; |
350 | + |
351 | +// NB: Copied from qtubuntu. Must be kept in sync with the original version! |
352 | +// Best thing would be to share this code somehow, but not bothering with it right now |
353 | +// as the clipboard will move to content-hub at some point. |
354 | +QByteArray serializeMimeData(QMimeData *mimeData); |
355 | +QMimeData *deserializeMimeData(const QByteArray &serializedMimeData); |
356 | + |
357 | +} // namespace qtmir |
358 | + |
359 | +#endif // QTMIR_CLIPBOARD_H |
360 | |
361 | === removed file 'src/platforms/mirserver/connectioncreator.cpp' |
362 | --- src/platforms/mirserver/connectioncreator.cpp 2014-06-26 15:14:00 +0000 |
363 | +++ src/platforms/mirserver/connectioncreator.cpp 1970-01-01 00:00:00 +0000 |
364 | @@ -1,42 +0,0 @@ |
365 | -/* |
366 | - * Copyright (C) 2014 Canonical, Ltd. |
367 | - * |
368 | - * This program is free software: you can redistribute it and/or modify it under |
369 | - * the terms of the GNU Lesser General Public License version 3, as published by |
370 | - * the Free Software Foundation. |
371 | - * |
372 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
373 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
374 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
375 | - * Lesser General Public License for more details. |
376 | - * |
377 | - * You should have received a copy of the GNU Lesser General Public License |
378 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
379 | - */ |
380 | - |
381 | -#include "connectioncreator.h" |
382 | -#include <messageprocessor.h> |
383 | - |
384 | -ConnectionCreator::ConnectionCreator( |
385 | - std::shared_ptr<unity::protobuf::UnityService> const& unityService, |
386 | - std::shared_ptr<mir::frontend::ProtobufIpcFactory> const& ipc_factory, |
387 | - std::shared_ptr<mir::frontend::SessionAuthorizer> const& session_authorizer, |
388 | - std::shared_ptr<mir::frontend::MessageProcessorReport> const& report) |
389 | - : ProtobufConnectionCreator(ipc_factory, session_authorizer, report) |
390 | - , m_unityService(unityService) |
391 | -{ |
392 | -} |
393 | - |
394 | -std::shared_ptr<mir::frontend::detail::MessageProcessor> ConnectionCreator::create_processor( |
395 | - std::shared_ptr<mir::frontend::detail::ProtobufMessageSender> const& sender, |
396 | - std::shared_ptr<mir::frontend::detail::DisplayServer> const& display_server, |
397 | - std::shared_ptr<mir::frontend::MessageProcessorReport> const& report) const |
398 | -{ |
399 | - auto const wrapped = mir::frontend::ProtobufConnectionCreator::create_processor( |
400 | - sender, |
401 | - display_server, |
402 | - report); |
403 | - |
404 | - return std::make_shared<MessageProcessor>(m_unityService, sender, wrapped); |
405 | -} |
406 | - |
407 | |
408 | === removed file 'src/platforms/mirserver/connectioncreator.h' |
409 | --- src/platforms/mirserver/connectioncreator.h 2014-06-26 15:14:00 +0000 |
410 | +++ src/platforms/mirserver/connectioncreator.h 1970-01-01 00:00:00 +0000 |
411 | @@ -1,46 +0,0 @@ |
412 | -/* |
413 | - * Copyright (C) 2014 Canonical, Ltd. |
414 | - * |
415 | - * This program is free software: you can redistribute it and/or modify it under |
416 | - * the terms of the GNU Lesser General Public License version 3, as published by |
417 | - * the Free Software Foundation. |
418 | - * |
419 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
420 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
421 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
422 | - * Lesser General Public License for more details. |
423 | - * |
424 | - * You should have received a copy of the GNU Lesser General Public License |
425 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
426 | - */ |
427 | - |
428 | -#ifndef CONNECTIONCREATOR_H |
429 | -#define CONNECTIONCREATOR_H |
430 | - |
431 | -#include <mir/frontend/protobuf_connection_creator.h> |
432 | - |
433 | -namespace unity { |
434 | - namespace protobuf { |
435 | - class UnityService; |
436 | - } |
437 | -} |
438 | - |
439 | -class ConnectionCreator : public mir::frontend::ProtobufConnectionCreator |
440 | -{ |
441 | -public: |
442 | - ConnectionCreator( |
443 | - std::shared_ptr<unity::protobuf::UnityService> const& unityService, |
444 | - std::shared_ptr<mir::frontend::ProtobufIpcFactory> const& ipc_factory, |
445 | - std::shared_ptr<mir::frontend::SessionAuthorizer> const& session_authorizer, |
446 | - std::shared_ptr<mir::frontend::MessageProcessorReport> const& report); |
447 | - |
448 | - std::shared_ptr<mir::frontend::detail::MessageProcessor> create_processor( |
449 | - std::shared_ptr<mir::frontend::detail::ProtobufMessageSender> const& sender, |
450 | - std::shared_ptr<mir::frontend::detail::DisplayServer> const& display_server, |
451 | - std::shared_ptr<mir::frontend::MessageProcessorReport> const& report) const override; |
452 | -private: |
453 | - std::shared_ptr<unity::protobuf::UnityService> m_unityService; |
454 | -}; |
455 | - |
456 | -#endif // CONNECTIONCREATOR_H |
457 | - |
458 | |
459 | === modified file 'src/platforms/mirserver/logging.h' |
460 | --- src/platforms/mirserver/logging.h 2014-09-07 19:42:14 +0000 |
461 | +++ src/platforms/mirserver/logging.h 2014-09-23 11:37:20 +0000 |
462 | @@ -23,5 +23,6 @@ |
463 | Q_DECLARE_LOGGING_CATEGORY(QTMIR_SURFACES) |
464 | Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_MESSAGES) |
465 | Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_INPUT) |
466 | +Q_DECLARE_LOGGING_CATEGORY(QTMIR_CLIPBOARD) |
467 | |
468 | #endif // UBUNTU_APPLICATION_PLUGIN_LOGGING_H |
469 | |
470 | === removed file 'src/platforms/mirserver/messageprocessor.cpp' |
471 | --- src/platforms/mirserver/messageprocessor.cpp 2014-06-26 15:14:00 +0000 |
472 | +++ src/platforms/mirserver/messageprocessor.cpp 1970-01-01 00:00:00 +0000 |
473 | @@ -1,49 +0,0 @@ |
474 | -/* |
475 | - * Copyright (C) 2014 Canonical, Ltd. |
476 | - * |
477 | - * This program is free software: you can redistribute it and/or modify it under |
478 | - * the terms of the GNU Lesser General Public License version 3, as published by |
479 | - * the Free Software Foundation. |
480 | - * |
481 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
482 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
483 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
484 | - * Lesser General Public License for more details. |
485 | - * |
486 | - * You should have received a copy of the GNU Lesser General Public License |
487 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
488 | - */ |
489 | - |
490 | -#include "messageprocessor.h" |
491 | -#include <mir/frontend/template_protobuf_message_processor.h> |
492 | - |
493 | -bool MessageProcessor::dispatch(mir::frontend::detail::Invocation const& invocation) |
494 | -{ |
495 | - if ("copy" == invocation.method_name()) { |
496 | - mir::frontend::detail::invoke( |
497 | - this, |
498 | - m_unityService.get(), |
499 | - &unity::protobuf::UnityService::copy, |
500 | - invocation); |
501 | - return true; |
502 | - } else if ("paste" == invocation.method_name()) { |
503 | - mir::frontend::detail::invoke( |
504 | - this, |
505 | - m_unityService.get(), |
506 | - &unity::protobuf::UnityService::paste, |
507 | - invocation); |
508 | - return true; |
509 | - } else { |
510 | - return m_wrapped->dispatch(invocation); |
511 | - } |
512 | -} |
513 | - |
514 | -void MessageProcessor::client_pid(int pid) |
515 | -{ |
516 | - m_wrapped->client_pid(pid); |
517 | -} |
518 | - |
519 | -void MessageProcessor::send_response(::google::protobuf::uint32 id, ::google::protobuf::Message* response) |
520 | -{ |
521 | - m_sender->send_response(id, response, {}); |
522 | -} |
523 | |
524 | === removed file 'src/platforms/mirserver/messageprocessor.h' |
525 | --- src/platforms/mirserver/messageprocessor.h 2014-06-26 15:14:00 +0000 |
526 | +++ src/platforms/mirserver/messageprocessor.h 1970-01-01 00:00:00 +0000 |
527 | @@ -1,44 +0,0 @@ |
528 | -/* |
529 | - * Copyright (C) 2014 Canonical, Ltd. |
530 | - * |
531 | - * This program is free software: you can redistribute it and/or modify it under |
532 | - * the terms of the GNU Lesser General Public License version 3, as published by |
533 | - * the Free Software Foundation. |
534 | - * |
535 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
536 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
537 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
538 | - * Lesser General Public License for more details. |
539 | - * |
540 | - * You should have received a copy of the GNU Lesser General Public License |
541 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
542 | - */ |
543 | - |
544 | -#include <mir/frontend/message_processor.h> |
545 | -#include <mir/frontend/protobuf_message_sender.h> |
546 | - |
547 | -#include "unityrpc.h" |
548 | - |
549 | -#include <memory> |
550 | - |
551 | -class MessageProcessor : public mir::frontend::detail::MessageProcessor |
552 | -{ |
553 | -public: |
554 | - MessageProcessor( |
555 | - std::shared_ptr<unity::protobuf::UnityService> const& unityService, |
556 | - std::shared_ptr<mir::frontend::detail::ProtobufMessageSender> const& sender, |
557 | - std::shared_ptr<mir::frontend::detail::MessageProcessor> const& wrapped) : |
558 | - m_sender(sender), |
559 | - m_wrapped(wrapped), |
560 | - m_unityService(unityService) {} |
561 | - |
562 | - bool dispatch(mir::frontend::detail::Invocation const& invocation) override; |
563 | - void client_pid(int pid) override; |
564 | - |
565 | - void send_response(::google::protobuf::uint32 id, ::google::protobuf::Message* response); |
566 | - |
567 | -private: |
568 | - std::shared_ptr<mir::frontend::detail::ProtobufMessageSender> const m_sender; |
569 | - std::shared_ptr<mir::frontend::detail::MessageProcessor> const m_wrapped; |
570 | - std::shared_ptr<unity::protobuf::UnityService> const m_unityService; |
571 | -}; |
572 | |
573 | === modified file 'src/platforms/mirserver/mirserver.pro' |
574 | --- src/platforms/mirserver/mirserver.pro 2014-09-07 19:42:33 +0000 |
575 | +++ src/platforms/mirserver/mirserver.pro 2014-09-23 11:37:20 +0000 |
576 | @@ -24,8 +24,8 @@ |
577 | LIBS += -lboost_system |
578 | |
579 | SOURCES += \ |
580 | - connectioncreator.cpp \ |
581 | ../../common/debughelpers.cpp \ |
582 | + clipboard.cpp \ |
583 | focussetter.cpp \ |
584 | qteventfeeder.cpp \ |
585 | plugin.cpp \ |
586 | @@ -34,7 +34,6 @@ |
587 | sessionlistener.cpp \ |
588 | surfaceconfigurator.cpp \ |
589 | promptsessionlistener.cpp \ |
590 | - messageprocessor.cpp \ |
591 | mirplacementstrategy.cpp \ |
592 | mirserverconfiguration.cpp \ |
593 | mirserverstatuslistener.cpp \ |
594 | @@ -47,12 +46,11 @@ |
595 | qtcompositor.cpp \ |
596 | services.cpp \ |
597 | ubuntutheme.cpp \ |
598 | - unityprotobufservice.cpp \ |
599 | - unityrpc.cpp |
600 | + |
601 | |
602 | HEADERS += \ |
603 | - connectioncreator.h \ |
604 | ../../common/debughelpers.h \ |
605 | + clipboard.h \ |
606 | focussetter.h \ |
607 | qteventfeeder.h \ |
608 | plugin.h \ |
609 | @@ -62,7 +60,6 @@ |
610 | promptsessionlistener.h \ |
611 | surfaceconfigurator.h \ |
612 | logging.h \ |
613 | - messageprocessor.h \ |
614 | mirglconfig.h \ |
615 | mirplacementstrategy.h \ |
616 | mirserverconfiguration.h \ |
617 | @@ -76,8 +73,7 @@ |
618 | qtcompositor.h \ |
619 | services.h \ |
620 | ubuntutheme.h \ |
621 | - unityprotobufservice.h \ |
622 | - unityrpc.h |
623 | + |
624 | |
625 | LTTNG_TP_FILES += tracepoints.tp |
626 | |
627 | |
628 | === modified file 'src/platforms/mirserver/mirserverconfiguration.cpp' |
629 | --- src/platforms/mirserver/mirserverconfiguration.cpp 2014-08-27 16:51:24 +0000 |
630 | +++ src/platforms/mirserver/mirserverconfiguration.cpp 2014-09-23 11:37:20 +0000 |
631 | @@ -17,7 +17,6 @@ |
632 | #include "mirserverconfiguration.h" |
633 | |
634 | // local |
635 | -#include "connectioncreator.h" |
636 | #include "focussetter.h" |
637 | #include "mirglconfig.h" |
638 | #include "mirplacementstrategy.h" |
639 | @@ -29,14 +28,10 @@ |
640 | #include "qtcompositor.h" |
641 | #include "qteventfeeder.h" |
642 | #include "logging.h" |
643 | -#include "unityprotobufservice.h" |
644 | |
645 | // mir |
646 | #include <mir/options/default_configuration.h> |
647 | |
648 | -// Qt |
649 | -#include <QDebug> |
650 | - |
651 | // egl |
652 | #include <EGL/egl.h> |
653 | |
654 | @@ -56,7 +51,6 @@ |
655 | MirServerConfiguration::MirServerConfiguration(int argc, char const* argv[], QObject* parent) |
656 | : QObject(parent) |
657 | , DefaultServerConfiguration(std::make_shared<mo::DefaultConfiguration>(argc, argv, &ignore_unparsed_arguments)) |
658 | - , m_unityService(std::make_shared<UnityProtobufService>()) |
659 | { |
660 | qCDebug(QTMIR_MIR_MESSAGES) << "MirServerConfiguration created"; |
661 | } |
662 | @@ -155,19 +149,6 @@ |
663 | }); |
664 | } |
665 | |
666 | -std::shared_ptr<mir::frontend::ConnectionCreator> |
667 | -MirServerConfiguration::the_connection_creator() |
668 | -{ |
669 | - return connection_creator([this] |
670 | - { |
671 | - return std::make_shared<ConnectionCreator>( |
672 | - m_unityService, |
673 | - new_ipc_factory(the_session_authorizer()), |
674 | - the_session_authorizer(), |
675 | - the_message_processor_report()); |
676 | - }); |
677 | -} |
678 | - |
679 | std::shared_ptr<mir::shell::FocusSetter> |
680 | MirServerConfiguration::the_shell_focus_setter() |
681 | { |
682 | |
683 | === modified file 'src/platforms/mirserver/mirserverconfiguration.h' |
684 | --- src/platforms/mirserver/mirserverconfiguration.h 2014-07-11 17:15:47 +0000 |
685 | +++ src/platforms/mirserver/mirserverconfiguration.h 2014-09-23 11:37:20 +0000 |
686 | @@ -20,12 +20,6 @@ |
687 | #include <QObject> |
688 | #include <mir/default_server_configuration.h> |
689 | |
690 | -namespace unity { |
691 | - namespace protobuf { |
692 | - class UnityService; |
693 | - } |
694 | -} |
695 | - |
696 | class QtEventFeeder; |
697 | class SessionListener; |
698 | class SessionAuthorizer; |
699 | @@ -55,7 +49,6 @@ |
700 | std::shared_ptr<mir::input::InputDispatcher> the_input_dispatcher() override; |
701 | std::shared_ptr<mir::graphics::GLConfig> the_gl_config() override; |
702 | std::shared_ptr<mir::ServerStatusListener> the_server_status_listener() override; |
703 | - std::shared_ptr<mir::frontend::ConnectionCreator> the_connection_creator() override; |
704 | std::shared_ptr<mir::shell::FocusSetter> the_shell_focus_setter() override; |
705 | |
706 | /* qt specific */ |
707 | @@ -66,7 +59,6 @@ |
708 | SurfaceConfigurator *surfaceConfigurator(); |
709 | |
710 | private: |
711 | - std::shared_ptr<unity::protobuf::UnityService> m_unityService; |
712 | std::shared_ptr<QtEventFeeder> m_qtEventFeeder; |
713 | }; |
714 | |
715 | |
716 | === modified file 'src/platforms/mirserver/mirserverintegration.cpp' |
717 | --- src/platforms/mirserver/mirserverintegration.cpp 2014-07-08 18:23:45 +0000 |
718 | +++ src/platforms/mirserver/mirserverintegration.cpp 2014-09-23 11:37:20 +0000 |
719 | @@ -1,5 +1,5 @@ |
720 | /* |
721 | - * Copyright (C) 2013 Canonical, Ltd. |
722 | + * Copyright (C) 2013-2014 Canonical, Ltd. |
723 | * |
724 | * This program is free software: you can redistribute it and/or modify it under |
725 | * the terms of the GNU Lesser General Public License version 3, as published by |
726 | @@ -13,7 +13,8 @@ |
727 | * You should have received a copy of the GNU Lesser General Public License |
728 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
729 | * |
730 | - * Author: Gerry Boland <gerry.boland@canonical.com> |
731 | + * Authors: Gerry Boland <gerry.boland@canonical.com> |
732 | + * Daniel d'Andrada <daniel.dandrada@canonical.com> |
733 | */ |
734 | |
735 | #include "mirserverintegration.h" |
736 | @@ -47,6 +48,7 @@ |
737 | #include <csignal> |
738 | |
739 | // local |
740 | +#include "clipboard.h" |
741 | #include "display.h" |
742 | #include "displaywindow.h" |
743 | #include "miropenglcontext.h" |
744 | @@ -56,6 +58,7 @@ |
745 | #include "ubuntutheme.h" |
746 | |
747 | namespace mg = mir::graphics; |
748 | +using qtmir::Clipboard; |
749 | |
750 | MirServerIntegration::MirServerIntegration() |
751 | : m_accessibility(new QPlatformAccessibility()) |
752 | @@ -67,6 +70,7 @@ |
753 | , m_display(nullptr) |
754 | , m_mirServer(nullptr) |
755 | , m_nativeInterface(nullptr) |
756 | + , m_clipboard(new Clipboard) |
757 | { |
758 | // Start Mir server only once Qt has initialized its event dispatcher, see initialize() |
759 | |
760 | @@ -174,6 +178,8 @@ |
761 | qDebug() << "Signal caught by Mir, stopping Mir server.."; |
762 | QCoreApplication::quit(); |
763 | }); |
764 | + |
765 | + m_clipboard->setupDBusService(); |
766 | } |
767 | |
768 | QPlatformAccessibility *MirServerIntegration::accessibility() const |
769 | @@ -206,3 +212,8 @@ |
770 | { |
771 | return m_nativeInterface; |
772 | } |
773 | + |
774 | +QPlatformClipboard *MirServerIntegration::clipboard() const |
775 | +{ |
776 | + return m_clipboard.data(); |
777 | +} |
778 | |
779 | === modified file 'src/platforms/mirserver/mirserverintegration.h' |
780 | --- src/platforms/mirserver/mirserverintegration.h 2014-06-03 20:53:46 +0000 |
781 | +++ src/platforms/mirserver/mirserverintegration.h 2014-09-23 11:37:20 +0000 |
782 | @@ -1,5 +1,5 @@ |
783 | /* |
784 | - * Copyright (C) 2013 Canonical, Ltd. |
785 | + * Copyright (C) 2013-2014 Canonical, Ltd. |
786 | * |
787 | * This program is free software: you can redistribute it and/or modify it under |
788 | * the terms of the GNU Lesser General Public License version 3, as published by |
789 | @@ -13,7 +13,8 @@ |
790 | * You should have received a copy of the GNU Lesser General Public License |
791 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
792 | * |
793 | - * Author: Gerry Boland <gerry.boland@canonical.com> |
794 | + * Authors: Gerry Boland <gerry.boland@canonical.com> |
795 | + * Daniel d'Andrada <daniel.dandrada@canonical.com> |
796 | */ |
797 | |
798 | #ifndef MIRSERVERINTEGRATION_H |
799 | @@ -29,6 +30,10 @@ |
800 | class NativeInterface; |
801 | class QMirServer; |
802 | |
803 | +namespace qtmir { |
804 | + class Clipboard; |
805 | +} |
806 | + |
807 | class MirServerIntegration : public QPlatformIntegration |
808 | { |
809 | public: |
810 | @@ -49,6 +54,8 @@ |
811 | void initialize() override; |
812 | #endif |
813 | |
814 | + QPlatformClipboard *clipboard() const override; |
815 | + |
816 | QPlatformInputContext* inputContext() const override { return m_inputContext; } |
817 | |
818 | QPlatformFontDatabase *fontDatabase() const override; |
819 | @@ -74,6 +81,7 @@ |
820 | QMirServer *m_mirServer; |
821 | NativeInterface *m_nativeInterface; |
822 | QPlatformInputContext* m_inputContext; |
823 | + QScopedPointer<qtmir::Clipboard> m_clipboard; |
824 | }; |
825 | |
826 | #endif // MIRSERVERINTEGRATION_H |
827 | |
828 | === removed file 'src/platforms/mirserver/unityprotobufservice.cpp' |
829 | --- src/platforms/mirserver/unityprotobufservice.cpp 2014-06-16 18:29:36 +0000 |
830 | +++ src/platforms/mirserver/unityprotobufservice.cpp 1970-01-01 00:00:00 +0000 |
831 | @@ -1,35 +0,0 @@ |
832 | -/* |
833 | - * Copyright (C) 2014 Canonical, Ltd. |
834 | - * |
835 | - * This program is free software: you can redistribute it and/or modify it under |
836 | - * the terms of the GNU Lesser General Public License version 3, as published by |
837 | - * the Free Software Foundation. |
838 | - * |
839 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
840 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
841 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
842 | - * Lesser General Public License for more details. |
843 | - * |
844 | - * You should have received a copy of the GNU Lesser General Public License |
845 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
846 | - */ |
847 | - |
848 | -#include "unityprotobufservice.h" |
849 | - |
850 | -void UnityProtobufService::copy(::google::protobuf::RpcController* /*controller*/, |
851 | - const ::unity::protobuf::Clip* newClip, |
852 | - ::unity::protobuf::Void* /*response*/, |
853 | - ::google::protobuf::Closure* done) |
854 | -{ |
855 | - m_clip = newClip->content(); |
856 | - done->Run(); |
857 | -} |
858 | - |
859 | -void UnityProtobufService::paste(::google::protobuf::RpcController* /*controller*/, |
860 | - const ::unity::protobuf::Void* /*request*/, |
861 | - ::unity::protobuf::Clip* clipReturned, |
862 | - ::google::protobuf::Closure* done) |
863 | -{ |
864 | - clipReturned->set_content(m_clip); |
865 | - done->Run(); |
866 | -} |
867 | |
868 | === removed file 'src/platforms/mirserver/unityprotobufservice.h' |
869 | --- src/platforms/mirserver/unityprotobufservice.h 2014-06-16 18:29:36 +0000 |
870 | +++ src/platforms/mirserver/unityprotobufservice.h 1970-01-01 00:00:00 +0000 |
871 | @@ -1,40 +0,0 @@ |
872 | -/* |
873 | - * Copyright (C) 2014 Canonical, Ltd. |
874 | - * |
875 | - * This program is free software: you can redistribute it and/or modify it under |
876 | - * the terms of the GNU Lesser General Public License version 3, as published by |
877 | - * the Free Software Foundation. |
878 | - * |
879 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
880 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
881 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
882 | - * Lesser General Public License for more details. |
883 | - * |
884 | - * You should have received a copy of the GNU Lesser General Public License |
885 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
886 | - */ |
887 | - |
888 | -#ifndef UNITY_PROTOBUF_SERVICE_H |
889 | -#define UNITY_PROTOBUF_SERVICE_H |
890 | - |
891 | -#include "unityrpc.h" |
892 | -#include <string> |
893 | - |
894 | -class UnityProtobufService : public unity::protobuf::UnityService |
895 | -{ |
896 | -public: |
897 | - void copy(::google::protobuf::RpcController* controller, |
898 | - const ::unity::protobuf::Clip* request, |
899 | - ::unity::protobuf::Void* response, |
900 | - ::google::protobuf::Closure* done) override; |
901 | - |
902 | - void paste(::google::protobuf::RpcController* controller, |
903 | - const ::unity::protobuf::Void* request, |
904 | - ::unity::protobuf::Clip* response, |
905 | - ::google::protobuf::Closure* done) override; |
906 | - |
907 | -private: |
908 | - std::string m_clip; |
909 | -}; |
910 | - |
911 | -#endif // UNITY_PROTOBUF_SERVICE_H |
912 | |
913 | === removed file 'src/platforms/mirserver/unityrpc.cpp' |
914 | --- src/platforms/mirserver/unityrpc.cpp 2014-06-16 18:29:36 +0000 |
915 | +++ src/platforms/mirserver/unityrpc.cpp 1970-01-01 00:00:00 +0000 |
916 | @@ -1,742 +0,0 @@ |
917 | -// Generated by the protocol buffer compiler. DO NOT EDIT! |
918 | -// source: unityrpc.proto |
919 | - |
920 | -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION |
921 | -#include "unityrpc.h" |
922 | - |
923 | -#include <algorithm> |
924 | - |
925 | -#include <google/protobuf/stubs/common.h> |
926 | -#include <google/protobuf/stubs/once.h> |
927 | -#include <google/protobuf/io/coded_stream.h> |
928 | -#include <google/protobuf/wire_format_lite_inl.h> |
929 | -#include <google/protobuf/descriptor.h> |
930 | -#include <google/protobuf/generated_message_reflection.h> |
931 | -#include <google/protobuf/reflection_ops.h> |
932 | -#include <google/protobuf/wire_format.h> |
933 | -// @@protoc_insertion_point(includes) |
934 | - |
935 | -namespace unity { |
936 | -namespace protobuf { |
937 | - |
938 | -namespace { |
939 | - |
940 | -const ::google::protobuf::Descriptor* Clip_descriptor_ = NULL; |
941 | -const ::google::protobuf::internal::GeneratedMessageReflection* |
942 | - Clip_reflection_ = NULL; |
943 | -const ::google::protobuf::Descriptor* Void_descriptor_ = NULL; |
944 | -const ::google::protobuf::internal::GeneratedMessageReflection* |
945 | - Void_reflection_ = NULL; |
946 | -const ::google::protobuf::ServiceDescriptor* UnityService_descriptor_ = NULL; |
947 | - |
948 | -} // namespace |
949 | - |
950 | - |
951 | -void protobuf_AssignDesc_unityrpc_2eproto() { |
952 | - protobuf_AddDesc_unityrpc_2eproto(); |
953 | - const ::google::protobuf::FileDescriptor* file = |
954 | - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( |
955 | - "unityrpc.proto"); |
956 | - GOOGLE_CHECK(file != NULL); |
957 | - Clip_descriptor_ = file->message_type(0); |
958 | - static const int Clip_offsets_[2] = { |
959 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Clip, content_), |
960 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Clip, error_), |
961 | - }; |
962 | - Clip_reflection_ = |
963 | - new ::google::protobuf::internal::GeneratedMessageReflection( |
964 | - Clip_descriptor_, |
965 | - Clip::default_instance_, |
966 | - Clip_offsets_, |
967 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Clip, _has_bits_[0]), |
968 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Clip, _unknown_fields_), |
969 | - -1, |
970 | - ::google::protobuf::DescriptorPool::generated_pool(), |
971 | - ::google::protobuf::MessageFactory::generated_factory(), |
972 | - sizeof(Clip)); |
973 | - Void_descriptor_ = file->message_type(1); |
974 | - static const int Void_offsets_[1] = { |
975 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Void, error_), |
976 | - }; |
977 | - Void_reflection_ = |
978 | - new ::google::protobuf::internal::GeneratedMessageReflection( |
979 | - Void_descriptor_, |
980 | - Void::default_instance_, |
981 | - Void_offsets_, |
982 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Void, _has_bits_[0]), |
983 | - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Void, _unknown_fields_), |
984 | - -1, |
985 | - ::google::protobuf::DescriptorPool::generated_pool(), |
986 | - ::google::protobuf::MessageFactory::generated_factory(), |
987 | - sizeof(Void)); |
988 | - UnityService_descriptor_ = file->service(0); |
989 | -} |
990 | - |
991 | -namespace { |
992 | - |
993 | -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); |
994 | -inline void protobuf_AssignDescriptorsOnce() { |
995 | - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, |
996 | - &protobuf_AssignDesc_unityrpc_2eproto); |
997 | -} |
998 | - |
999 | -void protobuf_RegisterTypes(const ::std::string&) { |
1000 | - protobuf_AssignDescriptorsOnce(); |
1001 | - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( |
1002 | - Clip_descriptor_, &Clip::default_instance()); |
1003 | - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( |
1004 | - Void_descriptor_, &Void::default_instance()); |
1005 | -} |
1006 | - |
1007 | -} // namespace |
1008 | - |
1009 | -void protobuf_ShutdownFile_unityrpc_2eproto() { |
1010 | - delete Clip::default_instance_; |
1011 | - delete Clip_reflection_; |
1012 | - delete Void::default_instance_; |
1013 | - delete Void_reflection_; |
1014 | -} |
1015 | - |
1016 | -void protobuf_AddDesc_unityrpc_2eproto() { |
1017 | - static bool already_here = false; |
1018 | - if (already_here) return; |
1019 | - already_here = true; |
1020 | - GOOGLE_PROTOBUF_VERIFY_VERSION; |
1021 | - |
1022 | - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( |
1023 | - "\n\016unityrpc.proto\022\016unity.protobuf\"&\n\004Clip" |
1024 | - "\022\017\n\007content\030\001 \002(\014\022\r\n\005error\030\177 \001(\t\"\025\n\004Void" |
1025 | - "\022\r\n\005error\030\177 \001(\t2w\n\014UnityService\0222\n\004copy\022" |
1026 | - "\024.unity.protobuf.Clip\032\024.unity.protobuf.V" |
1027 | - "oid\0223\n\005paste\022\024.unity.protobuf.Void\032\024.uni" |
1028 | - "ty.protobuf.ClipB\003\200\001\001", 221); |
1029 | - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( |
1030 | - "unityrpc.proto", &protobuf_RegisterTypes); |
1031 | - Clip::default_instance_ = new Clip(); |
1032 | - Void::default_instance_ = new Void(); |
1033 | - Clip::default_instance_->InitAsDefaultInstance(); |
1034 | - Void::default_instance_->InitAsDefaultInstance(); |
1035 | - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_unityrpc_2eproto); |
1036 | -} |
1037 | - |
1038 | -// Force AddDescriptors() to be called at static initialization time. |
1039 | -struct StaticDescriptorInitializer_unityrpc_2eproto { |
1040 | - StaticDescriptorInitializer_unityrpc_2eproto() { |
1041 | - protobuf_AddDesc_unityrpc_2eproto(); |
1042 | - } |
1043 | -} static_descriptor_initializer_unityrpc_2eproto_; |
1044 | - |
1045 | -// =================================================================== |
1046 | - |
1047 | -#ifndef _MSC_VER |
1048 | -const int Clip::kContentFieldNumber; |
1049 | -const int Clip::kErrorFieldNumber; |
1050 | -#endif // !_MSC_VER |
1051 | - |
1052 | -Clip::Clip() |
1053 | - : ::google::protobuf::Message() { |
1054 | - SharedCtor(); |
1055 | -} |
1056 | - |
1057 | -void Clip::InitAsDefaultInstance() { |
1058 | -} |
1059 | - |
1060 | -Clip::Clip(const Clip& from) |
1061 | - : ::google::protobuf::Message() { |
1062 | - SharedCtor(); |
1063 | - MergeFrom(from); |
1064 | -} |
1065 | - |
1066 | -void Clip::SharedCtor() { |
1067 | - _cached_size_ = 0; |
1068 | - content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
1069 | - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
1070 | - ::memset(_has_bits_, 0, sizeof(_has_bits_)); |
1071 | -} |
1072 | - |
1073 | -Clip::~Clip() { |
1074 | - SharedDtor(); |
1075 | -} |
1076 | - |
1077 | -void Clip::SharedDtor() { |
1078 | - if (content_ != &::google::protobuf::internal::kEmptyString) { |
1079 | - delete content_; |
1080 | - } |
1081 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
1082 | - delete error_; |
1083 | - } |
1084 | - if (this != default_instance_) { |
1085 | - } |
1086 | -} |
1087 | - |
1088 | -void Clip::SetCachedSize(int size) const { |
1089 | - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); |
1090 | - _cached_size_ = size; |
1091 | - GOOGLE_SAFE_CONCURRENT_WRITES_END(); |
1092 | -} |
1093 | -const ::google::protobuf::Descriptor* Clip::descriptor() { |
1094 | - protobuf_AssignDescriptorsOnce(); |
1095 | - return Clip_descriptor_; |
1096 | -} |
1097 | - |
1098 | -const Clip& Clip::default_instance() { |
1099 | - if (default_instance_ == NULL) protobuf_AddDesc_unityrpc_2eproto(); |
1100 | - return *default_instance_; |
1101 | -} |
1102 | - |
1103 | -Clip* Clip::default_instance_ = NULL; |
1104 | - |
1105 | -Clip* Clip::New() const { |
1106 | - return new Clip; |
1107 | -} |
1108 | - |
1109 | -void Clip::Clear() { |
1110 | - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { |
1111 | - if (has_content()) { |
1112 | - if (content_ != &::google::protobuf::internal::kEmptyString) { |
1113 | - content_->clear(); |
1114 | - } |
1115 | - } |
1116 | - if (has_error()) { |
1117 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
1118 | - error_->clear(); |
1119 | - } |
1120 | - } |
1121 | - } |
1122 | - ::memset(_has_bits_, 0, sizeof(_has_bits_)); |
1123 | - mutable_unknown_fields()->Clear(); |
1124 | -} |
1125 | - |
1126 | -bool Clip::MergePartialFromCodedStream( |
1127 | - ::google::protobuf::io::CodedInputStream* input) { |
1128 | -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false |
1129 | - ::google::protobuf::uint32 tag; |
1130 | - while ((tag = input->ReadTag()) != 0) { |
1131 | - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { |
1132 | - // required bytes content = 1; |
1133 | - case 1: { |
1134 | - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == |
1135 | - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { |
1136 | - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( |
1137 | - input, this->mutable_content())); |
1138 | - } else { |
1139 | - goto handle_uninterpreted; |
1140 | - } |
1141 | - if (input->ExpectTag(1018)) goto parse_error; |
1142 | - break; |
1143 | - } |
1144 | - |
1145 | - // optional string error = 127; |
1146 | - case 127: { |
1147 | - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == |
1148 | - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { |
1149 | - parse_error: |
1150 | - DO_(::google::protobuf::internal::WireFormatLite::ReadString( |
1151 | - input, this->mutable_error())); |
1152 | - ::google::protobuf::internal::WireFormat::VerifyUTF8String( |
1153 | - this->error().data(), this->error().length(), |
1154 | - ::google::protobuf::internal::WireFormat::PARSE); |
1155 | - } else { |
1156 | - goto handle_uninterpreted; |
1157 | - } |
1158 | - if (input->ExpectAtEnd()) return true; |
1159 | - break; |
1160 | - } |
1161 | - |
1162 | - default: { |
1163 | - handle_uninterpreted: |
1164 | - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == |
1165 | - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { |
1166 | - return true; |
1167 | - } |
1168 | - DO_(::google::protobuf::internal::WireFormat::SkipField( |
1169 | - input, tag, mutable_unknown_fields())); |
1170 | - break; |
1171 | - } |
1172 | - } |
1173 | - } |
1174 | - return true; |
1175 | -#undef DO_ |
1176 | -} |
1177 | - |
1178 | -void Clip::SerializeWithCachedSizes( |
1179 | - ::google::protobuf::io::CodedOutputStream* output) const { |
1180 | - // required bytes content = 1; |
1181 | - if (has_content()) { |
1182 | - ::google::protobuf::internal::WireFormatLite::WriteBytes( |
1183 | - 1, this->content(), output); |
1184 | - } |
1185 | - |
1186 | - // optional string error = 127; |
1187 | - if (has_error()) { |
1188 | - ::google::protobuf::internal::WireFormat::VerifyUTF8String( |
1189 | - this->error().data(), this->error().length(), |
1190 | - ::google::protobuf::internal::WireFormat::SERIALIZE); |
1191 | - ::google::protobuf::internal::WireFormatLite::WriteString( |
1192 | - 127, this->error(), output); |
1193 | - } |
1194 | - |
1195 | - if (!unknown_fields().empty()) { |
1196 | - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( |
1197 | - unknown_fields(), output); |
1198 | - } |
1199 | -} |
1200 | - |
1201 | -::google::protobuf::uint8* Clip::SerializeWithCachedSizesToArray( |
1202 | - ::google::protobuf::uint8* target) const { |
1203 | - // required bytes content = 1; |
1204 | - if (has_content()) { |
1205 | - target = |
1206 | - ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( |
1207 | - 1, this->content(), target); |
1208 | - } |
1209 | - |
1210 | - // optional string error = 127; |
1211 | - if (has_error()) { |
1212 | - ::google::protobuf::internal::WireFormat::VerifyUTF8String( |
1213 | - this->error().data(), this->error().length(), |
1214 | - ::google::protobuf::internal::WireFormat::SERIALIZE); |
1215 | - target = |
1216 | - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( |
1217 | - 127, this->error(), target); |
1218 | - } |
1219 | - |
1220 | - if (!unknown_fields().empty()) { |
1221 | - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( |
1222 | - unknown_fields(), target); |
1223 | - } |
1224 | - return target; |
1225 | -} |
1226 | - |
1227 | -int Clip::ByteSize() const { |
1228 | - int total_size = 0; |
1229 | - |
1230 | - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { |
1231 | - // required bytes content = 1; |
1232 | - if (has_content()) { |
1233 | - total_size += 1 + |
1234 | - ::google::protobuf::internal::WireFormatLite::BytesSize( |
1235 | - this->content()); |
1236 | - } |
1237 | - |
1238 | - // optional string error = 127; |
1239 | - if (has_error()) { |
1240 | - total_size += 2 + |
1241 | - ::google::protobuf::internal::WireFormatLite::StringSize( |
1242 | - this->error()); |
1243 | - } |
1244 | - |
1245 | - } |
1246 | - if (!unknown_fields().empty()) { |
1247 | - total_size += |
1248 | - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( |
1249 | - unknown_fields()); |
1250 | - } |
1251 | - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); |
1252 | - _cached_size_ = total_size; |
1253 | - GOOGLE_SAFE_CONCURRENT_WRITES_END(); |
1254 | - return total_size; |
1255 | -} |
1256 | - |
1257 | -void Clip::MergeFrom(const ::google::protobuf::Message& from) { |
1258 | - GOOGLE_CHECK_NE(&from, this); |
1259 | - const Clip* source = |
1260 | - ::google::protobuf::internal::dynamic_cast_if_available<const Clip*>( |
1261 | - &from); |
1262 | - if (source == NULL) { |
1263 | - ::google::protobuf::internal::ReflectionOps::Merge(from, this); |
1264 | - } else { |
1265 | - MergeFrom(*source); |
1266 | - } |
1267 | -} |
1268 | - |
1269 | -void Clip::MergeFrom(const Clip& from) { |
1270 | - GOOGLE_CHECK_NE(&from, this); |
1271 | - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { |
1272 | - if (from.has_content()) { |
1273 | - set_content(from.content()); |
1274 | - } |
1275 | - if (from.has_error()) { |
1276 | - set_error(from.error()); |
1277 | - } |
1278 | - } |
1279 | - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); |
1280 | -} |
1281 | - |
1282 | -void Clip::CopyFrom(const ::google::protobuf::Message& from) { |
1283 | - if (&from == this) return; |
1284 | - Clear(); |
1285 | - MergeFrom(from); |
1286 | -} |
1287 | - |
1288 | -void Clip::CopyFrom(const Clip& from) { |
1289 | - if (&from == this) return; |
1290 | - Clear(); |
1291 | - MergeFrom(from); |
1292 | -} |
1293 | - |
1294 | -bool Clip::IsInitialized() const { |
1295 | - if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; |
1296 | - |
1297 | - return true; |
1298 | -} |
1299 | - |
1300 | -void Clip::Swap(Clip* other) { |
1301 | - if (other != this) { |
1302 | - std::swap(content_, other->content_); |
1303 | - std::swap(error_, other->error_); |
1304 | - std::swap(_has_bits_[0], other->_has_bits_[0]); |
1305 | - _unknown_fields_.Swap(&other->_unknown_fields_); |
1306 | - std::swap(_cached_size_, other->_cached_size_); |
1307 | - } |
1308 | -} |
1309 | - |
1310 | -::google::protobuf::Metadata Clip::GetMetadata() const { |
1311 | - protobuf_AssignDescriptorsOnce(); |
1312 | - ::google::protobuf::Metadata metadata; |
1313 | - metadata.descriptor = Clip_descriptor_; |
1314 | - metadata.reflection = Clip_reflection_; |
1315 | - return metadata; |
1316 | -} |
1317 | - |
1318 | - |
1319 | -// =================================================================== |
1320 | - |
1321 | -#ifndef _MSC_VER |
1322 | -const int Void::kErrorFieldNumber; |
1323 | -#endif // !_MSC_VER |
1324 | - |
1325 | -Void::Void() |
1326 | - : ::google::protobuf::Message() { |
1327 | - SharedCtor(); |
1328 | -} |
1329 | - |
1330 | -void Void::InitAsDefaultInstance() { |
1331 | -} |
1332 | - |
1333 | -Void::Void(const Void& from) |
1334 | - : ::google::protobuf::Message() { |
1335 | - SharedCtor(); |
1336 | - MergeFrom(from); |
1337 | -} |
1338 | - |
1339 | -void Void::SharedCtor() { |
1340 | - _cached_size_ = 0; |
1341 | - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
1342 | - ::memset(_has_bits_, 0, sizeof(_has_bits_)); |
1343 | -} |
1344 | - |
1345 | -Void::~Void() { |
1346 | - SharedDtor(); |
1347 | -} |
1348 | - |
1349 | -void Void::SharedDtor() { |
1350 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
1351 | - delete error_; |
1352 | - } |
1353 | - if (this != default_instance_) { |
1354 | - } |
1355 | -} |
1356 | - |
1357 | -void Void::SetCachedSize(int size) const { |
1358 | - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); |
1359 | - _cached_size_ = size; |
1360 | - GOOGLE_SAFE_CONCURRENT_WRITES_END(); |
1361 | -} |
1362 | -const ::google::protobuf::Descriptor* Void::descriptor() { |
1363 | - protobuf_AssignDescriptorsOnce(); |
1364 | - return Void_descriptor_; |
1365 | -} |
1366 | - |
1367 | -const Void& Void::default_instance() { |
1368 | - if (default_instance_ == NULL) protobuf_AddDesc_unityrpc_2eproto(); |
1369 | - return *default_instance_; |
1370 | -} |
1371 | - |
1372 | -Void* Void::default_instance_ = NULL; |
1373 | - |
1374 | -Void* Void::New() const { |
1375 | - return new Void; |
1376 | -} |
1377 | - |
1378 | -void Void::Clear() { |
1379 | - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { |
1380 | - if (has_error()) { |
1381 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
1382 | - error_->clear(); |
1383 | - } |
1384 | - } |
1385 | - } |
1386 | - ::memset(_has_bits_, 0, sizeof(_has_bits_)); |
1387 | - mutable_unknown_fields()->Clear(); |
1388 | -} |
1389 | - |
1390 | -bool Void::MergePartialFromCodedStream( |
1391 | - ::google::protobuf::io::CodedInputStream* input) { |
1392 | -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false |
1393 | - ::google::protobuf::uint32 tag; |
1394 | - while ((tag = input->ReadTag()) != 0) { |
1395 | - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { |
1396 | - // optional string error = 127; |
1397 | - case 127: { |
1398 | - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == |
1399 | - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { |
1400 | - DO_(::google::protobuf::internal::WireFormatLite::ReadString( |
1401 | - input, this->mutable_error())); |
1402 | - ::google::protobuf::internal::WireFormat::VerifyUTF8String( |
1403 | - this->error().data(), this->error().length(), |
1404 | - ::google::protobuf::internal::WireFormat::PARSE); |
1405 | - } else { |
1406 | - goto handle_uninterpreted; |
1407 | - } |
1408 | - if (input->ExpectAtEnd()) return true; |
1409 | - break; |
1410 | - } |
1411 | - |
1412 | - default: { |
1413 | - handle_uninterpreted: |
1414 | - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == |
1415 | - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { |
1416 | - return true; |
1417 | - } |
1418 | - DO_(::google::protobuf::internal::WireFormat::SkipField( |
1419 | - input, tag, mutable_unknown_fields())); |
1420 | - break; |
1421 | - } |
1422 | - } |
1423 | - } |
1424 | - return true; |
1425 | -#undef DO_ |
1426 | -} |
1427 | - |
1428 | -void Void::SerializeWithCachedSizes( |
1429 | - ::google::protobuf::io::CodedOutputStream* output) const { |
1430 | - // optional string error = 127; |
1431 | - if (has_error()) { |
1432 | - ::google::protobuf::internal::WireFormat::VerifyUTF8String( |
1433 | - this->error().data(), this->error().length(), |
1434 | - ::google::protobuf::internal::WireFormat::SERIALIZE); |
1435 | - ::google::protobuf::internal::WireFormatLite::WriteString( |
1436 | - 127, this->error(), output); |
1437 | - } |
1438 | - |
1439 | - if (!unknown_fields().empty()) { |
1440 | - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( |
1441 | - unknown_fields(), output); |
1442 | - } |
1443 | -} |
1444 | - |
1445 | -::google::protobuf::uint8* Void::SerializeWithCachedSizesToArray( |
1446 | - ::google::protobuf::uint8* target) const { |
1447 | - // optional string error = 127; |
1448 | - if (has_error()) { |
1449 | - ::google::protobuf::internal::WireFormat::VerifyUTF8String( |
1450 | - this->error().data(), this->error().length(), |
1451 | - ::google::protobuf::internal::WireFormat::SERIALIZE); |
1452 | - target = |
1453 | - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( |
1454 | - 127, this->error(), target); |
1455 | - } |
1456 | - |
1457 | - if (!unknown_fields().empty()) { |
1458 | - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( |
1459 | - unknown_fields(), target); |
1460 | - } |
1461 | - return target; |
1462 | -} |
1463 | - |
1464 | -int Void::ByteSize() const { |
1465 | - int total_size = 0; |
1466 | - |
1467 | - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { |
1468 | - // optional string error = 127; |
1469 | - if (has_error()) { |
1470 | - total_size += 2 + |
1471 | - ::google::protobuf::internal::WireFormatLite::StringSize( |
1472 | - this->error()); |
1473 | - } |
1474 | - |
1475 | - } |
1476 | - if (!unknown_fields().empty()) { |
1477 | - total_size += |
1478 | - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( |
1479 | - unknown_fields()); |
1480 | - } |
1481 | - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); |
1482 | - _cached_size_ = total_size; |
1483 | - GOOGLE_SAFE_CONCURRENT_WRITES_END(); |
1484 | - return total_size; |
1485 | -} |
1486 | - |
1487 | -void Void::MergeFrom(const ::google::protobuf::Message& from) { |
1488 | - GOOGLE_CHECK_NE(&from, this); |
1489 | - const Void* source = |
1490 | - ::google::protobuf::internal::dynamic_cast_if_available<const Void*>( |
1491 | - &from); |
1492 | - if (source == NULL) { |
1493 | - ::google::protobuf::internal::ReflectionOps::Merge(from, this); |
1494 | - } else { |
1495 | - MergeFrom(*source); |
1496 | - } |
1497 | -} |
1498 | - |
1499 | -void Void::MergeFrom(const Void& from) { |
1500 | - GOOGLE_CHECK_NE(&from, this); |
1501 | - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { |
1502 | - if (from.has_error()) { |
1503 | - set_error(from.error()); |
1504 | - } |
1505 | - } |
1506 | - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); |
1507 | -} |
1508 | - |
1509 | -void Void::CopyFrom(const ::google::protobuf::Message& from) { |
1510 | - if (&from == this) return; |
1511 | - Clear(); |
1512 | - MergeFrom(from); |
1513 | -} |
1514 | - |
1515 | -void Void::CopyFrom(const Void& from) { |
1516 | - if (&from == this) return; |
1517 | - Clear(); |
1518 | - MergeFrom(from); |
1519 | -} |
1520 | - |
1521 | -bool Void::IsInitialized() const { |
1522 | - |
1523 | - return true; |
1524 | -} |
1525 | - |
1526 | -void Void::Swap(Void* other) { |
1527 | - if (other != this) { |
1528 | - std::swap(error_, other->error_); |
1529 | - std::swap(_has_bits_[0], other->_has_bits_[0]); |
1530 | - _unknown_fields_.Swap(&other->_unknown_fields_); |
1531 | - std::swap(_cached_size_, other->_cached_size_); |
1532 | - } |
1533 | -} |
1534 | - |
1535 | -::google::protobuf::Metadata Void::GetMetadata() const { |
1536 | - protobuf_AssignDescriptorsOnce(); |
1537 | - ::google::protobuf::Metadata metadata; |
1538 | - metadata.descriptor = Void_descriptor_; |
1539 | - metadata.reflection = Void_reflection_; |
1540 | - return metadata; |
1541 | -} |
1542 | - |
1543 | - |
1544 | -// =================================================================== |
1545 | - |
1546 | -UnityService::~UnityService() {} |
1547 | - |
1548 | -const ::google::protobuf::ServiceDescriptor* UnityService::descriptor() { |
1549 | - protobuf_AssignDescriptorsOnce(); |
1550 | - return UnityService_descriptor_; |
1551 | -} |
1552 | - |
1553 | -const ::google::protobuf::ServiceDescriptor* UnityService::GetDescriptor() { |
1554 | - protobuf_AssignDescriptorsOnce(); |
1555 | - return UnityService_descriptor_; |
1556 | -} |
1557 | - |
1558 | -void UnityService::copy(::google::protobuf::RpcController* controller, |
1559 | - const ::unity::protobuf::Clip*, |
1560 | - ::unity::protobuf::Void*, |
1561 | - ::google::protobuf::Closure* done) { |
1562 | - controller->SetFailed("Method copy() not implemented."); |
1563 | - done->Run(); |
1564 | -} |
1565 | - |
1566 | -void UnityService::paste(::google::protobuf::RpcController* controller, |
1567 | - const ::unity::protobuf::Void*, |
1568 | - ::unity::protobuf::Clip*, |
1569 | - ::google::protobuf::Closure* done) { |
1570 | - controller->SetFailed("Method paste() not implemented."); |
1571 | - done->Run(); |
1572 | -} |
1573 | - |
1574 | -void UnityService::CallMethod(const ::google::protobuf::MethodDescriptor* method, |
1575 | - ::google::protobuf::RpcController* controller, |
1576 | - const ::google::protobuf::Message* request, |
1577 | - ::google::protobuf::Message* response, |
1578 | - ::google::protobuf::Closure* done) { |
1579 | - GOOGLE_DCHECK_EQ(method->service(), UnityService_descriptor_); |
1580 | - switch(method->index()) { |
1581 | - case 0: |
1582 | - copy(controller, |
1583 | - ::google::protobuf::down_cast<const ::unity::protobuf::Clip*>(request), |
1584 | - ::google::protobuf::down_cast< ::unity::protobuf::Void*>(response), |
1585 | - done); |
1586 | - break; |
1587 | - case 1: |
1588 | - paste(controller, |
1589 | - ::google::protobuf::down_cast<const ::unity::protobuf::Void*>(request), |
1590 | - ::google::protobuf::down_cast< ::unity::protobuf::Clip*>(response), |
1591 | - done); |
1592 | - break; |
1593 | - default: |
1594 | - GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; |
1595 | - break; |
1596 | - } |
1597 | -} |
1598 | - |
1599 | -const ::google::protobuf::Message& UnityService::GetRequestPrototype( |
1600 | - const ::google::protobuf::MethodDescriptor* method) const { |
1601 | - GOOGLE_DCHECK_EQ(method->service(), descriptor()); |
1602 | - switch(method->index()) { |
1603 | - case 0: |
1604 | - return ::unity::protobuf::Clip::default_instance(); |
1605 | - case 1: |
1606 | - return ::unity::protobuf::Void::default_instance(); |
1607 | - default: |
1608 | - GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; |
1609 | - return *reinterpret_cast< ::google::protobuf::Message*>(NULL); |
1610 | - } |
1611 | -} |
1612 | - |
1613 | -const ::google::protobuf::Message& UnityService::GetResponsePrototype( |
1614 | - const ::google::protobuf::MethodDescriptor* method) const { |
1615 | - GOOGLE_DCHECK_EQ(method->service(), descriptor()); |
1616 | - switch(method->index()) { |
1617 | - case 0: |
1618 | - return ::unity::protobuf::Void::default_instance(); |
1619 | - case 1: |
1620 | - return ::unity::protobuf::Clip::default_instance(); |
1621 | - default: |
1622 | - GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; |
1623 | - return *reinterpret_cast< ::google::protobuf::Message*>(NULL); |
1624 | - } |
1625 | -} |
1626 | - |
1627 | -UnityService_Stub::UnityService_Stub(::google::protobuf::RpcChannel* channel) |
1628 | - : channel_(channel), owns_channel_(false) {} |
1629 | -UnityService_Stub::UnityService_Stub( |
1630 | - ::google::protobuf::RpcChannel* channel, |
1631 | - ::google::protobuf::Service::ChannelOwnership ownership) |
1632 | - : channel_(channel), |
1633 | - owns_channel_(ownership == ::google::protobuf::Service::STUB_OWNS_CHANNEL) {} |
1634 | -UnityService_Stub::~UnityService_Stub() { |
1635 | - if (owns_channel_) delete channel_; |
1636 | -} |
1637 | - |
1638 | -void UnityService_Stub::copy(::google::protobuf::RpcController* controller, |
1639 | - const ::unity::protobuf::Clip* request, |
1640 | - ::unity::protobuf::Void* response, |
1641 | - ::google::protobuf::Closure* done) { |
1642 | - channel_->CallMethod(descriptor()->method(0), |
1643 | - controller, request, response, done); |
1644 | -} |
1645 | -void UnityService_Stub::paste(::google::protobuf::RpcController* controller, |
1646 | - const ::unity::protobuf::Void* request, |
1647 | - ::unity::protobuf::Clip* response, |
1648 | - ::google::protobuf::Closure* done) { |
1649 | - channel_->CallMethod(descriptor()->method(1), |
1650 | - controller, request, response, done); |
1651 | -} |
1652 | - |
1653 | -// @@protoc_insertion_point(namespace_scope) |
1654 | - |
1655 | -} // namespace protobuf |
1656 | -} // namespace unity |
1657 | - |
1658 | -// @@protoc_insertion_point(global_scope) |
1659 | |
1660 | === removed file 'src/platforms/mirserver/unityrpc.h' |
1661 | --- src/platforms/mirserver/unityrpc.h 2014-06-16 18:29:36 +0000 |
1662 | +++ src/platforms/mirserver/unityrpc.h 1970-01-01 00:00:00 +0000 |
1663 | @@ -1,535 +0,0 @@ |
1664 | -// Generated by the protocol buffer compiler. DO NOT EDIT! |
1665 | -// source: unityrpc.proto |
1666 | - |
1667 | -#ifndef PROTOBUF_unityrpc_2eproto__INCLUDED |
1668 | -#define PROTOBUF_unityrpc_2eproto__INCLUDED |
1669 | - |
1670 | -#include <string> |
1671 | - |
1672 | -#include <google/protobuf/stubs/common.h> |
1673 | - |
1674 | -#if GOOGLE_PROTOBUF_VERSION < 2005000 |
1675 | -#error This file was generated by a newer version of protoc which is |
1676 | -#error incompatible with your Protocol Buffer headers. Please update |
1677 | -#error your headers. |
1678 | -#endif |
1679 | -#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION |
1680 | -#error This file was generated by an older version of protoc which is |
1681 | -#error incompatible with your Protocol Buffer headers. Please |
1682 | -#error regenerate this file with a newer version of protoc. |
1683 | -#endif |
1684 | - |
1685 | -#include <google/protobuf/generated_message_util.h> |
1686 | -#include <google/protobuf/message.h> |
1687 | -#include <google/protobuf/repeated_field.h> |
1688 | -#include <google/protobuf/extension_set.h> |
1689 | -#include <google/protobuf/service.h> |
1690 | -#include <google/protobuf/unknown_field_set.h> |
1691 | -// @@protoc_insertion_point(includes) |
1692 | - |
1693 | -namespace unity { |
1694 | -namespace protobuf { |
1695 | - |
1696 | -// Internal implementation detail -- do not call these. |
1697 | -void protobuf_AddDesc_unityrpc_2eproto(); |
1698 | -void protobuf_AssignDesc_unityrpc_2eproto(); |
1699 | -void protobuf_ShutdownFile_unityrpc_2eproto(); |
1700 | - |
1701 | -class Clip; |
1702 | -class Void; |
1703 | - |
1704 | -// =================================================================== |
1705 | - |
1706 | -class Clip : public ::google::protobuf::Message { |
1707 | - public: |
1708 | - Clip(); |
1709 | - virtual ~Clip(); |
1710 | - |
1711 | - Clip(const Clip& from); |
1712 | - |
1713 | - inline Clip& operator=(const Clip& from) { |
1714 | - CopyFrom(from); |
1715 | - return *this; |
1716 | - } |
1717 | - |
1718 | - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { |
1719 | - return _unknown_fields_; |
1720 | - } |
1721 | - |
1722 | - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { |
1723 | - return &_unknown_fields_; |
1724 | - } |
1725 | - |
1726 | - static const ::google::protobuf::Descriptor* descriptor(); |
1727 | - static const Clip& default_instance(); |
1728 | - |
1729 | - void Swap(Clip* other); |
1730 | - |
1731 | - // implements Message ---------------------------------------------- |
1732 | - |
1733 | - Clip* New() const; |
1734 | - void CopyFrom(const ::google::protobuf::Message& from); |
1735 | - void MergeFrom(const ::google::protobuf::Message& from); |
1736 | - void CopyFrom(const Clip& from); |
1737 | - void MergeFrom(const Clip& from); |
1738 | - void Clear(); |
1739 | - bool IsInitialized() const; |
1740 | - |
1741 | - int ByteSize() const; |
1742 | - bool MergePartialFromCodedStream( |
1743 | - ::google::protobuf::io::CodedInputStream* input); |
1744 | - void SerializeWithCachedSizes( |
1745 | - ::google::protobuf::io::CodedOutputStream* output) const; |
1746 | - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; |
1747 | - int GetCachedSize() const { return _cached_size_; } |
1748 | - private: |
1749 | - void SharedCtor(); |
1750 | - void SharedDtor(); |
1751 | - void SetCachedSize(int size) const; |
1752 | - public: |
1753 | - |
1754 | - ::google::protobuf::Metadata GetMetadata() const; |
1755 | - |
1756 | - // nested types ---------------------------------------------------- |
1757 | - |
1758 | - // accessors ------------------------------------------------------- |
1759 | - |
1760 | - // required bytes content = 1; |
1761 | - inline bool has_content() const; |
1762 | - inline void clear_content(); |
1763 | - static const int kContentFieldNumber = 1; |
1764 | - inline const ::std::string& content() const; |
1765 | - inline void set_content(const ::std::string& value); |
1766 | - inline void set_content(const char* value); |
1767 | - inline void set_content(const void* value, size_t size); |
1768 | - inline ::std::string* mutable_content(); |
1769 | - inline ::std::string* release_content(); |
1770 | - inline void set_allocated_content(::std::string* content); |
1771 | - |
1772 | - // optional string error = 127; |
1773 | - inline bool has_error() const; |
1774 | - inline void clear_error(); |
1775 | - static const int kErrorFieldNumber = 127; |
1776 | - inline const ::std::string& error() const; |
1777 | - inline void set_error(const ::std::string& value); |
1778 | - inline void set_error(const char* value); |
1779 | - inline void set_error(const char* value, size_t size); |
1780 | - inline ::std::string* mutable_error(); |
1781 | - inline ::std::string* release_error(); |
1782 | - inline void set_allocated_error(::std::string* error); |
1783 | - |
1784 | - // @@protoc_insertion_point(class_scope:unity.protobuf.Clip) |
1785 | - private: |
1786 | - inline void set_has_content(); |
1787 | - inline void clear_has_content(); |
1788 | - inline void set_has_error(); |
1789 | - inline void clear_has_error(); |
1790 | - |
1791 | - ::google::protobuf::UnknownFieldSet _unknown_fields_; |
1792 | - |
1793 | - ::std::string* content_; |
1794 | - ::std::string* error_; |
1795 | - |
1796 | - mutable int _cached_size_; |
1797 | - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; |
1798 | - |
1799 | - friend void protobuf_AddDesc_unityrpc_2eproto(); |
1800 | - friend void protobuf_AssignDesc_unityrpc_2eproto(); |
1801 | - friend void protobuf_ShutdownFile_unityrpc_2eproto(); |
1802 | - |
1803 | - void InitAsDefaultInstance(); |
1804 | - static Clip* default_instance_; |
1805 | -}; |
1806 | -// ------------------------------------------------------------------- |
1807 | - |
1808 | -class Void : public ::google::protobuf::Message { |
1809 | - public: |
1810 | - Void(); |
1811 | - virtual ~Void(); |
1812 | - |
1813 | - Void(const Void& from); |
1814 | - |
1815 | - inline Void& operator=(const Void& from) { |
1816 | - CopyFrom(from); |
1817 | - return *this; |
1818 | - } |
1819 | - |
1820 | - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { |
1821 | - return _unknown_fields_; |
1822 | - } |
1823 | - |
1824 | - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { |
1825 | - return &_unknown_fields_; |
1826 | - } |
1827 | - |
1828 | - static const ::google::protobuf::Descriptor* descriptor(); |
1829 | - static const Void& default_instance(); |
1830 | - |
1831 | - void Swap(Void* other); |
1832 | - |
1833 | - // implements Message ---------------------------------------------- |
1834 | - |
1835 | - Void* New() const; |
1836 | - void CopyFrom(const ::google::protobuf::Message& from); |
1837 | - void MergeFrom(const ::google::protobuf::Message& from); |
1838 | - void CopyFrom(const Void& from); |
1839 | - void MergeFrom(const Void& from); |
1840 | - void Clear(); |
1841 | - bool IsInitialized() const; |
1842 | - |
1843 | - int ByteSize() const; |
1844 | - bool MergePartialFromCodedStream( |
1845 | - ::google::protobuf::io::CodedInputStream* input); |
1846 | - void SerializeWithCachedSizes( |
1847 | - ::google::protobuf::io::CodedOutputStream* output) const; |
1848 | - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; |
1849 | - int GetCachedSize() const { return _cached_size_; } |
1850 | - private: |
1851 | - void SharedCtor(); |
1852 | - void SharedDtor(); |
1853 | - void SetCachedSize(int size) const; |
1854 | - public: |
1855 | - |
1856 | - ::google::protobuf::Metadata GetMetadata() const; |
1857 | - |
1858 | - // nested types ---------------------------------------------------- |
1859 | - |
1860 | - // accessors ------------------------------------------------------- |
1861 | - |
1862 | - // optional string error = 127; |
1863 | - inline bool has_error() const; |
1864 | - inline void clear_error(); |
1865 | - static const int kErrorFieldNumber = 127; |
1866 | - inline const ::std::string& error() const; |
1867 | - inline void set_error(const ::std::string& value); |
1868 | - inline void set_error(const char* value); |
1869 | - inline void set_error(const char* value, size_t size); |
1870 | - inline ::std::string* mutable_error(); |
1871 | - inline ::std::string* release_error(); |
1872 | - inline void set_allocated_error(::std::string* error); |
1873 | - |
1874 | - // @@protoc_insertion_point(class_scope:unity.protobuf.Void) |
1875 | - private: |
1876 | - inline void set_has_error(); |
1877 | - inline void clear_has_error(); |
1878 | - |
1879 | - ::google::protobuf::UnknownFieldSet _unknown_fields_; |
1880 | - |
1881 | - ::std::string* error_; |
1882 | - |
1883 | - mutable int _cached_size_; |
1884 | - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; |
1885 | - |
1886 | - friend void protobuf_AddDesc_unityrpc_2eproto(); |
1887 | - friend void protobuf_AssignDesc_unityrpc_2eproto(); |
1888 | - friend void protobuf_ShutdownFile_unityrpc_2eproto(); |
1889 | - |
1890 | - void InitAsDefaultInstance(); |
1891 | - static Void* default_instance_; |
1892 | -}; |
1893 | -// =================================================================== |
1894 | - |
1895 | -class UnityService_Stub; |
1896 | - |
1897 | -class UnityService : public ::google::protobuf::Service { |
1898 | - protected: |
1899 | - // This class should be treated as an abstract interface. |
1900 | - inline UnityService() {}; |
1901 | - public: |
1902 | - virtual ~UnityService(); |
1903 | - |
1904 | - typedef UnityService_Stub Stub; |
1905 | - |
1906 | - static const ::google::protobuf::ServiceDescriptor* descriptor(); |
1907 | - |
1908 | - virtual void copy(::google::protobuf::RpcController* controller, |
1909 | - const ::unity::protobuf::Clip* request, |
1910 | - ::unity::protobuf::Void* response, |
1911 | - ::google::protobuf::Closure* done); |
1912 | - virtual void paste(::google::protobuf::RpcController* controller, |
1913 | - const ::unity::protobuf::Void* request, |
1914 | - ::unity::protobuf::Clip* response, |
1915 | - ::google::protobuf::Closure* done); |
1916 | - |
1917 | - // implements Service ---------------------------------------------- |
1918 | - |
1919 | - const ::google::protobuf::ServiceDescriptor* GetDescriptor(); |
1920 | - void CallMethod(const ::google::protobuf::MethodDescriptor* method, |
1921 | - ::google::protobuf::RpcController* controller, |
1922 | - const ::google::protobuf::Message* request, |
1923 | - ::google::protobuf::Message* response, |
1924 | - ::google::protobuf::Closure* done); |
1925 | - const ::google::protobuf::Message& GetRequestPrototype( |
1926 | - const ::google::protobuf::MethodDescriptor* method) const; |
1927 | - const ::google::protobuf::Message& GetResponsePrototype( |
1928 | - const ::google::protobuf::MethodDescriptor* method) const; |
1929 | - |
1930 | - private: |
1931 | - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UnityService); |
1932 | -}; |
1933 | - |
1934 | -class UnityService_Stub : public UnityService { |
1935 | - public: |
1936 | - UnityService_Stub(::google::protobuf::RpcChannel* channel); |
1937 | - UnityService_Stub(::google::protobuf::RpcChannel* channel, |
1938 | - ::google::protobuf::Service::ChannelOwnership ownership); |
1939 | - ~UnityService_Stub(); |
1940 | - |
1941 | - inline ::google::protobuf::RpcChannel* channel() { return channel_; } |
1942 | - |
1943 | - // implements UnityService ------------------------------------------ |
1944 | - |
1945 | - void copy(::google::protobuf::RpcController* controller, |
1946 | - const ::unity::protobuf::Clip* request, |
1947 | - ::unity::protobuf::Void* response, |
1948 | - ::google::protobuf::Closure* done); |
1949 | - void paste(::google::protobuf::RpcController* controller, |
1950 | - const ::unity::protobuf::Void* request, |
1951 | - ::unity::protobuf::Clip* response, |
1952 | - ::google::protobuf::Closure* done); |
1953 | - private: |
1954 | - ::google::protobuf::RpcChannel* channel_; |
1955 | - bool owns_channel_; |
1956 | - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UnityService_Stub); |
1957 | -}; |
1958 | - |
1959 | - |
1960 | -// =================================================================== |
1961 | - |
1962 | - |
1963 | -// =================================================================== |
1964 | - |
1965 | -// Clip |
1966 | - |
1967 | -// required bytes content = 1; |
1968 | -inline bool Clip::has_content() const { |
1969 | - return (_has_bits_[0] & 0x00000001u) != 0; |
1970 | -} |
1971 | -inline void Clip::set_has_content() { |
1972 | - _has_bits_[0] |= 0x00000001u; |
1973 | -} |
1974 | -inline void Clip::clear_has_content() { |
1975 | - _has_bits_[0] &= ~0x00000001u; |
1976 | -} |
1977 | -inline void Clip::clear_content() { |
1978 | - if (content_ != &::google::protobuf::internal::kEmptyString) { |
1979 | - content_->clear(); |
1980 | - } |
1981 | - clear_has_content(); |
1982 | -} |
1983 | -inline const ::std::string& Clip::content() const { |
1984 | - return *content_; |
1985 | -} |
1986 | -inline void Clip::set_content(const ::std::string& value) { |
1987 | - set_has_content(); |
1988 | - if (content_ == &::google::protobuf::internal::kEmptyString) { |
1989 | - content_ = new ::std::string; |
1990 | - } |
1991 | - content_->assign(value); |
1992 | -} |
1993 | -inline void Clip::set_content(const char* value) { |
1994 | - set_has_content(); |
1995 | - if (content_ == &::google::protobuf::internal::kEmptyString) { |
1996 | - content_ = new ::std::string; |
1997 | - } |
1998 | - content_->assign(value); |
1999 | -} |
2000 | -inline void Clip::set_content(const void* value, size_t size) { |
2001 | - set_has_content(); |
2002 | - if (content_ == &::google::protobuf::internal::kEmptyString) { |
2003 | - content_ = new ::std::string; |
2004 | - } |
2005 | - content_->assign(reinterpret_cast<const char*>(value), size); |
2006 | -} |
2007 | -inline ::std::string* Clip::mutable_content() { |
2008 | - set_has_content(); |
2009 | - if (content_ == &::google::protobuf::internal::kEmptyString) { |
2010 | - content_ = new ::std::string; |
2011 | - } |
2012 | - return content_; |
2013 | -} |
2014 | -inline ::std::string* Clip::release_content() { |
2015 | - clear_has_content(); |
2016 | - if (content_ == &::google::protobuf::internal::kEmptyString) { |
2017 | - return NULL; |
2018 | - } else { |
2019 | - ::std::string* temp = content_; |
2020 | - content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
2021 | - return temp; |
2022 | - } |
2023 | -} |
2024 | -inline void Clip::set_allocated_content(::std::string* content) { |
2025 | - if (content_ != &::google::protobuf::internal::kEmptyString) { |
2026 | - delete content_; |
2027 | - } |
2028 | - if (content) { |
2029 | - set_has_content(); |
2030 | - content_ = content; |
2031 | - } else { |
2032 | - clear_has_content(); |
2033 | - content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
2034 | - } |
2035 | -} |
2036 | - |
2037 | -// optional string error = 127; |
2038 | -inline bool Clip::has_error() const { |
2039 | - return (_has_bits_[0] & 0x00000002u) != 0; |
2040 | -} |
2041 | -inline void Clip::set_has_error() { |
2042 | - _has_bits_[0] |= 0x00000002u; |
2043 | -} |
2044 | -inline void Clip::clear_has_error() { |
2045 | - _has_bits_[0] &= ~0x00000002u; |
2046 | -} |
2047 | -inline void Clip::clear_error() { |
2048 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
2049 | - error_->clear(); |
2050 | - } |
2051 | - clear_has_error(); |
2052 | -} |
2053 | -inline const ::std::string& Clip::error() const { |
2054 | - return *error_; |
2055 | -} |
2056 | -inline void Clip::set_error(const ::std::string& value) { |
2057 | - set_has_error(); |
2058 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2059 | - error_ = new ::std::string; |
2060 | - } |
2061 | - error_->assign(value); |
2062 | -} |
2063 | -inline void Clip::set_error(const char* value) { |
2064 | - set_has_error(); |
2065 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2066 | - error_ = new ::std::string; |
2067 | - } |
2068 | - error_->assign(value); |
2069 | -} |
2070 | -inline void Clip::set_error(const char* value, size_t size) { |
2071 | - set_has_error(); |
2072 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2073 | - error_ = new ::std::string; |
2074 | - } |
2075 | - error_->assign(reinterpret_cast<const char*>(value), size); |
2076 | -} |
2077 | -inline ::std::string* Clip::mutable_error() { |
2078 | - set_has_error(); |
2079 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2080 | - error_ = new ::std::string; |
2081 | - } |
2082 | - return error_; |
2083 | -} |
2084 | -inline ::std::string* Clip::release_error() { |
2085 | - clear_has_error(); |
2086 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2087 | - return NULL; |
2088 | - } else { |
2089 | - ::std::string* temp = error_; |
2090 | - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
2091 | - return temp; |
2092 | - } |
2093 | -} |
2094 | -inline void Clip::set_allocated_error(::std::string* error) { |
2095 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
2096 | - delete error_; |
2097 | - } |
2098 | - if (error) { |
2099 | - set_has_error(); |
2100 | - error_ = error; |
2101 | - } else { |
2102 | - clear_has_error(); |
2103 | - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
2104 | - } |
2105 | -} |
2106 | - |
2107 | -// ------------------------------------------------------------------- |
2108 | - |
2109 | -// Void |
2110 | - |
2111 | -// optional string error = 127; |
2112 | -inline bool Void::has_error() const { |
2113 | - return (_has_bits_[0] & 0x00000001u) != 0; |
2114 | -} |
2115 | -inline void Void::set_has_error() { |
2116 | - _has_bits_[0] |= 0x00000001u; |
2117 | -} |
2118 | -inline void Void::clear_has_error() { |
2119 | - _has_bits_[0] &= ~0x00000001u; |
2120 | -} |
2121 | -inline void Void::clear_error() { |
2122 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
2123 | - error_->clear(); |
2124 | - } |
2125 | - clear_has_error(); |
2126 | -} |
2127 | -inline const ::std::string& Void::error() const { |
2128 | - return *error_; |
2129 | -} |
2130 | -inline void Void::set_error(const ::std::string& value) { |
2131 | - set_has_error(); |
2132 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2133 | - error_ = new ::std::string; |
2134 | - } |
2135 | - error_->assign(value); |
2136 | -} |
2137 | -inline void Void::set_error(const char* value) { |
2138 | - set_has_error(); |
2139 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2140 | - error_ = new ::std::string; |
2141 | - } |
2142 | - error_->assign(value); |
2143 | -} |
2144 | -inline void Void::set_error(const char* value, size_t size) { |
2145 | - set_has_error(); |
2146 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2147 | - error_ = new ::std::string; |
2148 | - } |
2149 | - error_->assign(reinterpret_cast<const char*>(value), size); |
2150 | -} |
2151 | -inline ::std::string* Void::mutable_error() { |
2152 | - set_has_error(); |
2153 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2154 | - error_ = new ::std::string; |
2155 | - } |
2156 | - return error_; |
2157 | -} |
2158 | -inline ::std::string* Void::release_error() { |
2159 | - clear_has_error(); |
2160 | - if (error_ == &::google::protobuf::internal::kEmptyString) { |
2161 | - return NULL; |
2162 | - } else { |
2163 | - ::std::string* temp = error_; |
2164 | - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
2165 | - return temp; |
2166 | - } |
2167 | -} |
2168 | -inline void Void::set_allocated_error(::std::string* error) { |
2169 | - if (error_ != &::google::protobuf::internal::kEmptyString) { |
2170 | - delete error_; |
2171 | - } |
2172 | - if (error) { |
2173 | - set_has_error(); |
2174 | - error_ = error; |
2175 | - } else { |
2176 | - clear_has_error(); |
2177 | - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); |
2178 | - } |
2179 | -} |
2180 | - |
2181 | - |
2182 | -// @@protoc_insertion_point(namespace_scope) |
2183 | - |
2184 | -} // namespace protobuf |
2185 | -} // namespace unity |
2186 | - |
2187 | -#ifndef SWIG |
2188 | -namespace google { |
2189 | -namespace protobuf { |
2190 | - |
2191 | - |
2192 | -} // namespace google |
2193 | -} // namespace protobuf |
2194 | -#endif // SWIG |
2195 | - |
2196 | -// @@protoc_insertion_point(global_scope) |
2197 | - |
2198 | -#endif // PROTOBUF_unityrpc_2eproto__INCLUDED |
2199 | |
2200 | === removed file 'src/platforms/mirserver/unityrpc.proto' |
2201 | --- src/platforms/mirserver/unityrpc.proto 2014-06-16 18:29:36 +0000 |
2202 | +++ src/platforms/mirserver/unityrpc.proto 1970-01-01 00:00:00 +0000 |
2203 | @@ -1,17 +0,0 @@ |
2204 | -option cc_generic_services = true; |
2205 | - |
2206 | -package unity.protobuf; |
2207 | - |
2208 | -message Clip { |
2209 | - required bytes content = 1; |
2210 | - optional string error = 127; |
2211 | -} |
2212 | - |
2213 | -message Void { |
2214 | - optional string error = 127; |
2215 | -} |
2216 | - |
2217 | -service UnityService { |
2218 | - rpc copy(Clip) returns (Void); |
2219 | - rpc paste(Void) returns (Clip); |
2220 | -} |
2221 | |
2222 | === added directory 'tests/mirserver/Clipboard' |
2223 | === added file 'tests/mirserver/Clipboard/Clipboard.pro' |
2224 | --- tests/mirserver/Clipboard/Clipboard.pro 1970-01-01 00:00:00 +0000 |
2225 | +++ tests/mirserver/Clipboard/Clipboard.pro 2014-09-23 11:37:20 +0000 |
2226 | @@ -0,0 +1,16 @@ |
2227 | +include(../../test-includes.pri) |
2228 | + |
2229 | +TARGET = ClipboardTest |
2230 | + |
2231 | +QT += gui-private |
2232 | + |
2233 | +INCLUDEPATH += \ |
2234 | + ../../../src/platforms/mirserver \ |
2235 | + ../../../src/common |
2236 | + |
2237 | +SOURCES += \ |
2238 | + clipboard_test.cpp \ |
2239 | + ../../../src/common/debughelpers.cpp |
2240 | + |
2241 | +LIBS += -Wl,-rpath,$${OUT_PWD}/../../../src/platforms/mirserver \ |
2242 | + -L../../../src/platforms/mirserver -lqpa-mirserver |
2243 | |
2244 | === added file 'tests/mirserver/Clipboard/clipboard_test.cpp' |
2245 | --- tests/mirserver/Clipboard/clipboard_test.cpp 1970-01-01 00:00:00 +0000 |
2246 | +++ tests/mirserver/Clipboard/clipboard_test.cpp 2014-09-23 11:37:20 +0000 |
2247 | @@ -0,0 +1,76 @@ |
2248 | +/* |
2249 | + * Copyright (C) 2014 Canonical, Ltd. |
2250 | + * |
2251 | + * This program is free software: you can redistribute it and/or modify it under |
2252 | + * the terms of the GNU Lesser General Public License version 3, as published by |
2253 | + * the Free Software Foundation. |
2254 | + * |
2255 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
2256 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2257 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2258 | + * Lesser General Public License for more details. |
2259 | + * |
2260 | + * You should have received a copy of the GNU Lesser General Public License |
2261 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2262 | + * |
2263 | + */ |
2264 | + |
2265 | +#include <gtest/gtest.h> |
2266 | + |
2267 | +#include <clipboard.h> |
2268 | + |
2269 | +#include <QLoggingCategory> |
2270 | +#include <QMimeData> |
2271 | + |
2272 | +using namespace qtmir; |
2273 | + |
2274 | +TEST(ClipboardTest, MimeDataSerialization) |
2275 | +{ |
2276 | + QMimeData *mimeData = new QMimeData; |
2277 | + mimeData->setData("text/plain", "Hello World!"); |
2278 | + mimeData->setData("text/html", "<html lang=\"en\"><body>Hello World!</body></html>"); |
2279 | + |
2280 | + QByteArray serializedMimeData = serializeMimeData(mimeData); |
2281 | + |
2282 | + ASSERT_TRUE(serializedMimeData.size() > 0); |
2283 | + |
2284 | + QMimeData *deserializedMimeData = deserializeMimeData(serializedMimeData); |
2285 | + |
2286 | + ASSERT_TRUE(deserializedMimeData != nullptr); |
2287 | + |
2288 | + ASSERT_TRUE(deserializedMimeData->hasFormat("text/plain")); |
2289 | + ASSERT_EQ(mimeData->data("text/plain"), deserializedMimeData->data("text/plain")); |
2290 | + |
2291 | + ASSERT_TRUE(deserializedMimeData->hasFormat("text/html")); |
2292 | + ASSERT_EQ(mimeData->data("text/html"), deserializedMimeData->data("text/html")); |
2293 | + |
2294 | + delete mimeData; |
2295 | + delete deserializedMimeData; |
2296 | +} |
2297 | + |
2298 | +TEST(ClipboardTest, RefuseContentsThatAreTooBig) |
2299 | +{ |
2300 | + QLoggingCategory::setFilterRules(QStringLiteral("*=false")); |
2301 | + DBusClipboard::skipDBusRegistration = true; |
2302 | + DBusClipboard *dbusClipboard = new DBusClipboard; |
2303 | + |
2304 | + // Was getting a "warning: overflow in implicit constant conversion [-Woverflow]" |
2305 | + // when I used that constant directly in the QByteArray constructors below. Don't |
2306 | + // understand why so here's the workaround for it. |
2307 | + int maxContentsSize = DBusClipboard::maxContentsSize; |
2308 | + |
2309 | + QByteArray reasonableContents(maxContentsSize * 0.9, 'R'); |
2310 | + QByteArray tooBigContents(maxContentsSize * 1.2, 'B'); |
2311 | + |
2312 | + dbusClipboard->SetContents(reasonableContents); |
2313 | + |
2314 | + ASSERT_EQ(dbusClipboard->contents(), reasonableContents); |
2315 | + |
2316 | + dbusClipboard->SetContents(tooBigContents); |
2317 | + |
2318 | + // tooBigContents were refused. So it stays with the previously |
2319 | + // set contents |
2320 | + ASSERT_EQ(dbusClipboard->contents(), reasonableContents); |
2321 | + |
2322 | + delete dbusClipboard; |
2323 | +} |
2324 | |
2325 | === modified file 'tests/mirserver/mirserver.pro' |
2326 | --- tests/mirserver/mirserver.pro 2014-08-27 11:51:28 +0000 |
2327 | +++ tests/mirserver/mirserver.pro 2014-09-23 11:37:20 +0000 |
2328 | @@ -1,2 +1,2 @@ |
2329 | TEMPLATE = subdirs |
2330 | -SUBDIRS = QtEventFeeder |
2331 | +SUBDIRS = QtEventFeeder Clipboard |
You could create an MR for apparmor- easyprof- ubuntu to add that apparmor exception