• Sunny's avatar
    Postpone listener replacement after non-persistent notification closed · 4e4c3c10
    Sunny authored
    When calling |RegisterNonPersistentNotificationListener| with an existed
    notification id, it will first dispatch a close event to old notification
    and set new listener into listener map.
    
    Currently the new listener is replaced immediately after calling
    |DispatchNonPersistentCloseEvent|, since it's an asynchronize call,
    it will remove the replaced listener unexpectedly, instead of removing
    the original listener.
    
    To fix this, we can postpone listener replacement after the close event
    finish it's cleaning job. For new created notification, the listener can
    be set immediately due to there is no close event need to be dispatched.
    
    Bug: 880266, 898486
    Change-Id: I370d77386cf1a6636f368f1785d92d362a3b4263
    Reviewed-on: https://chromium-review.googlesource.com/c/1303898Reviewed-by: default avatarMike West <mkwst@chromium.org>
    Commit-Queue: Mike West <mkwst@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#604203}
    4e4c3c10
notification_event_dispatcher_impl.h 3.88 KB