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

Issue 939513002: Factor out a PendingNotificationTracker from the NotificationManager. (Closed)

Created:
5 years, 10 months ago by Peter Beverloo
Modified:
5 years, 10 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@n-sounds
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/11d160807115e28b7b870a40a2ab14825f7cd365 Cr-Commit-Position: refs/heads/master@{#316921}

Patch Set 1 #

Total comments: 27

Patch Set 2 : comments #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 2

Patch Set 5 : further comments #

Patch Set 6 : #

Total comments: 9

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+362 lines, -179 lines) Patch
M content/child/notifications/notification_image_loader.h View 1 2 4 chunks +39 lines, -22 lines 0 comments Download
M content/child/notifications/notification_image_loader.cc View 1 2 3 3 chunks +41 lines, -24 lines 0 comments Download
M content/child/notifications/notification_manager.h View 1 2 3 4 5 2 chunks +21 lines, -47 lines 0 comments Download
M content/child/notifications/notification_manager.cc View 1 2 3 4 5 6 7 chunks +36 lines, -86 lines 0 comments Download
A content/child/notifications/pending_notifications_tracker.h View 1 2 3 4 5 1 chunk +107 lines, -0 lines 0 comments Download
A content/child/notifications/pending_notifications_tracker.cc View 1 2 3 4 5 6 1 chunk +116 lines, -0 lines 0 comments Download
M content/content_child.gypi View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (3 generated)
Peter Beverloo
+mvanouwerkerk, mlamouri I would appreciate an early review. This fixes 2 crashes I still see ...
5 years, 10 months ago (2015-02-18 00:07:55 UTC) #2
mlamouri (slow - plz ping)
Few comments below but this is a big patch doing subtle changes on code I ...
5 years, 10 months ago (2015-02-18 14:53:59 UTC) #3
Peter Beverloo
Thanks for the review, Mounir!! PTAL. https://codereview.chromium.org/939513002/diff/1/content/child/notifications/notification_image_loader.cc File content/child/notifications/notification_image_loader.cc (left): https://codereview.chromium.org/939513002/diff/1/content/child/notifications/notification_image_loader.cc#oldcode40 content/child/notifications/notification_image_loader.cc:40: DCHECK(worker_task_runner); On 2015/02/18 ...
5 years, 10 months ago (2015-02-18 15:11:50 UTC) #4
Peter Beverloo
PTAL. This works awesomely well now.
5 years, 10 months ago (2015-02-18 18:28:09 UTC) #5
mlamouri (slow - plz ping)
I think it would be nice if you could pass a callback to the notifications ...
5 years, 10 months ago (2015-02-18 21:04:08 UTC) #6
Peter Beverloo
Done. Thank you for the suggestion, that made it a lot leaner :-). https://codereview.chromium.org/939513002/diff/60001/content/child/notifications/pending_notification_tracker.h File ...
5 years, 10 months ago (2015-02-18 21:44:55 UTC) #8
mlamouri (slow - plz ping)
looks great, thanks! Fix the nits, land that and go home! :) https://codereview.chromium.org/939513002/diff/100001/content/child/notifications/notification_manager.cc File content/child/notifications/notification_manager.cc ...
5 years, 10 months ago (2015-02-18 21:51:58 UTC) #9
Peter Beverloo
https://codereview.chromium.org/939513002/diff/100001/content/child/notifications/notification_manager.cc File content/child/notifications/notification_manager.cc (right): https://codereview.chromium.org/939513002/diff/100001/content/child/notifications/notification_manager.cc#newcode81 content/child/notifications/notification_manager.cc:81: base::Unretained(this), On 2015/02/18 21:51:58, Mounir Lamouri wrote: > nit: ...
5 years, 10 months ago (2015-02-18 21:57:49 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/939513002/120001
5 years, 10 months ago (2015-02-18 21:58:33 UTC) #12
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 10 months ago (2015-02-18 23:46:04 UTC) #13
commit-bot: I haz the power
5 years, 10 months ago (2015-02-18 23:47:13 UTC) #14
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/11d160807115e28b7b870a40a2ab14825f7cd365
Cr-Commit-Position: refs/heads/master@{#316921}

Powered by Google App Engine
This is Rietveld 408576698