| Index: content/browser/notifications/platform_notification_context_impl.cc
|
| diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc
|
| index 8ef474c619dccc40b4cef826bda96630b8e02806..8a15289d8aac51406bc6db6714058e99d5dc3317 100644
|
| --- a/content/browser/notifications/platform_notification_context_impl.cc
|
| +++ b/content/browser/notifications/platform_notification_context_impl.cc
|
| @@ -281,10 +281,10 @@ void PlatformNotificationContextImpl::
|
| UMA_HISTOGRAM_ENUMERATION("Notifications.Database.ReadForServiceWorkerResult",
|
| status, NotificationDatabase::STATUS_COUNT);
|
|
|
| + std::vector<std::string> obsolete_notifications;
|
| +
|
| if (status == NotificationDatabase::STATUS_OK) {
|
| if (supports_synchronization) {
|
| - // Filter out notifications that are not actually on display anymore.
|
| - // TODO(miguelg) synchronize the database if there are inconsistencies.
|
| for (auto it = notification_datas.begin();
|
| it != notification_datas.end();) {
|
| // The database is only used for persistent notifications.
|
| @@ -293,6 +293,7 @@ void PlatformNotificationContextImpl::
|
| if (displayed_notifications->count(it->notification_id)) {
|
| ++it;
|
| } else {
|
| + obsolete_notifications.push_back(it->notification_id);
|
| it = notification_datas.erase(it);
|
| }
|
| }
|
| @@ -301,6 +302,10 @@ void PlatformNotificationContextImpl::
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(callback, true /* success */, notification_datas));
|
| +
|
| + // Remove notifications that are not actually on display anymore.
|
| + for (const auto& it : obsolete_notifications)
|
| + database_->DeleteNotificationData(it, origin);
|
| return;
|
| }
|
|
|
|
|