Merge lp:~alan-griffiths/qtmir/MirServer-is-an-implementation-detail into lp:qtmir

Proposed by Alan Griffiths on 2016-05-06
Status: Merged
Approved by: Daniel d'Andrada on 2016-07-20
Approved revision: 492
Merged at revision: 540
Proposed branch: lp:~alan-griffiths/qtmir/MirServer-is-an-implementation-detail
Merge into: lp:qtmir
Prerequisite: lp:~alan-griffiths/qtmir/MirServer-is-not-a-context-object
Diff against target: 523 lines (+99/-111)
11 files modified
src/modules/Unity/Application/sessionmanager.cpp (+15/-7)
src/modules/Unity/Application/sessionmanager.h (+2/-4)
src/platforms/mirserver/mirserverintegration.cpp (+1/-4)
src/platforms/mirserver/nativeinterface.cpp (+3/-22)
src/platforms/mirserver/nativeinterface.h (+6/-2)
src/platforms/mirserver/qmirserver.cpp (+37/-6)
src/platforms/mirserver/qmirserver.h (+10/-3)
tests/framework/qtmir_test.cpp (+1/-37)
tests/framework/qtmir_test.h (+0/-2)
tests/modules/Application/application_test.cpp (+1/-1)
tests/modules/SessionManager/session_test.cpp (+23/-23)
To merge this branch: bzr merge lp:~alan-griffiths/qtmir/MirServer-is-an-implementation-detail
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) 2016-05-06 Approve on 2016-07-20
Unity8 CI Bot continuous-integration Approve on 2016-06-01
Michał Sawicz Needs Fixing on 2016-05-25
Review via email: mp+293992@code.launchpad.net

Commit Message

Reduce MirServer to an implementation detail of QMirServer (nothing else needs to touch it).

Description of the Change

Reduce MirServer to an implementation detail of QMirServer (nothing else needs to touch it).

To post a comment you must log in.
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:488
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/207/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1532
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1492
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1492
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1492
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1492/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1492
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1492/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1492
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1492/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1492
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1492/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1492
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1492/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1492
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1492/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/207/rebuild

review: Approve (continuous-integration)
Daniel d'Andrada (dandrader) wrote :

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

* Did CI run pass? If not, please explain why.
Yes

review: Approve
Michał Sawicz (saviq) wrote :

This is causing tests to hang indefinitely on vivid.

review: Needs Fixing
489. By Alan Griffiths on 2016-05-25

merge lp:qtmir

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:489
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/238/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1727/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1753
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1697
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1697
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1697
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1690/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1690/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1690/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1690/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1690/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1690/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/238/rebuild

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

> This is causing tests to hang indefinitely on vivid.

That's interesting. I wonder what changed in the time between doing this work and trying to integrate it.

Alan Griffiths (alan-griffiths) wrote :

More and more interesting!

The same hang is happening in sharedwakelock_test, sessionmanager_test and application_test before reaching main() in tls_get_addr_tail(). Presumably some implicitly linked .so is failing to initialize horribly and that original failure is "eaten" by the link loader.

It is hard to see how the changes proposed here affect anything so early in process start-up (especially for sharedwakelock_test) but empirically, that is what happens.

490. By Alan Griffiths on 2016-05-31

Stop the tests hanging

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:490
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/241/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1752/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1778
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1725
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1725
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1725
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1718/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1718
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1718/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1718
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1718/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1718/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1718
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1718/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1718
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1718/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1718/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1718
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1718/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1718
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1718/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/241/rebuild

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

/sigh.

That's the trouble with fixes that seem crazy. They only work on my kit.

491. By Alan Griffiths on 2016-06-01

Use frig_to_force_libmirserver_linkage to discourage optimizer from dropping it

492. By Alan Griffiths on 2016-06-01

Another approach to forcing a linker dependency

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:491
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/242/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1756/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1782
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1729
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1729
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1729
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1722/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1722
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1722/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1722
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1722/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1722/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1722
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1722/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1722
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1722/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1722/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1722
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1722/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1722
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1722/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/242/rebuild

