Merge lp:~vanvugt/unity/fix-822157-3.0 into lp:unity/3.0

Proposed by Daniel van Vugt
Status: Merged
Approved by: Neil J. Patel
Approved revision: no longer in the source branch.
Merged at revision: 1209
Proposed branch: lp:~vanvugt/unity/fix-822157-3.0
Merge into: lp:unity/3.0
Diff against target: 42 lines (+6/-1)
2 files modified
src/SimpleLauncherIcon.cpp (+5/-1)
src/SimpleLauncherIcon.h (+1/-0)
To merge this branch: bzr merge lp:~vanvugt/unity/fix-822157-3.0
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+70665@code.launchpad.net

Description of the change

Fixed SimpleLauncherIcon::GetTextureForSize continuously reloading some icons on every redraw. Wasting lost of CPU. (LP: #822157)

An almost identical fix has already been committed to unity 4.4.0 (without a bug ID):
http://bazaar.launchpad.net/~unity-team/unity/trunk/revision/1296#plugins/unityshell/src/SimpleLauncherIcon.cpp

Since the fix provides a significant performance improvement with very little changes and almost no risk, I think it's worth proposing to unity 3.x.

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Thanks!

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please remember to nominate natty in bug 822157. Currently it only shows the status for oneiric.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/SimpleLauncherIcon.cpp'
2--- src/SimpleLauncherIcon.cpp 2011-04-20 09:40:45 +0000
3+++ src/SimpleLauncherIcon.cpp 2011-08-07 05:46:30 +0000
4@@ -30,6 +30,7 @@
5 {
6 m_Icon = 0;
7 m_IconName = 0;
8+ _requested_icon_size = 0;
9
10 _on_mouse_down_connection = (sigc::connection) LauncherIcon::MouseDown.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseDown));
11 _on_mouse_up_connection = (sigc::connection) LauncherIcon::MouseUp.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseUp));
12@@ -90,7 +91,7 @@
13 nux::BaseTexture *
14 SimpleLauncherIcon::GetTextureForSize (int size)
15 {
16- if (m_Icon && size == m_Icon->GetHeight ())
17+ if (m_Icon && size == _requested_icon_size)
18 return m_Icon;
19
20 if (m_Icon)
21@@ -104,6 +105,9 @@
22 m_Icon = TextureFromPath (m_IconName, size);
23 else
24 m_Icon = TextureFromGtkTheme (m_IconName, size);
25+
26+ _requested_icon_size = size; // not always the same as m_Icon->GetHeight()
27+
28 return m_Icon;
29 }
30
31
32=== modified file 'src/SimpleLauncherIcon.h'
33--- src/SimpleLauncherIcon.h 2011-03-29 17:32:19 +0000
34+++ src/SimpleLauncherIcon.h 2011-08-07 05:46:30 +0000
35@@ -51,6 +51,7 @@
36 void ActivateLauncherIcon ();
37 static void OnIconThemeChanged (GtkIconTheme* icon_theme, gpointer data);
38 guint32 _theme_changed_id;
39+ int _requested_icon_size;
40
41 sigc::connection _on_mouse_down_connection;
42 sigc::connection _on_mouse_up_connection;

Subscribers

People subscribed via source and target branches

to all changes: