On Wed, Mar 31, 2010 at 11:48 AM, Mark Mentovai <
mark <at> chromium.org> wrote:
> (Take note of
http://crbug.com/38522 if you haven’t already.)
>
> The real root of the problem is that we do run a nested loop on the
> Mac where other platforms don’t. BrowserWindowCocoa::Close() is
> implemented in terms of -[NSWindow performClose:], which spins a
> nested loop.
>
> I’ve suggested in the past that a way around this was similar to what
> dmac suggests, to refuse to do Chrome “work” in the message pump if
> running nested and the message loop isn’t set up to permit it. Darin
> didn’t want to expose the “nestable allowed?” property to the pump in
> this way. I admit that the circular relationship that it creates
> between the message pump and message loop makes things a little fuzzy.
>
> dmac’s suggestion seems to be to leave this logic in the loop, and
> just refuse to do work in a nested loop (and make sure that the work
> gets done with all pump implementations when falling out of the nested
> loop) instead of having a CHECK. Darin may have opinions here, too.
>
> Mark
>
> Dave MacLachlan wrote:
>> So I see a lot of flaky test errors on the Mac with:
>>
>> message_loop.cc(324) Check failed: nestable_tasks_allowed
>>
>> 0 browser_tests StackTrace::StackTrace() + 32
>> 1 browser_tests logging::LogMessage::~LogMessage() + 63
>> 2 browser_tests MessageLoop::RunTask(Task*) + 173
>> 3 browser_tests MessageLoop::ProcessNextDelayedNonNestableTask() + 109
>> 4 browser_tests MessageLoop::DoIdleWork() + 17
>> 5 browser_tests base::MessagePumpCFRunLoopBase::RunIdleWork() + 74
>> 6 browser_tests
>> base::MessagePumpCFRunLoopBase::PreWaitObserver(__CFRunLoopObserver*,
>> unsigned long, void*) + 23
>> 7 CoreFoundation __CFRunLoopDoObservers + 1186
>> 8 CoreFoundation __CFRunLoopRun + 1154
>> 9 CoreFoundation CFRunLoopRunSpecific + 452
>> 10 CoreFoundation CFRunLoopRunInMode + 97
>> 11 HIToolbox RunCurrentEventLoopInMode + 392
>> 12 HIToolbox ReceiveNextEventCommon + 354
>> 13 HIToolbox BlockUntilNextEventMatchingListInMode + 81
>> 14 AppKit _DPSNextEvent + 847
>> 15 AppKit -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
>> + 156
>> 16 AppKit -[NSButtonCell performClick:] + 983
>> 17 browser_tests BrowserWindowCocoa::Close() + 170
>> 18 browser_tests Browser::CloseWindow() + 80
>> 19 browser_tests
>> BrowserActionApiTest_IncognitoBasic_Test::RunTestOnMainThread() + 1284
>> 20 browser_tests InProcessBrowserTest::RunTestOnMainThreadLoop() + 463
>> 21 browser_tests void DispatchToMethod<InProcessBrowserTest, void
>> (InProcessBrowserTest::*)()>(InProcessBrowserTest*, void
>> (InProcessBrowserTest::*)(), Tuple0 const&) + 56
>> 22 browser_tests RunnableMethod<InProcessBrowserTest, void
>> (InProcessBrowserTest::*)(), Tuple0>::Run() + 57
>> 23 browser_tests MessageLoop::RunTask(Task*) + 220
>> 24 browser_tests
>> MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const&) + 53
>> 25 browser_tests MessageLoop::DoWork() + 253
>> 26 browser_tests base::MessagePumpCFRunLoopBase::RunWork() + 74
>> 27 browser_tests base::MessagePumpCFRunLoopBase::RunWorkSource(void*) + 23
>>
>> I don't think we should be running idle work in a nested run loop should we?
>> Isn't that the whole point of nestable_tasks_allowed? Now we would only be
>> seeing these errors on the times when the run loop actually has some time to
>> go to sleep for some reason, so that may explain the flakiness. Most of the
>> time when running the tests, the runloops won't have any sleep time I'm
>> guessing, so PreWaitObserver won't get called. Should we just be blocking
>> the call do MessageLoop::DoIdleWork if nestable_tasks_allowed is false? I
>> did this in my local sandbox and didn't see any hangs in quicktime, or
>> animations.
>