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

Unified Diff: content/browser/notifications/platform_notification_context_impl.h

Issue 2878443002: Address a race condition in displaying notifications
Patch Set: Address a race condition in displaying notifications Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/notifications/platform_notification_context_impl.h
diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h
index 67405dc0de6d0ac82e449dce2ff6cdd5c10399d4..97709f47062b17b8d1c217ff01ee496b609cdc6e 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -9,6 +9,7 @@
#include <memory>
#include <set>
#include <string>
+#include <utility>
#include <vector>
#include "base/callback.h"
@@ -16,6 +17,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
#include "content/browser/notifications/notification_id_generator.h"
#include "content/browser/service_worker/service_worker_context_observer.h"
#include "content/common/content_export.h"
@@ -26,6 +28,7 @@
class GURL;
namespace base {
+class Clock;
class SequencedTaskRunner;
}
@@ -207,6 +210,12 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
NotificationIdGenerator notification_id_generator_;
+ std::unique_ptr<base::Clock> clock_;
+
+ // Stores the recently displayed notification ids together with the time at
+ // which they were displayed.
+ std::map<std::string, base::Time> recent_notifications_;
+
// Indicates whether the database should be pruned when it's opened.
bool prune_database_on_open_ = false;

Powered by Google App Engine
This is Rietveld 408576698