Merge lp:~gerboland/unity-mir/listen-for-server-start-stop-ready into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: MichaƂ Sawicz
Approved revision: 133
Merged at revision: 152
Proposed branch: lp:~gerboland/unity-mir/listen-for-server-start-stop-ready
Merge into: lp:unity-mir
Diff against target: 165 lines (+100/-2)
6 files modified
debian/changelog (+9/-0)
src/unity-mir/serverstatuslistener.cpp (+45/-0)
src/unity-mir/serverstatuslistener.h (+30/-0)
src/unity-mir/shellserverconfiguration.cpp (+11/-0)
src/unity-mir/shellserverconfiguration.h (+1/-0)
src/unity-mir/unity-mir.pro (+4/-2)
To merge this branch: bzr merge lp:~gerboland/unity-mir/listen-for-server-start-stop-ready
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michael Zanetti (community) Approve
Alan Griffiths Approve
Review via email: mp+196269@code.launchpad.net

Commit message

Install ServerStatusListener to be notified of mir server start, pause and resume.

Use start notification to send SIGSTOP signal to upstart, so it knows mir is ready for other clients

Description of the change

Install ServerStatusListener to be notified of mir server start, pause and resume.

Use start notification to send SIGSTOP signal to upstart, so it knows mir is ready for other clients

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

