• Gabriel Charette's avatar
    Revert "[base] Migrate the Win MessagePump to DoSomeWork" · d8a530f9
    Gabriel Charette authored
    This reverts commit 8c5fb8cb.
    
    Reason for revert: DCHECK(!installed_native_timer_); in dev builds
    when moving and resizing windows. Seems interactive_ui_tests might
    not cover those cases..?
    
    Original change's description:
    > [base] Migrate the Win MessagePump to DoSomeWork
    >
    > This CL migrates both MessagePumpForUI and ForIO as they use the same
    > base class and it's easier to do both at once.
    >
    > Tweaks to MessagePumpBase and/or both pumps:
    >  * Use DoSomeWork() instead of DoWork()/DoDelatedWork()
    >  * Replace |delayed_work_time_| by a timeout value computed on the stack
    >    from the result of DoSomeWork(). Conversely making
    >    ScheduleDelayedWork() a no-op as desired.
    >  * Refactor GetCurrentDelay() into GetSleepTimeoutMs() and use modern
    >    safe_conversions.h to perform the math.
    >
    > MessagePumpForUI specific tweaks:
    >  * Fixed crbug.com/929263: ::SetTimer() used 0 as an nIDEvent but
    >    ::KillTimer() used |this| so they weren't even interacting...
    >  * Fixed bug: even with the previous bug fixed. HandleTimerMessage()
    >    could be invoked while in a non-native DoRunLoop() (e.g. since
    >    KillTimer doesn't remove WM_TIMER messages already enqueued) and as
    >    such result in redundant sources of scheduling since it would then
    >    continue to RescheduleTimer() and confusing state for DoRunLoop()).
    >  * Ignore WM_TIMER messages which weren't scheduled by our ::SetTimer().
    >  * Simplified usage of native ::SetTimer(). We now *only* rely on it
    >    when in a native nested loop and kill it immediately after to avoid
    >    double-scheduling.
    >
    > Note: MessageLoopTest.PostDelayedTask_SharedTimer_SubPump tests the
    > necessity for a native timer when entering a native nested loop and
    > confirms that the new behavior is WAI.
    >
    > Also adding regression tests for a tricky use case (and finding that
    > it's already broken on ToT..!). Filed crbug.com/930940 to follow-up.
    >
    > Bug: 885371, 929263, 930940
    > Change-Id: I7f2d18a1a5a494c6a4f31fcc0fad9b4de25d70a7
    > Reviewed-on: https://chromium-review.googlesource.com/c/1455266
    > Reviewed-by: Alex Clarke <alexclarke@chromium.org>
    > Reviewed-by: François Doray <fdoray@chromium.org>
    > Commit-Queue: Gabriel Charette <gab@chromium.org>
    > Auto-Submit: Gabriel Charette <gab@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#631231}
    
    TBR=gab@chromium.org,fdoray@chromium.org,alexclarke@chromium.org
    
    # Not skipping CQ checks because original CL landed > 1 day ago.
    
    Bug: 885371, 929263, 930940
    Change-Id: Ic179d0493d01d4f44330927d9ccdb0f1454d2e78
    Reviewed-on: https://chromium-review.googlesource.com/c/1471254Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
    Commit-Queue: Gabriel Charette <gab@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#631885}
    d8a530f9
message_pump_win.cc 22.7 KB