Factor out a PendingNotificationTracker from the NotificationManager.
The existing code ends up moving values between threads, whether by value or hidden in a callback, causing instability and races in edge- cases, for example when abruptly cancelling the load. This patch introduces a PendingNotificationTracker, which completely lives on the same thread as NotificationManager and will store all information associated with the notification, ensuring that it never inadvertently leaves the thread. The NotificationImageLoader lives on the main thread and is in charge of doing the actual fetch. Rather than storing either a callback with the Notification's data, it knows a pending notification id given to it by the PendingNotificationTracker. This allows us to re-associate the data when the fetched resource(s) are available. I'm adding some layout tests in the following patch to exercise the image loader in a number of additional cases. Unit tests will be added in a follow-up patch. https://codereview.chromium.org/933153003/ BUG=458640 Review URL: https://codereview.chromium.org/939513002 Cr-Commit-Position: refs/heads/master@{#316921}
Showing
Please register or sign in to comment