~ci-train-bot/qtmir/qtmir-ubuntu-yakkety-landing-061

« back to all changes in this revision

Viewing changes to src/modules/Unity/Application/sessionmanager.cpp

  • Committer: Bileto Bot
  • Author(s): Alan Griffiths
  • Date: 2016-08-10 06:51:37 UTC
  • mfrom: (484.4.8 qtmir)
  • Revision ID: ci-train-bot@canonical.com-20160810065137-mwsta1ar360jkrk7
Reduce MirServer to an implementation detail of QMirServer (nothing else needs to touch it).

Approved by: Daniel d'Andrada, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
// QPA mirserver
26
26
#include "nativeinterface.h"
27
 
#include "mirserver.h"
28
27
#include "sessionlistener.h"
29
28
#include "logging.h"
30
29
#include "promptsessionlistener.h"
32
31
// mir
33
32
#include <mir/scene/prompt_session.h>
34
33
#include <mir/scene/prompt_session_manager.h>
 
34
#include <mir/report_exception.h>
35
35
 
36
36
namespace ms = mir::scene;
37
37
 
61
61
}
62
62
 
63
63
SessionManager* SessionManager::singleton()
 
64
try
64
65
{
65
66
    if (!the_session_manager) {
66
67
 
75
76
        SessionListener *sessionListener = static_cast<SessionListener*>(nativeInterface->nativeResourceForIntegration("SessionListener"));
76
77
        PromptSessionListener *promptSessionListener = static_cast<PromptSessionListener*>(nativeInterface->nativeResourceForIntegration("PromptSessionListener"));
77
78
 
78
 
        the_session_manager = new SessionManager(nativeInterface->mirServer(), ApplicationManager::singleton());
 
79
        the_session_manager = new SessionManager(nativeInterface->thePromptSessionManager(), ApplicationManager::singleton());
79
80
 
80
81
        connectToSessionListener(the_session_manager, sessionListener);
81
82
        connectToPromptSessionListener(the_session_manager, promptSessionListener);
82
83
    }
83
84
    return the_session_manager;
84
85
}
 
86
catch (...)
 
87
{
 
88
    // We only call mir::report_exception() here to force linkage against libmirserver.
 
89
    // Unless we force this module to have a link dependency on libmirserver we get
 
90
    // several tests hanging during link loading. I wish I understood why.    alan_g
 
91
    mir::report_exception();
 
92
    throw;
 
93
}
85
94
 
86
95
SessionManager::SessionManager(
87
 
        const QSharedPointer<MirServer>& mirServer,
 
96
        const std::shared_ptr<mir::scene::PromptSessionManager>& promptSessionManager,
88
97
        ApplicationManager* applicationManager,
89
98
        QObject *parent)
90
99
    : SessionModel(parent)
91
 
    , m_mirServer(mirServer)
 
100
    , m_promptSessionManager(promptSessionManager)
92
101
    , m_applicationManager(applicationManager)
93
102
{
94
103
    qCDebug(QTMIR_SESSIONS) << "SessionManager::SessionManager - this=" << this;
115
124
{
116
125
    qCDebug(QTMIR_SESSIONS) << "SessionManager::onSessionStarting - sessionName=" <<  session->name().c_str();
117
126
 
118
 
    Session* qmlSession = new Session(session,
119
 
                                       m_mirServer->the_prompt_session_manager());
 
127
    Session* qmlSession = new Session(session, m_promptSessionManager);
120
128
    insert(0, qmlSession);
121
129
 
122
130
    Application* application = m_applicationManager->findApplicationWithSession(session);
149
157
{
150
158
    qCDebug(QTMIR_SESSIONS) << "SessionManager::onPromptSessionStarting - promptSession=" << promptSession.get();
151
159
 
152
 
    std::shared_ptr<mir::scene::Session> appSession = m_mirServer->the_prompt_session_manager()->application_for(promptSession);
 
160
    std::shared_ptr<mir::scene::Session> appSession = m_promptSessionManager->application_for(promptSession);
153
161
    SessionInterface *qmlAppSession = findSession(appSession.get());
154
162
    if (qmlAppSession) {
155
163
        m_mirPromptToSessionHash[promptSession.get()] = qmlAppSession;