| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/notifications/notification_dispatcher.h" | 5 #include "content/child/notifications/notification_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "content/child/notifications/notification_manager.h" | 8 #include "content/child/notifications/notification_manager.h" |
| 9 #include "content/child/thread_safe_sender.h" | 9 #include "content/child/thread_safe_sender.h" |
| 10 #include "content/child/worker_thread_task_runner.h" | 10 #include "content/child/worker_thread_task_runner.h" |
| 11 #include "content/common/platform_notification_messages.h" | 11 #include "content/common/platform_notification_messages.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 NotificationDispatcher::NotificationDispatcher( | 15 NotificationDispatcher::NotificationDispatcher( |
| 16 ThreadSafeSender* thread_safe_sender) | 16 ThreadSafeSender* thread_safe_sender) |
| 17 : main_thread_loop_proxy_(base::MessageLoopProxy::current()), | 17 : main_thread_loop_proxy_(base::MessageLoopProxy::current()), |
| 18 thread_safe_sender_(thread_safe_sender) { | 18 thread_safe_sender_(thread_safe_sender), |
| 19 next_notification_id_(0) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 NotificationDispatcher::~NotificationDispatcher() {} | 22 NotificationDispatcher::~NotificationDispatcher() {} |
| 22 | 23 |
| 23 int NotificationDispatcher::GenerateNotificationId(int thread_id) { | 24 int NotificationDispatcher::GenerateNotificationId(int thread_id) { |
| 24 base::AutoLock lock(notification_id_map_lock_); | 25 base::AutoLock lock(notification_id_map_lock_); |
| 25 notification_id_map_[next_notification_id_] = thread_id; | 26 notification_id_map_[next_notification_id_] = thread_id; |
| 26 return next_notification_id_++; | 27 return next_notification_id_++; |
| 27 } | 28 } |
| 28 | 29 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 64 |
| 64 bool NotificationDispatcher::ShouldHandleMessage(const IPC::Message& msg) { | 65 bool NotificationDispatcher::ShouldHandleMessage(const IPC::Message& msg) { |
| 65 // The thread-safe message filter is responsible for handling all the messages | 66 // The thread-safe message filter is responsible for handling all the messages |
| 66 // except for the routed permission-request-completed message, which will be | 67 // except for the routed permission-request-completed message, which will be |
| 67 // picked up by the RenderFrameImpl instead. | 68 // picked up by the RenderFrameImpl instead. |
| 68 return IPC_MESSAGE_CLASS(msg) == PlatformNotificationMsgStart && | 69 return IPC_MESSAGE_CLASS(msg) == PlatformNotificationMsgStart && |
| 69 msg.type() != PlatformNotificationMsg_PermissionRequestComplete::ID; | 70 msg.type() != PlatformNotificationMsg_PermissionRequestComplete::ID; |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace content | 73 } // namespace content |
| OLD | NEW |