Nux

Merge lp:~vanvugt/nux/fix-1014610 into lp:nux

Proposed by Daniel van Vugt
Status: Merged
Approved by: Tim Penhey
Approved revision: 624
Merged at revision: 623
Proposed branch: lp:~vanvugt/nux/fix-1014610
Merge into: lp:nux
Diff against target: 35 lines (+14/-0)
2 files modified
Nux/View.cpp (+3/-0)
tests/gtest-nux-view.cpp (+11/-0)
To merge this branch: bzr merge lp:~vanvugt/nux/fix-1014610
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+110794@code.launchpad.net

Commit message

Don't allow a View to be queued multiple times on the draw list. It causes
unbounded list growth and the UI to freeze in some cases. (LP: #1014610)

Description of the change

This fix not only eliminates the pauses I experience, but also seems to improve the performance of Unity in general.

For example, opening the dash:
Before the fix: spikes to a DrawList size of around 300
After the fix: spikes to only 30

To post a comment you must log in.
lp:~vanvugt/nux/fix-1014610 updated
624. By Daniel van Vugt

Add test for LP: #1014610

Revision history for this message
Tim Penhey (thumper) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/View.cpp'
2--- Nux/View.cpp 2012-06-12 09:13:06 +0000
3+++ Nux/View.cpp 2012-06-18 12:43:42 +0000
4@@ -216,6 +216,9 @@
5
6 void View::QueueDraw()
7 {
8+ if (draw_cmd_queued_)
9+ return;
10+
11 //GetWindowCompositor()..AddToDrawList(this);
12 WindowThread* application = GetWindowThread();
13 if (application)
14
15=== modified file 'tests/gtest-nux-view.cpp'
16--- tests/gtest-nux-view.cpp 2012-06-12 18:22:56 +0000
17+++ tests/gtest-nux-view.cpp 2012-06-18 12:43:42 +0000
18@@ -65,6 +65,17 @@
19 EXPECT_EQ(test_view2->calls_to_queue_draw_, 1);
20 EXPECT_EQ(test_view3->calls_to_queue_draw_, 1);
21
22+ int old_size = wnd_thread->GetDrawList().size();
23+ main_view->QueueDraw();
24+ test_view2->QueueDraw();
25+ int new_size = wnd_thread->GetDrawList().size();
26+ EXPECT_EQ(old_size, new_size); // LP: #1014610
27+
28+ EXPECT_EQ(main_view->calls_to_queue_draw_, 2);
29+ EXPECT_EQ(test_view1->calls_to_queue_draw_, 1);
30+ EXPECT_EQ(test_view2->calls_to_queue_draw_, 2);
31+ EXPECT_EQ(test_view3->calls_to_queue_draw_, 1);
32+
33 main_view->UnReference();
34 delete wnd_thread;
35 }

Subscribers

People subscribed via source and target branches