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

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)

Created:
4 years, 3 months ago by Peter Beverloo
Modified:
4 years, 3 months ago
CC:
blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, einbinder+watch-test-runner_chromium.org, haraken, harkness+watch_chromium.org, jam, jochen+watch_chromium.org, johnme+watch_chromium.org, mlamouri+watch-content_chromium.org, mlamouri+watch-notifications_chromium.org, mlamouri+watch-test-runner_chromium.org, Peter Beverloo
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Generate Web Notification Ids in the //content layer Today, Web Notifications get a random Id assigned to them by the delegate used with the message_center::Notification object. This has a number of implications: (1) We don't get super smooth "update" transitions for message center notifications upon replacing a notification. (2) We continue to rely on the delegates associated with Notification objects, which in themselves are incompatible with notifications that can outlive the process they were created by. (3) It's not possible for the //content layer, that has knowledge of the notifications that *should* be showing, to close them when certain events occur (for instance, the Service Worker unregistering). That leads to unresponsive notifications. This patch makes the NotificationIdGenerator responsible for creating the notification Ids, giving us a clear path towards solving these issues. In addition, it further isolates the concept of persistent notification Ids, reducing the number of Ids readers of this code have to keep in mind. The NotificationDatabase's keying scheme has been changed to refer to the generated Id as opposed to the ever-incrementing persistent notification ID. This avoids needing separate association keys and removes a DELETE operation prior to writing data for a potentially replaced notification. TBR=mkwst (type change in /web/) BUG=485985, 439950 Committed: https://crrev.com/c45944c33233a04614dca6eeed41f75e75a943be Cr-Commit-Position: refs/heads/master@{#418241}

Patch Set 1 : Make //content responsible for generating notification Ids #

Total comments: 40

Patch Set 2 : Make //content responsible for generating notification Ids #

Patch Set 3 : Make //content responsible for generating notification Ids #

Total comments: 40

Patch Set 4 : rebase + comments #

Total comments: 4

