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

Issue 6507017: MessagePump implementations should call DoWork and DoDelayedWork at equal priority (Closed)

Created:
9 years, 10 months ago by Mark Mentovai
Modified:
9 years, 7 months ago
CC:
chromium-reviews, pam+watch_chromium.org, brettw-cc_chromium.org, jamesr
Visibility:
Public.

Description

MessagePump implementations should call DoWork and DoDelayedWork at equal priority. BUG=72007 TEST=base_unittests --gtest_filter=MessageLoopTest.RecursiveDenial3 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=75294

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 3

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -95 lines) Patch
M base/message_loop_unittest.cc View 1 2 3 chunks +54 lines, -0 lines 0 comments Download
M base/message_pump.h View 1 2 3 chunks +7 lines, -5 lines 0 comments Download
M base/message_pump_mac.h View 1 2 3 chunks +5 lines, -14 lines 0 comments Download
M base/message_pump_mac.mm View 1 2 7 chunks +35 lines, -76 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Mark Mentovai
9 years, 10 months ago (2011-02-16 20:27:27 UTC) #1
Mark Mentovai
I’m aware that this potentially calls DoDelayedWork even after someone inside of DoWork calls quit. ...
9 years, 10 months ago (2011-02-16 20:30:16 UTC) #2
Mark Mentovai
Updated to include jamesr’s test from http://codereview.chromium.org/6334126/.
9 years, 10 months ago (2011-02-16 21:43:30 UTC) #3
darin (slow to review)
http://codereview.chromium.org/6507017/diff/2003/base/message_loop_unittest.cc File base/message_loop_unittest.cc (right): http://codereview.chromium.org/6507017/diff/2003/base/message_loop_unittest.cc#newcode779 base/message_loop_unittest.cc:779: PlatformThread::Sleep(10); // milliseconds nit: two spaces before '//' for ...
9 years, 10 months ago (2011-02-16 23:58:02 UTC) #4
Mark Mentovai
New version up with minor changes in the unit test. http://codereview.chromium.org/6507017/diff/2003/base/message_pump_mac.mm File base/message_pump_mac.mm (right): http://codereview.chromium.org/6507017/diff/2003/base/message_pump_mac.mm#newcode285 ...
9 years, 10 months ago (2011-02-17 18:28:39 UTC) #5
darin (slow to review)
9 years, 10 months ago (2011-02-17 18:46:05 UTC) #6
On Thu, Feb 17, 2011 at 10:28 AM, <mark@chromium.org> wrote:

> New version up with minor changes in the unit test.
>
>
>
> http://codereview.chromium.org/6507017/diff/2003/base/message_pump_mac.mm
> File base/message_pump_mac.mm (right):
>
>
>
http://codereview.chromium.org/6507017/diff/2003/base/message_pump_mac.mm#new...
> base/message_pump_mac.mm:285: delegate_->DoDelayedWork(&next_time);
> darin wrote:
>
>> i would have expected a "did_work |= delegate_->DoDelayedWork(...)"
>>
> here
>
> did_work |= doesn’t really help here. As you can see, I use the value of
> did_work from DoWork to determine whether it’s necessary to try to
> schedule more work; I use next_time to determine whether the work should
> be scheduled immediately or in the future.
>
> Different implementation, different strategy. I’ve got to hit
> ScheduleDelayedWork from here. The Windows pump seems to do that right
> on the timer callback, but it also has a DoDelayedWork call in its timer
> callback. That won’t work here on the Mac, we’ll wind up with another
> starvation or ordering problem (which the “timer signals run loop
> source” architecture was intended to resolve.)
>
> As cute as the |= is, this code is much clearer ignoring the result of
> DoDelayedWork and then interpreting next_time on its own.


Yeah, now that I think about it more, I believe message_pump_win.cc is just
optimizing to avoid having to call MsgWaitForMultipleObjectsEx when the
message pump may have more work to do.

LGTM

-Darin



>
>
> http://codereview.chromium.org/6507017/
>

Powered by Google App Engine
This is Rietveld 408576698