Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Issue 10833: Rewrite the glib UI pump. (Closed)

Created:
12 years, 1 month ago by Dean McNamee
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Rewrite the glib UI pump. Although the previous pump was correct in terms of test coverage, it was mis-handling the concept of idle work. This meant we were effectively polling the pump, causing full CPU usage. The new pump is greatly simplified, and follows the pattern used on Windows. All tests still pass.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -258 lines) Patch
M base/message_pump_glib.h View 1 chunk +5 lines, -38 lines 0 comments Download
M base/message_pump_glib.cc View 4 chunks +125 lines, -220 lines 3 comments Download

Messages

Total messages: 3 (0 generated)
Dean McNamee
12 years, 1 month ago (2008-11-12 17:13:16 UTC) #1
darin (slow to review)
LG http://codereview.chromium.org/10833/diff/1/2 File base/message_pump_glib.cc (right): http://codereview.chromium.org/10833/diff/1/2#newcode156 Line 156: // Drain our wakeup pipe, this is ...
12 years, 1 month ago (2008-11-12 18:12:01 UTC) #2
dsh
12 years, 1 month ago (2008-11-12 19:24:42 UTC) #3
This may fix the bug, but is it adaptable to work when GTK widgets run a
recursive main loop on the default context, or is it just going to get
redesigned back to the way it is now with a minor bug fix to get the idle work
done right?

http://codereview.chromium.org/10833/diff/1/2
File base/message_pump_glib.cc (left):

http://codereview.chromium.org/10833/diff/1/2#oldcode180
Line 180: state->should_do_idle_work = true;
It's not really necessary to redesign the whole thing, esp since this is not
correct WRT recursive runs of the main loop via g_main_loop_run (in a GTK
widget).  I think to get it correct it will end up looking a lot like it looks
now.

The current problem is just a bug that could be fixed by adding another state to
RunState that says we tried idle work and can go to sleep on the poll call now.

http://codereview.chromium.org/10833/diff/1/2
File base/message_pump_glib.cc (right):

http://codereview.chromium.org/10833/diff/1/2#newcode160
Line 160: if (state_->delegate->DoWork())
This is much simpler, but the problem is like you said on chat: A GTK widget may
run a loop in the default context (which we are using) which means that this
code will not execute during that time.  This is the reason all the work was
done in the GSource callbacks.

Powered by Google App Engine
This is Rietveld 408576698