Patch Set 5 : comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+702 lines, -686 lines) Patch
M chrome/browser/notifications/message_center_display_service.h View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/notifications/message_center_display_service.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/notifications/message_center_notification_manager.cc View 1 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/notifications/native_notification_display_service.h View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/notifications/native_notification_display_service.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/notifications/notification_display_service.h View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/notifications/notification_object_proxy.h View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/notifications/notification_object_proxy.cc View 4 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/notifications/notification_platform_bridge.h View 1 chunk +0 lines, -6 lines 0 comments Download
M chrome/browser/notifications/notification_platform_bridge_android.h View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/notifications/notification_platform_bridge_android.cc View 1 2 chunks +0 lines, -5 lines 0 comments Download
M chrome/browser/notifications/notification_platform_bridge_mac.h View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/notifications/notification_platform_bridge_mac.mm View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/notifications/persistent_notification_delegate.h View 3 chunks +2 lines, -10 lines 0 comments Download
M chrome/browser/notifications/persistent_notification_delegate.cc View 4 chunks +6 lines, -21 lines 0 comments Download
M chrome/browser/notifications/persistent_notification_handler.h View 1 chunk +1 line, -4 lines 0 comments Download
M chrome/browser/notifications/persistent_notification_handler.cc View 1 2 3 2 chunks +7 lines, -19 lines 0 comments Download
M chrome/browser/notifications/platform_notification_service_impl.h View 4 chunks +10 lines, -15 lines 0 comments Download
M chrome/browser/notifications/platform_notification_service_impl.cc View 13 chunks +17 lines, -48 lines 0 comments Download
M chrome/browser/notifications/platform_notification_service_unittest.cc View 1 2 7 chunks +12 lines, -18 lines 0 comments Download
M chrome/browser/notifications/stub_notification_platform_bridge.h View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/notifications/stub_notification_platform_bridge.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/push_messaging/push_messaging_notification_manager.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/push_messaging/push_messaging_notification_manager.cc View 1 2 3 3 chunks +5 lines, -5 lines 0 comments Download
M content/browser/notifications/notification_database.h View 1 2 3 6 chunks +25 lines, -19 lines 0 comments Download
M content/browser/notifications/notification_database.cc View 1 2 3 4 10 chunks +68 lines, -65 lines 0 comments Download
M content/browser/notifications/notification_database_data.proto View 1 2 3 4 1 chunk +5 lines, -2 lines 0 comments Download
M content/browser/notifications/notification_database_data_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M content/browser/notifications/notification_database_unittest.cc View 1 2 3 4 19 chunks +85 lines, -82 lines 0 comments Download
M content/browser/notifications/notification_event_dispatcher_impl.h View 2 chunks +2 lines, -4 lines 0 comments Download
M content/browser/notifications/notification_event_dispatcher_impl.cc View 2 8 chunks +19 lines, -18 lines 0 comments Download
M content/browser/notifications/notification_id_generator.h View 1 2 chunks +4 lines, -6 lines 0 comments Download
M content/browser/notifications/notification_id_generator.cc View 1 4 chunks +11 lines, -18 lines 0 comments Download
M content/browser/notifications/notification_id_generator_unittest.cc View 12 chunks +66 lines, -51 lines 0 comments Download
M content/browser/notifications/notification_message_filter.h View 1 2 7 chunks +18 lines, -10 lines 0 comments Download
M content/browser/notifications/notification_message_filter.cc View 1 2 14 chunks +38 lines, -22 lines 0 comments Download
M content/browser/notifications/page_notification_delegate.h View 3 chunks +7 lines, -2 lines 0 comments Download
M content/browser/notifications/page_notification_delegate.cc View 4 chunks +12 lines, -5 lines 0 comments Download
M content/browser/notifications/platform_notification_context_impl.h View 1 2 5 chunks +12 lines, -4 lines 0 comments Download
M content/browser/notifications/platform_notification_context_impl.cc View 1 2 3 4 10 chunks +32 lines, -19 lines 0 comments Download
M content/browser/notifications/platform_notification_context_unittest.cc View 12 chunks +15 lines, -14 lines 0 comments Download
M content/child/notifications/notification_manager.h View 1 2 3 chunks +17 lines, -3 lines 0 comments Download
M content/child/notifications/notification_manager.cc View 1 2 8 chunks +30 lines, -12 lines 0 comments Download
M content/common/platform_notification_messages.h View 1 2 3 chunks +11 lines, -8 lines 0 comments Download
M content/common/service_worker/service_worker_messages.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M content/public/browser/BUILD.gn View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/notification_database_data.h View 1 2 3 4 2 chunks +11 lines, -3 lines 0 comments Download
A content/public/browser/notification_database_data.cc View 1 2 3 4 1 chunk +19 lines, -0 lines 0 comments Download
M content/public/browser/notification_event_dispatcher.h View 3 chunks +5 lines, -7 lines 0 comments Download
M content/public/browser/platform_notification_context.h View 1 2 3 4 3 chunks +5 lines, -4 lines 0 comments Download
M content/public/browser/platform_notification_service.h View 3 chunks +3 lines, -2 lines 0 comments Download
M content/renderer/service_worker/service_worker_context_client.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M content/renderer/service_worker/service_worker_context_client.cc View 1 2 1 chunk +5 lines, -7 lines 0 comments Download
M content/shell/browser/layout_test/layout_test_notification_manager.h View 1 4 chunks +14 lines, -14 lines 0 comments Download
M content/shell/browser/layout_test/layout_test_notification_manager.cc View 1 3 chunks +65 lines, -76 lines 0 comments Download
M third_party/WebKit/Source/modules/notifications/Notification.h View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/notifications/Notification.cpp View 1 2 5 chunks +4 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/public/platform/modules/notifications/WebNotificationManager.h View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextProxy.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 59 (41 generated)
Peter Beverloo
+miguelg for //chrome +johnme for the rest Please disregard the PlatformNotificationContextImpl and NotificationDatabase changes, I ...
4 years, 3 months ago (2016-09-02 12:21:31 UTC) #15
Miguel Garcia
Had a look at the chrome side and the generator itself while the rest gets ...
4 years, 3 months ago (2016-09-02 14:33:16 UTC) #18
johnme
Looks fantastic! It's so nice to have consistent names and types for the different kinds ...
4 years, 3 months ago (2016-09-02 15:07:44 UTC) #19
Peter Beverloo
All done, I also fixed test failures. This is not ready for a re-review yet ...
4 years, 3 months ago (2016-09-05 15:11:01 UTC) #22
Peter Beverloo
This is now ready for formal review. +miguelg for //chrome +johnme for everything else I'll ...
4 years, 3 months ago (2016-09-06 15:22:34 UTC) #29
johnme
Looking good so far. Some initial nits; more to come. https://codereview.chromium.org/2300093002/diff/100001/content/browser/notifications/notification_database.cc File content/browser/notifications/notification_database.cc (right): https://codereview.chromium.org/2300093002/diff/100001/content/browser/notifications/notification_database.cc#newcode33 ...
4 years, 3 months ago (2016-09-07 17:13:14 UTC) #32
Miguel Garcia
chrome layer lgtm. cool stuff https://codereview.chromium.org/2300093002/diff/40001/content/browser/notifications/notification_id_generator.cc File content/browser/notifications/notification_id_generator.cc (right): https://codereview.chromium.org/2300093002/diff/40001/content/browser/notifications/notification_id_generator.cc#newcode22 content/browser/notifications/notification_id_generator.cc:22: const char kPersistentPrefix[] = ...
4 years, 3 months ago (2016-09-07 17:32:33 UTC) #33
Peter Beverloo
https://codereview.chromium.org/2300093002/diff/100001/chrome/browser/notifications/persistent_notification_handler.cc File chrome/browser/notifications/persistent_notification_handler.cc (right): https://codereview.chromium.org/2300093002/diff/100001/chrome/browser/notifications/persistent_notification_handler.cc#newcode19 chrome/browser/notifications/persistent_notification_handler.cc:19: return; // no need to propagate programmatic close events ...
4 years, 3 months ago (2016-09-08 13:18:56 UTC) #36
Peter Beverloo
+piman for //content/public/ +tsepez for IPC changes (2 *messages.h files) +falken for Service Worker plumbing ...
4 years, 3 months ago (2016-09-08 13:23:52 UTC) #38
johnme
lgtm with nits - thanks again for cleaning this up! https://codereview.chromium.org/2300093002/diff/100001/content/browser/notifications/notification_database_data.proto File content/browser/notifications/notification_database_data.proto (left): https://codereview.chromium.org/2300093002/diff/100001/content/browser/notifications/notification_database_data.proto#oldcode16 ...
4 years, 3 months ago (2016-09-08 15:21:51 UTC) #41
Tom Sepez
Messages LGTM. Also checked your new string form comes from base::GenerateGUID and should be unguessable.
4 years, 3 months ago (2016-09-08 15:49:45 UTC) #42
piman
lgtm https://codereview.chromium.org/2300093002/diff/120001/content/public/browser/notification_database_data.h File content/public/browser/notification_database_data.h (right): https://codereview.chromium.org/2300093002/diff/120001/content/public/browser/notification_database_data.h#newcode22 content/public/browser/notification_database_data.h:22: NotificationDatabaseData(const NotificationDatabaseData& other); nit: worth adding a move ...
4 years, 3 months ago (2016-09-08 17:12:49 UTC) #43
Peter Beverloo
https://codereview.chromium.org/2300093002/diff/100001/content/browser/notifications/notification_database_data.proto File content/browser/notifications/notification_database_data.proto (left): https://codereview.chromium.org/2300093002/diff/100001/content/browser/notifications/notification_database_data.proto#oldcode16 content/browser/notifications/notification_database_data.proto:16: optional int64 notification_id = 1; On 2016/09/08 15:21:50, johnme ...
4 years, 3 months ago (2016-09-08 18:56:03 UTC) #44
falken
service worker lgtm
4 years, 3 months ago (2016-09-09 07:46:11 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2300093002/140001
4 years, 3 months ago (2016-09-13 12:30:15 UTC) #53
Mike West
type change in //Source/web LGTM.
4 years, 3 months ago (2016-09-13 12:30:32 UTC) #55
commit-bot: I haz the power
Committed patchset #5 (id:140001)
4 years, 3 months ago (2016-09-13 14:36:19 UTC) #57
commit-bot: I haz the power
4 years, 3 months ago (2016-09-13 14:39:04 UTC) #59
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/c45944c33233a04614dca6eeed41f75e75a943be
Cr-Commit-Position: refs/heads/master@{#418241}

Powered by Google App Engine
This is Rietveld 408576698