SIGSTOP seems like a weird choice. But if that's the requirement the code is OK

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-11-19 19:11:22 +0000
3+++ debian/changelog 2013-11-22 12:17:57 +0000
4@@ -1,3 +1,12 @@
5+unity-mir (0.2) UNRELEASED; urgency=low
6+
7+ * Install ServerStatusListener to be notified of mir server start, pause
8+ and resume. Use start notification to send SIGSTOP signal to upstart,
9+ so it knows mir is ready for other clients.
10+ * Bump version number
11+
12+ -- Gerry Boland <gerry.boland@canonical.com> Mon, 18 Nov 2013 11:49:48 +0000
13+
14 unity-mir (0.1+14.04.20131119-0ubuntu1) trusty; urgency=low
15
16 [ Gerry Boland ]
17
18=== added file 'src/unity-mir/serverstatuslistener.cpp'
19--- src/unity-mir/serverstatuslistener.cpp 1970-01-01 00:00:00 +0000
20+++ src/unity-mir/serverstatuslistener.cpp 2013-11-22 12:17:57 +0000
21@@ -0,0 +1,45 @@
22+/*
23+ * Copyright (C) 2013 Canonical, Ltd.
24+ *
25+ * This program is free software: you can redistribute it and/or modify it under
26+ * the terms of the GNU Lesser General Public License version 3, as published by
27+ * the Free Software Foundation.
28+ *
29+ * This program is distributed in the hope that it will be useful, but WITHOUT
30+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
31+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32+ * Lesser General Public License for more details.
33+ *
34+ * You should have received a copy of the GNU Lesser General Public License
35+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
36+ */
37+
38+// local
39+#include "serverstatuslistener.h"
40+
41+// Qt
42+#include <QtGlobal>
43+#include <QByteArray>
44+
45+// std
46+#include <csignal>
47+
48+void ServerStatusListener::paused()
49+{
50+}
51+
52+void ServerStatusListener::resumed()
53+{
54+}
55+
56+void ServerStatusListener::started()
57+{
58+ // Emit signal to notify Upstart that Mir is ready to receive client connections
59+ // see http://upstart.ubuntu.com/cookbook/#expect-stop
60+ // FIXME: should not be unity-mir's job, instead should notify the user of this library
61+ // that they should emit this signal, perhaps by posting an event to the
62+ // QMirServerApplication event loop when it comes up
63+ if (qgetenv("UPSTART_JOB") == "unity8") {
64+ raise(SIGSTOP);
65+ }
66+}
67
68=== added file 'src/unity-mir/serverstatuslistener.h'
69--- src/unity-mir/serverstatuslistener.h 1970-01-01 00:00:00 +0000
70+++ src/unity-mir/serverstatuslistener.h 2013-11-22 12:17:57 +0000
71@@ -0,0 +1,30 @@
72+/*
73+ * Copyright (C) 2013 Canonical, Ltd.
74+ *
75+ * This program is free software: you can redistribute it and/or modify it under
76+ * the terms of the GNU Lesser General Public License version 3, as published by
77+ * the Free Software Foundation.
78+ *
79+ * This program is distributed in the hope that it will be useful, but WITHOUT
80+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
81+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
82+ * Lesser General Public License for more details.
83+ *
84+ * You should have received a copy of the GNU Lesser General Public License
85+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
86+ */
87+
88+#ifndef SERVERSTATUSLISTENER_H
89+#define SERVERSTATUSLISTENER_H
90+
91+#include <mir/server_status_listener.h>
92+
93+class ServerStatusListener : public virtual mir::ServerStatusListener
94+{
95+public:
96+ void paused() override;
97+ void resumed() override;
98+ void started() override;
99+};
100+
101+#endif // SERVERSTATUSLISTENER_H
102
103=== modified file 'src/unity-mir/shellserverconfiguration.cpp'
104--- src/unity-mir/shellserverconfiguration.cpp 2013-11-08 17:54:50 +0000
105+++ src/unity-mir/shellserverconfiguration.cpp 2013-11-22 12:17:57 +0000
106@@ -17,6 +17,7 @@
107 #include "shellserverconfiguration.h"
108
109 #include "initialsurfaceplacementstrategy.h"
110+#include "serverstatuslistener.h"
111 #include "sessionlistener.h"
112 #include "surfaceconfigurator.h"
113 #include "surfacefactory.h"
114@@ -101,6 +102,16 @@
115 });
116 }
117
118+std::shared_ptr<mir::ServerStatusListener>
119+ShellServerConfiguration::the_server_status_listener()
120+{
121+ return server_status_listener(
122+ []()
123+ {
124+ return std::make_shared<ServerStatusListener>();
125+ });
126+}
127+
128 /************************************ Shell side ************************************/
129
130 //
131
132=== modified file 'src/unity-mir/shellserverconfiguration.h'
133--- src/unity-mir/shellserverconfiguration.h 2013-11-08 17:54:50 +0000
134+++ src/unity-mir/shellserverconfiguration.h 2013-11-22 12:17:57 +0000
135@@ -46,6 +46,7 @@
136 std::shared_ptr<mir::shell::SurfaceConfigurator> the_shell_surface_configurator() override;
137 std::shared_ptr<mir::shell::SurfaceFactory> the_shell_surface_factory() override;
138 std::shared_ptr<mir::shell::FocusSetter> the_shell_focus_setter() override;
139+ std::shared_ptr<mir::ServerStatusListener> the_server_status_listener() override;
140 std::shared_ptr<mir::frontend::SessionAuthorizer> the_session_authorizer() override;
141
142 /* qt specific */
143
144=== modified file 'src/unity-mir/unity-mir.pro'
145--- src/unity-mir/unity-mir.pro 2013-11-08 17:54:50 +0000
146+++ src/unity-mir/unity-mir.pro 2013-11-22 12:17:57 +0000
147@@ -23,7 +23,8 @@
148 shellserverconfiguration.cpp \
149 surfacefactory.cpp \
150 surfaceconfigurator.cpp \
151- focussetter.cpp
152+ focussetter.cpp \
153+ serverstatuslistener.cpp
154
155 HEADERS += \
156 dbusscreen.h \
157@@ -36,7 +37,8 @@
158 surfacefactory.h \
159 surfaceconfigurator.h \
160 logging.h \
161- focussetter.h
162+ focussetter.h \
163+ serverstatuslistener.h
164
165 target.path = $$[QT_INSTALL_LIBS]
166

Subscribers

People subscribed via source and target branches