review: Needs Fixing (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:492
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/243/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1757
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1783
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1730
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1730
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1730
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1723/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1723
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1723/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/243/rebuild

review: Approve (continuous-integration)
Daniel d'Andrada (dandrader) wrote :

Still ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/sessionmanager.cpp'
2--- src/modules/Unity/Application/sessionmanager.cpp 2016-05-06 08:41:15 +0000
3+++ src/modules/Unity/Application/sessionmanager.cpp 2016-06-01 09:31:31 +0000
4@@ -24,7 +24,6 @@
5
6 // QPA mirserver
7 #include "nativeinterface.h"
8-#include "mirserver.h"
9 #include "sessionlistener.h"
10 #include "logging.h"
11 #include "promptsessionlistener.h"
12@@ -32,6 +31,7 @@
13 // mir
14 #include <mir/scene/prompt_session.h>
15 #include <mir/scene/prompt_session_manager.h>
16+#include <mir/report_exception.h>
17
18 namespace ms = mir::scene;
19
20@@ -61,6 +61,7 @@
21 }
22
23 SessionManager* SessionManager::singleton()
24+try
25 {
26 if (!the_session_manager) {
27
28@@ -75,20 +76,28 @@
29 SessionListener *sessionListener = static_cast<SessionListener*>(nativeInterface->nativeResourceForIntegration("SessionListener"));
30 PromptSessionListener *promptSessionListener = static_cast<PromptSessionListener*>(nativeInterface->nativeResourceForIntegration("PromptSessionListener"));
31
32- the_session_manager = new SessionManager(nativeInterface->mirServer(), ApplicationManager::singleton());
33+ the_session_manager = new SessionManager(nativeInterface->thePromptSessionManager(), ApplicationManager::singleton());
34
35 connectToSessionListener(the_session_manager, sessionListener);
36 connectToPromptSessionListener(the_session_manager, promptSessionListener);
37 }
38 return the_session_manager;
39 }
40+catch (...)
41+{
42+ // We only call mir::report_exception() here to force linkage against libmirserver.
43+ // Unless we force this module to have a link dependency on libmirserver we get
44+ // several tests hanging during link loading. I wish I understood why. alan_g
45+ mir::report_exception();
46+ throw;
47+}
48
49 SessionManager::SessionManager(
50- const QSharedPointer<MirServer>& mirServer,
51+ const std::shared_ptr<mir::scene::PromptSessionManager>& promptSessionManager,
52 ApplicationManager* applicationManager,
53 QObject *parent)
54 : SessionModel(parent)
55- , m_mirServer(mirServer)
56+ , m_promptSessionManager(promptSessionManager)
57 , m_applicationManager(applicationManager)
58 {
59 qCDebug(QTMIR_SESSIONS) << "SessionManager::SessionManager - this=" << this;
60@@ -115,8 +124,7 @@
61 {
62 qCDebug(QTMIR_SESSIONS) << "SessionManager::onSessionStarting - sessionName=" << session->name().c_str();
63
64- Session* qmlSession = new Session(session,
65- m_mirServer->the_prompt_session_manager());
66+ Session* qmlSession = new Session(session, m_promptSessionManager);
67 insert(0, qmlSession);
68
69 Application* application = m_applicationManager->findApplicationWithSession(session);
70@@ -149,7 +157,7 @@
71 {
72 qCDebug(QTMIR_SESSIONS) << "SessionManager::onPromptSessionStarting - promptSession=" << promptSession.get();
73
74- std::shared_ptr<mir::scene::Session> appSession = m_mirServer->the_prompt_session_manager()->application_for(promptSession);
75+ std::shared_ptr<mir::scene::Session> appSession = m_promptSessionManager->application_for(promptSession);
76 SessionInterface *qmlAppSession = findSession(appSession.get());
77 if (qmlAppSession) {
78 m_mirPromptToSessionHash[promptSession.get()] = qmlAppSession;
79
80=== modified file 'src/modules/Unity/Application/sessionmanager.h'
81--- src/modules/Unity/Application/sessionmanager.h 2015-08-11 12:08:32 +0000
82+++ src/modules/Unity/Application/sessionmanager.h 2016-06-01 09:31:31 +0000
83@@ -38,8 +38,6 @@
84 }
85 }
86
87-class MirServer;
88-
89 namespace qtmir {
90
91 class Application;
92@@ -51,7 +49,7 @@
93
94 public:
95 explicit SessionManager(
96- const QSharedPointer<MirServer>& mirServer,
97+ const std::shared_ptr<mir::scene::PromptSessionManager>& promptSessionManager,
98 ApplicationManager* applicationManager,
99 QObject *parent = 0
100 );
101@@ -77,7 +75,7 @@
102 protected:
103
104 private:
105- QSharedPointer<MirServer> m_mirServer;
106+ const std::shared_ptr<mir::scene::PromptSessionManager> m_promptSessionManager;
107 ApplicationManager* m_applicationManager;
108 static SessionManager *the_session_manager;
109
110
111=== modified file 'src/platforms/mirserver/mirserverintegration.cpp'
112--- src/platforms/mirserver/mirserverintegration.cpp 2016-05-05 14:34:21 +0000
113+++ src/platforms/mirserver/mirserverintegration.cpp 2016-06-01 09:31:31 +0000
114@@ -15,7 +15,6 @@
115 */
116
117 #include "mirserverintegration.h"
118-#include "mirserver.h"
119
120 #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
121 #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
122@@ -29,7 +28,6 @@
123
124 #include <QGuiApplication>
125 #include <QStringList>
126-#include <QOpenGLContext>
127 #include <QDebug>
128
129 // Mir
130@@ -128,8 +126,7 @@
131
132 QPlatformOpenGLContext *MirServerIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
133 {
134- auto server = m_mirServer->mirServer().lock();
135- return new MirOpenGLContext(*server->the_display(), *server->the_gl_config(), context->format());
136+ return m_mirServer->createPlatformOpenGLContext(context);
137 }
138
139 QAbstractEventDispatcher *MirServerIntegration::createEventDispatcher() const
140
141=== modified file 'src/platforms/mirserver/nativeinterface.cpp'
142--- src/platforms/mirserver/nativeinterface.cpp 2016-05-05 14:17:14 +0000
143+++ src/platforms/mirserver/nativeinterface.cpp 2016-06-01 09:31:31 +0000
144@@ -15,7 +15,6 @@
145 */
146
147 #include "nativeinterface.h"
148-#include "mirserver.h"
149
150 #include "qmirserver.h"
151 #include "screen.h"
152@@ -27,25 +26,7 @@
153
154 void *NativeInterface::nativeResourceForIntegration(const QByteArray &resource)
155 {
156- void *result = nullptr;
157-
158- auto const server = m_qMirServer->mirServer().lock();
159-
160- if (server) {
161- if (resource == "SessionAuthorizer")
162- result = server->sessionAuthorizer();
163- else if (resource == "Shell")
164- result = server->shell();
165- else if (resource == "SessionListener")
166- result = server->sessionListener();
167- else if (resource == "PromptSessionListener")
168- result = server->promptSessionListener();
169- else if (resource == "WindowManager")
170- result = server->windowManager();
171- else if (resource == "ScreensController")
172- result = m_qMirServer->screensController().data();
173- }
174- return result;
175+ return m_qMirServer->nativeResourceForIntegration(resource);
176 }
177
178 // Changes to these properties are emitted via the UbuntuNativeInterface::windowPropertyChanged
179@@ -92,7 +73,7 @@
180 }
181 }
182
183-QWeakPointer<MirServer> NativeInterface::mirServer()
184+std::shared_ptr<mir::scene::PromptSessionManager> NativeInterface::thePromptSessionManager() const
185 {
186- return m_qMirServer->mirServer();
187+ return m_qMirServer->thePromptSessionManager();
188 }
189
190=== modified file 'src/platforms/mirserver/nativeinterface.h'
191--- src/platforms/mirserver/nativeinterface.h 2016-05-05 14:17:14 +0000
192+++ src/platforms/mirserver/nativeinterface.h 2016-06-01 09:31:31 +0000
193@@ -21,10 +21,14 @@
194 #include <QSharedPointer>
195 #include <qpa/qplatformnativeinterface.h>
196
197+#include <memory>
198+
199 // local
200-class MirServer;
201 class QMirServer;
202
203+// mir
204+namespace mir { namespace scene { class PromptSessionManager; }}
205+
206 class NativeInterface : public QPlatformNativeInterface
207 {
208 public:
209@@ -36,7 +40,7 @@
210 QVariant windowProperty(QPlatformWindow *window, const QString &name) const override;
211 QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const override;
212
213- QWeakPointer<MirServer> mirServer();
214+ std::shared_ptr<mir::scene::PromptSessionManager> thePromptSessionManager() const;
215
216 private:
217 QMirServer *m_qMirServer;
218
219=== modified file 'src/platforms/mirserver/qmirserver.cpp'
220--- src/platforms/mirserver/qmirserver.cpp 2016-04-29 15:41:00 +0000
221+++ src/platforms/mirserver/qmirserver.cpp 2016-06-01 09:31:31 +0000
222@@ -18,12 +18,14 @@
223 #include <QObject>
224 #include <QCoreApplication>
225 #include <QDebug>
226+#include <QOpenGLContext>
227
228 // local
229 #include "mirserver.h"
230 #include "qmirserver.h"
231 #include "qmirserver_p.h"
232 #include "screen.h"
233+#include "miropenglcontext.h"
234
235 QMirServer::QMirServer(int &argc, char **argv, QObject *parent)
236 : QObject(parent)
237@@ -85,12 +87,6 @@
238 return d->serverThread->isRunning();
239 }
240
241-QWeakPointer<MirServer> QMirServer::mirServer() const
242-{
243- Q_D(const QMirServer);
244- return d->server.toWeakRef();
245-}
246-
247 QWeakPointer<ScreensModel> QMirServer::screensModel() const
248 {
249 Q_D(const QMirServer);
250@@ -102,3 +98,38 @@
251 Q_D(const QMirServer);
252 return d->screensController;
253 }
254+
255+QPlatformOpenGLContext *QMirServer::createPlatformOpenGLContext(QOpenGLContext *context) const
256+{
257+ Q_D(const QMirServer);
258+ return new MirOpenGLContext(*d->server->the_display(), *d->server->the_gl_config(), context->format());
259+}
260+
261+void *QMirServer::nativeResourceForIntegration(const QByteArray &resource) const
262+{
263+ Q_D(const QMirServer);
264+ void *result = nullptr;
265+
266+ if (d->server) {
267+ if (resource == "SessionAuthorizer")
268+ result = d->server->sessionAuthorizer();
269+ else if (resource == "Shell")
270+ result = d->server->shell();
271+ else if (resource == "SessionListener")
272+ result = d->server->sessionListener();
273+ else if (resource == "PromptSessionListener")
274+ result = d->server->promptSessionListener();
275+ else if (resource == "WindowManager")
276+ result = d->server->windowManager();
277+ else if (resource == "ScreensController")
278+ result = screensController().data();
279+ }
280+ return result;
281+}
282+
283+std::shared_ptr<mir::scene::PromptSessionManager> QMirServer::thePromptSessionManager() const
284+{
285+ Q_D(const QMirServer);
286+
287+ return d->server->the_prompt_session_manager();
288+}
289
290=== modified file 'src/platforms/mirserver/qmirserver.h'
291--- src/platforms/mirserver/qmirserver.h 2016-04-29 15:41:00 +0000
292+++ src/platforms/mirserver/qmirserver.h 2016-06-01 09:31:31 +0000
293@@ -21,10 +21,16 @@
294 #include <QObject>
295 #include <QWeakPointer>
296
297+#include <memory>
298+
299+// mir
300+namespace mir { namespace scene { class PromptSessionManager; }}
301+
302 class QMirServerPrivate;
303-class MirServer;
304 class ScreensController;
305 class ScreensModel;
306+class QPlatformOpenGLContext;
307+class QOpenGLContext;
308
309 class QMirServer: public QObject
310 {
311@@ -38,10 +44,11 @@
312 Q_SLOT void stop();
313 bool isRunning() const;
314
315- QWeakPointer<MirServer> mirServer() const;
316-
317 QWeakPointer<ScreensController> screensController() const;
318 QWeakPointer<ScreensModel> screensModel() const;
319+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
320+ void *nativeResourceForIntegration(const QByteArray &resource) const;
321+ std::shared_ptr<mir::scene::PromptSessionManager> thePromptSessionManager() const;
322
323 Q_SIGNALS:
324 void started();
325
326=== modified file 'tests/framework/qtmir_test.cpp'
327--- tests/framework/qtmir_test.cpp 2016-05-06 08:23:46 +0000
328+++ tests/framework/qtmir_test.cpp 2016-06-01 09:31:31 +0000
329@@ -77,41 +77,6 @@
330 break;
331 }
332 }
333-
334-// Initialization of mir::Server needed for by tests
335-class TestMirServerInit : public virtual mir::Server
336-{
337-public:
338- TestMirServerInit(std::shared_ptr<StubPromptSessionManager> const& promptSessionManager)
339- : mock_prompt_session_manager(promptSessionManager)
340- {
341- override_the_prompt_session_manager(
342- [this]{ return the_mock_prompt_session_manager(); });
343- }
344-
345- std::shared_ptr<mir::scene::MockPromptSessionManager> the_mock_prompt_session_manager()
346- {
347- return mock_prompt_session_manager;
348- }
349-
350-private:
351- std::shared_ptr<StubPromptSessionManager> const mock_prompt_session_manager;
352-};
353-
354-
355-namespace { int argc = 0; char* argv[] = { nullptr }; }
356-
357-class FakeMirServer: private TestMirServerInit, public MirServer
358-{
359-public:
360- FakeMirServer(std::shared_ptr<StubPromptSessionManager> const& promptSessionManager)
361- : TestMirServerInit(promptSessionManager), MirServer(argc, argv, QSharedPointer<ScreensModel>())
362- {
363- }
364-
365- using TestMirServerInit::the_mock_prompt_session_manager;
366-};
367-
368 } // namespace qtmir
369
370 namespace testing
371@@ -119,12 +84,11 @@
372
373 QtMirTest::QtMirTest()
374 : promptSessionManager(std::make_shared<StubPromptSessionManager>())
375- , mirServer(QSharedPointer<MirServer>(new FakeMirServer(promptSessionManager)))
376 , applicationManager(taskControllerSharedPointer,
377 QSharedPointer<MockSharedWakelock>(&sharedWakelock, [](MockSharedWakelock *){}),
378 QSharedPointer<ProcInfo>(&procInfo,[](ProcInfo *){}),
379 QSharedPointer<MockSettings>(&settings,[](MockSettings *){}))
380- , sessionManager(mirServer, &applicationManager)
381+ , sessionManager(promptSessionManager, &applicationManager)
382 , surfaceManager(mirShell, &sessionManager)
383 {
384 }
385
386=== modified file 'tests/framework/qtmir_test.h'
387--- tests/framework/qtmir_test.h 2016-05-06 08:28:44 +0000
388+++ tests/framework/qtmir_test.h 2016-06-01 09:31:31 +0000
389@@ -30,7 +30,6 @@
390 #include <Unity/Application/session_interface.h>
391 #include <Unity/Application/sharedwakelock.h>
392 #include <Unity/Application/proc_info.h>
393-#include <mirserver.h>
394
395 #include "mock_proc_info.h"
396 #include "mock_mir_session.h"
397@@ -69,7 +68,6 @@
398 testing::NiceMock<MockSharedWakelock> sharedWakelock;
399 testing::NiceMock<MockSettings> settings;
400 std::shared_ptr<StubPromptSessionManager> promptSessionManager;
401- QSharedPointer<MirServer> mirServer;
402
403 mir::shell::Shell *mirShell{nullptr};
404 ApplicationManager applicationManager;
405
406=== modified file 'tests/modules/Application/application_test.cpp'
407--- tests/modules/Application/application_test.cpp 2016-05-02 12:57:40 +0000
408+++ tests/modules/Application/application_test.cpp 2016-06-01 09:31:31 +0000
409@@ -82,7 +82,7 @@
410 const pid_t procId = 1234;
411
412 auto mirSession = std::make_shared<NiceMock<mir::scene::MockSession>>(appId.toStdString(), procId);
413- Session* session = new Session(mirSession, mirServer->the_prompt_session_manager());
414+ Session* session = new Session(mirSession, promptSessionManager);
415
416 FakeTimer *fakeTimer(new FakeTimer(fakeTimeSource));
417 session->setSuspendTimer(fakeTimer);
418
419=== modified file 'tests/modules/SessionManager/session_test.cpp'
420--- tests/modules/SessionManager/session_test.cpp 2016-05-17 19:18:44 +0000
421+++ tests/modules/SessionManager/session_test.cpp 2016-06-01 09:31:31 +0000
422@@ -52,7 +52,7 @@
423
424 auto mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
425
426- auto session = std::make_shared<qtmir::Session>(mirSession, mirServer->the_prompt_session_manager());
427+ auto session = std::make_shared<qtmir::Session>(mirSession, promptSessionManager);
428
429 // On Starting as it has no surface.
430 EXPECT_EQ(Session::Starting, session->state());
431@@ -76,10 +76,10 @@
432
433 std::shared_ptr<ms::Session> mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
434
435- Session session(mirSession, mirServer->the_prompt_session_manager());
436- Session session1(mirSession, mirServer->the_prompt_session_manager());
437- Session session2(mirSession, mirServer->the_prompt_session_manager());
438- Session session3(mirSession, mirServer->the_prompt_session_manager());
439+ Session session(mirSession, promptSessionManager);
440+ Session session1(mirSession, promptSessionManager);
441+ Session session2(mirSession, promptSessionManager);
442+ Session session3(mirSession, promptSessionManager);
443
444 // add surfaces
445 session.addChildSession(&session1);
446@@ -101,10 +101,10 @@
447
448 std::shared_ptr<ms::Session> mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
449
450- Session session(mirSession, mirServer->the_prompt_session_manager());
451- Session session1(mirSession, mirServer->the_prompt_session_manager());
452- Session session2(mirSession, mirServer->the_prompt_session_manager());
453- Session session3(mirSession, mirServer->the_prompt_session_manager());
454+ Session session(mirSession, promptSessionManager);
455+ Session session1(mirSession, promptSessionManager);
456+ Session session2(mirSession, promptSessionManager);
457+ Session session3(mirSession, promptSessionManager);
458
459 // add surfaces
460 session.insertChildSession(100, &session1); // test overflow
461@@ -126,10 +126,10 @@
462
463 std::shared_ptr<ms::Session> mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
464
465- Session session(mirSession, mirServer->the_prompt_session_manager());
466- Session session1(mirSession, mirServer->the_prompt_session_manager());
467- Session session2(mirSession, mirServer->the_prompt_session_manager());
468- Session session3(mirSession, mirServer->the_prompt_session_manager());
469+ Session session(mirSession, promptSessionManager);
470+ Session session1(mirSession, promptSessionManager);
471+ Session session2(mirSession, promptSessionManager);
472+ Session session3(mirSession, promptSessionManager);
473
474 // add surfaces
475 session.addChildSession(&session1);
476@@ -156,10 +156,10 @@
477
478 std::shared_ptr<ms::Session> mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
479
480- Session session(mirSession, mirServer->the_prompt_session_manager());
481- Session* session1 = new Session(mirSession, mirServer->the_prompt_session_manager());
482- Session* session2 = new Session(mirSession, mirServer->the_prompt_session_manager());
483- Session* session3 = new Session(mirSession, mirServer->the_prompt_session_manager());
484+ Session session(mirSession, promptSessionManager);
485+ Session* session1 = new Session(mirSession, promptSessionManager);
486+ Session* session2 = new Session(mirSession, promptSessionManager);
487+ Session* session3 = new Session(mirSession, promptSessionManager);
488
489 // add surfaces
490 session.addChildSession(session1);
491@@ -188,10 +188,10 @@
492
493 std::shared_ptr<ms::Session> mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
494
495- Session* session = new Session(mirSession, mirServer->the_prompt_session_manager());
496- Session* session1 = new Session(mirSession, mirServer->the_prompt_session_manager());
497- Session* session2 = new Session(mirSession, mirServer->the_prompt_session_manager());
498- Session* session3 = new Session(mirSession, mirServer->the_prompt_session_manager());
499+ Session* session = new Session(mirSession, promptSessionManager);
500+ Session* session1 = new Session(mirSession, promptSessionManager);
501+ Session* session2 = new Session(mirSession, promptSessionManager);
502+ Session* session3 = new Session(mirSession, promptSessionManager);
503
504 // add children
505 session->addChildSession(session1);
506@@ -218,7 +218,7 @@
507
508 auto mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
509
510- auto session = std::make_shared<qtmir::Session>(mirSession, mirServer->the_prompt_session_manager());
511+ auto session = std::make_shared<qtmir::Session>(mirSession, promptSessionManager);
512 {
513 FakeMirSurface *surface = new FakeMirSurface;
514 session->registerSurface(surface);
515@@ -294,7 +294,7 @@
516
517 auto mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
518
519- auto session = std::make_shared<SessionTestClass>(mirSession, mirServer->the_prompt_session_manager());
520+ auto session = std::make_shared<SessionTestClass>(mirSession, promptSessionManager);
521 {
522 FakeMirSurface *surface = new FakeMirSurface;
523 session->registerSurface(surface);

Subscribers

People subscribed via source and target branches