Merge lp:~mterry/unity-system-compositor/kill-spinner into lp:unity-system-compositor

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 141
Merged at revision: 141
Proposed branch: lp:~mterry/unity-system-compositor/kill-spinner
Merge into: lp:unity-system-compositor
Diff against target: 97 lines (+20/-4)
2 files modified
src/system_compositor.cpp (+18/-3)
src/system_compositor.h (+2/-1)
To merge this branch: bzr merge lp:~mterry/unity-system-compositor/kill-spinner
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Alberto Aguirre (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+223837@code.launchpad.net

Commit message

Kill the boot animation spinner when not needed, saving resources

Description of the change

Kill the boot animation spinner when not needed, saving resources.

I also re-start the spinner if we need it for interstitials (which doesn't happen on phone right now, but will on desktop and maybe future phone versions). I originally kept it running for speed-of-switching-to-interstitials, but resources are more important than the brief moment we'd wait for the spinner to start up again.

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
Michael Terry (mterry) wrote :

FYI, KGunn confirmed that this works correctly in the linked bug.

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM

review: Approve
Revision history for this message
Mirco Müller (macslow) wrote :

+1

Revision history for this message
Mirco Müller (macslow) wrote :

+1 now with the correct review-status *sigh*

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/system_compositor.cpp'
2--- src/system_compositor.cpp 2014-06-18 14:48:35 +0000
3+++ src/system_compositor.cpp 2014-06-19 22:05:52 +0000
4@@ -222,6 +222,7 @@
5 auto spinner = sessions[spinner_name];
6 auto next = sessions[next_name];
7 auto active = sessions[active_name];
8+ bool need_spinner = false;
9
10 if (spinner)
11 spinner->hide();
12@@ -238,9 +239,11 @@
13 std::cerr << "Setting next focus to spinner";
14 spinner->raise(surface_coordinator);
15 next_session = spinner;
16+ need_spinner = true;
17 }
18 else
19 {
20+ need_spinner = !next_name.empty();
21 std::cerr << "Setting no next focus";
22 next_session.reset();
23 }
24@@ -266,9 +269,11 @@
25 focus_controller->set_focus_to(spinner); // raises and focuses
26 active_session = spinner;
27 next_session.reset();
28+ need_spinner = true;
29 }
30 else
31 {
32+ need_spinner = need_spinner || !active_name.empty();
33 std::cerr << "; no active focus";
34 active_session.reset();
35 next_session.reset();
36@@ -279,6 +284,11 @@
37 if (next_session)
38 next_session->show();
39
40+ if (need_spinner)
41+ compositor->ensure_spinner();
42+ else
43+ compositor->kill_spinner();
44+
45 std::cerr << std::endl;
46 }
47
48@@ -764,9 +774,9 @@
49 io_service.run();
50 }
51
52-void SystemCompositor::launch_spinner()
53+void SystemCompositor::ensure_spinner()
54 {
55- if (config->spinner().empty())
56+ if (config->spinner().empty() || spinner_process.state() != QProcess::NotRunning)
57 return;
58
59 // Launch spinner process to provide default background when a session isn't ready
60@@ -776,10 +786,15 @@
61 spinner_process.start(config->spinner().c_str());
62 }
63
64+void SystemCompositor::kill_spinner()
65+{
66+ spinner_process.close();
67+}
68+
69 void SystemCompositor::qt_main(int argc, char **argv)
70 {
71 QCoreApplication app(argc, argv);
72 DBusScreen dbus_screen(config, config->power_off_delay());
73- launch_spinner();
74+ ensure_spinner();
75 app.exec();
76 }
77
78=== modified file 'src/system_compositor.h'
79--- src/system_compositor.h 2014-05-01 16:22:43 +0000
80+++ src/system_compositor.h 2014-06-19 22:05:52 +0000
81@@ -34,6 +34,8 @@
82 void pause();
83 void resume();
84 pid_t get_spinner_pid() const;
85+ void ensure_spinner();
86+ void kill_spinner();
87
88 private:
89 std::shared_ptr<SystemCompositorServerConfiguration> config;
90@@ -46,7 +48,6 @@
91 void set_next_session(std::string client_name);
92 void main();
93 void qt_main(int argc, char **argv);
94- void launch_spinner();
95 };
96
97 #endif /* SYSTEM_COMPOSITOR_H_ */

Subscribers

People subscribed via source and target branches