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