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

Unified Diff: content/child/notifications/notification_dispatcher.h

Issue 644643005: Implement a RenderFrame-less path for Web Notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add OWNERS file Created 6 years, 2 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
« no previous file with comments | « content/child/notifications/OWNERS ('k') | content/child/notifications/notification_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/notifications/notification_dispatcher.h
diff --git a/content/child/notifications/notification_dispatcher.h b/content/child/notifications/notification_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..be4ada94f243663d53ef554efa64c2af0ae3f0c8
--- /dev/null
+++ b/content/child/notifications/notification_dispatcher.h
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_DISPATCHER_H_
+#define CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_DISPATCHER_H_
+
+#include <map>
+
+#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
+#include "content/child/child_message_filter.h"
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace content {
+
+class ThreadSafeSender;
+
+class NotificationDispatcher : public ChildMessageFilter {
+ public:
+ explicit NotificationDispatcher(ThreadSafeSender* thread_safe_sender);
+
+ // Generates a, process-unique new notification Id mapped to |thread_id|, and
+ // return the notification Id. This method can be called on any thread.
+ int GenerateNotificationId(int thread_id);
+
+ protected:
+ ~NotificationDispatcher() override;
+
+ private:
+ bool ShouldHandleMessage(const IPC::Message& msg);
+
+ // ChildMessageFilter implementation.
+ base::TaskRunner* OverrideTaskRunnerForMessage(const IPC::Message& msg)
+ override;
+ bool OnMessageReceived(const IPC::Message& msg) override;
+
+ scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
+ scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+
+ using NotificationIdToThreadId = std::map<int, int>;
+
+ base::Lock notification_id_map_lock_;
+ NotificationIdToThreadId notification_id_map_;
+ int next_notification_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationDispatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_DISPATCHER_H_
« no previous file with comments | « content/child/notifications/OWNERS ('k') | content/child/notifications/notification_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698