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

Issue 2878443002: Address a race condition in displaying notifications

Created:
3 years, 7 months ago by Peter Beverloo
Modified:
3 years, 7 months ago
Reviewers:
Miguel Garcia, miguelg, awdf
CC:
chromium-reviews, jam, mlamouri+watch-notifications_chromium.org, darin-cc_chromium.org, awdf+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Address a race condition in displaying notifications When a developer displays a notification and then immediately gets the displayed notifications, without waiting for the result to be acknowledged, there's a chance that we end up in a race condition where the PlatformNotificationService is still displaying the notification and thus doesn't return it in the set of displayed ones yet. This will, in turn, result in the notification being deleted from the database. That will render clicking on the notification useless. Instead, have a brief grace period in which we'll ignore the recently displayed notification when synchronizing the database. BUG=

Patch Set 1 #

Total comments: 2

Patch Set 2 : Address a race condition in displaying notifications #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+153 lines, -6 lines) Patch
M content/browser/notifications/platform_notification_context_impl.h View 1 4 chunks +9 lines, -0 lines 0 comments Download
M content/browser/notifications/platform_notification_context_impl.cc View 7 chunks +30 lines, -2 lines 1 comment Download
M content/browser/notifications/platform_notification_context_unittest.cc View 1 6 chunks +114 lines, -4 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 18 (10 generated)
Peter Beverloo
+miguelg, awdf for review I think this is reasonable enough. WDYT?
3 years, 7 months ago (2017-05-10 14:45:21 UTC) #3
awdf
On 2017/05/10 14:45:21, Peter Beverloo wrote: > +miguelg, awdf for review > > I think ...
3 years, 7 months ago (2017-05-10 14:55:50 UTC) #5
Peter Beverloo
On 2017/05/10 14:55:50, awdf wrote: > On 2017/05/10 14:45:21, Peter Beverloo wrote: > > +miguelg, ...
3 years, 7 months ago (2017-05-10 15:10:14 UTC) #6
awdf
lgtm % fixing up the existing tests. https://codereview.chromium.org/2878443002/diff/1/content/browser/notifications/platform_notification_context_unittest.cc File content/browser/notifications/platform_notification_context_unittest.cc (right): https://codereview.chromium.org/2878443002/diff/1/content/browser/notifications/platform_notification_context_unittest.cc#newcode569 content/browser/notifications/platform_notification_context_unittest.cc:569: ASSERT_EQ(0u, notification_database_datas.size()); ...
3 years, 7 months ago (2017-05-10 17:01:58 UTC) #9
Peter Beverloo
Thanks! https://codereview.chromium.org/2878443002/diff/1/content/browser/notifications/platform_notification_context_unittest.cc File content/browser/notifications/platform_notification_context_unittest.cc (right): https://codereview.chromium.org/2878443002/diff/1/content/browser/notifications/platform_notification_context_unittest.cc#newcode569 content/browser/notifications/platform_notification_context_unittest.cc:569: ASSERT_EQ(0u, notification_database_datas.size()); On 2017/05/10 17:01:57, awdf wrote: > ...
3 years, 7 months ago (2017-05-10 17:09:22 UTC) #11
miguelg
lgtm
3 years, 7 months ago (2017-05-10 17:38:35 UTC) #14
awdf
https://codereview.chromium.org/2878443002/diff/20001/content/browser/notifications/platform_notification_context_impl.cc File content/browser/notifications/platform_notification_context_impl.cc (right): https://codereview.chromium.org/2878443002/diff/20001/content/browser/notifications/platform_notification_context_impl.cc#newcode420 content/browser/notifications/platform_notification_context_impl.cc:420: void PlatformNotificationContextImpl::DeleteNotificationData( Just to check my understanding - this ...
3 years, 7 months ago (2017-05-11 10:38:53 UTC) #17
Miguel Garcia
3 years, 7 months ago (2017-05-11 12:16:58 UTC) #18
lgtm

Powered by Google App Engine
This is Rietveld 408576698