| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_WORKER_HOST_MESSAGE_PORT_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_WORKER_HOST_MESSAGE_PORT_DISPATCHER_H_ |
| 6 #define CHROME_BROWSER_WORKER_HOST_MESSAGE_PORT_DISPATCHER_H_ | 6 #define CHROME_BROWSER_WORKER_HOST_MESSAGE_PORT_DISPATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 const std::vector<int>& sent_message_port_ids); | 59 const std::vector<int>& sent_message_port_ids); |
| 60 void OnQueueMessages(int message_port_id); | 60 void OnQueueMessages(int message_port_id); |
| 61 void OnSendQueuedMessages(int message_port_id, | 61 void OnSendQueuedMessages(int message_port_id, |
| 62 const QueuedMessages& queued_messages); | 62 const QueuedMessages& queued_messages); |
| 63 | 63 |
| 64 void PostMessageTo(int message_port_id, | 64 void PostMessageTo(int message_port_id, |
| 65 const string16& message, | 65 const string16& message, |
| 66 const std::vector<int>& sent_message_port_ids); | 66 const std::vector<int>& sent_message_port_ids); |
| 67 | 67 |
| 68 // NotificationObserver interface. | 68 // NotificationObserver interface. |
| 69 void Observe(NotificationType type, | 69 virtual void Observe(NotificationType type, |
| 70 const NotificationSource& source, | 70 const NotificationSource& source, |
| 71 const NotificationDetails& details); | 71 const NotificationDetails& details); |
| 72 | 72 |
| 73 // Handles the details of removing a message port id. Before calling this, | 73 // Handles the details of removing a message port id. Before calling this, |
| 74 // verify that the message port id exists. | 74 // verify that the message port id exists. |
| 75 void Erase(int message_port_id); | 75 void Erase(int message_port_id); |
| 76 | 76 |
| 77 struct MessagePort; | 77 struct MessagePort; |
| 78 typedef std::map<int, MessagePort> MessagePorts; | 78 typedef std::map<int, MessagePort> MessagePorts; |
| 79 MessagePorts message_ports_; | 79 MessagePorts message_ports_; |
| 80 | 80 |
| 81 // We need globally unique identifiers for each message port. | 81 // We need globally unique identifiers for each message port. |
| 82 int next_message_port_id_; | 82 int next_message_port_id_; |
| 83 | 83 |
| 84 // Valid only during IPC message dispatching. | 84 // Valid only during IPC message dispatching. |
| 85 IPC::Message::Sender* sender_; | 85 IPC::Message::Sender* sender_; |
| 86 CallbackWithReturnValue<int>::Type* next_routing_id_; | 86 CallbackWithReturnValue<int>::Type* next_routing_id_; |
| 87 | 87 |
| 88 NotificationRegistrar registrar_; | 88 NotificationRegistrar registrar_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(MessagePortDispatcher); | 90 DISALLOW_COPY_AND_ASSIGN(MessagePortDispatcher); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 #endif // CHROME_BROWSER_WORKER_HOST_MESSAGE_PORT_DISPATCHER_H_ | 93 #endif // CHROME_BROWSER_WORKER_HOST_MESSAGE_PORT_DISPATCHER_H_ |
| OLD | NEW |