| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ |
| 6 #define CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ | 6 #define CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Closes and cleans up the message port. | 70 // Closes and cleans up the message port. |
| 71 void ClosePort(int message_port_id); | 71 void ClosePort(int message_port_id); |
| 72 | 72 |
| 73 void OnMessagePortDelegateClosing(MessagePortDelegate* filter); | 73 void OnMessagePortDelegateClosing(MessagePortDelegate* filter); |
| 74 | 74 |
| 75 // Attempts to send the queued messages for a message port. | 75 // Attempts to send the queued messages for a message port. |
| 76 void SendQueuedMessagesIfPossible(int message_port_id); | 76 void SendQueuedMessagesIfPossible(int message_port_id); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 friend struct DefaultSingletonTraits<MessagePortService>; | 79 friend struct base::DefaultSingletonTraits<MessagePortService>; |
| 80 | 80 |
| 81 MessagePortService(); | 81 MessagePortService(); |
| 82 ~MessagePortService(); | 82 ~MessagePortService(); |
| 83 | 83 |
| 84 void PostMessageTo( | 84 void PostMessageTo( |
| 85 int message_port_id, | 85 int message_port_id, |
| 86 const MessagePortMessage& message, | 86 const MessagePortMessage& message, |
| 87 const std::vector<TransferredMessagePort>& sent_message_ports); | 87 const std::vector<TransferredMessagePort>& sent_message_ports); |
| 88 | 88 |
| 89 // Handles the details of removing a message port id. Before calling this, | 89 // Handles the details of removing a message port id. Before calling this, |
| 90 // verify that the message port id exists. | 90 // verify that the message port id exists. |
| 91 void Erase(int message_port_id); | 91 void Erase(int message_port_id); |
| 92 | 92 |
| 93 struct MessagePort; | 93 struct MessagePort; |
| 94 typedef std::map<int, MessagePort> MessagePorts; | 94 typedef std::map<int, MessagePort> MessagePorts; |
| 95 MessagePorts message_ports_; | 95 MessagePorts message_ports_; |
| 96 | 96 |
| 97 // We need globally unique identifiers for each message port. | 97 // We need globally unique identifiers for each message port. |
| 98 int next_message_port_id_; | 98 int next_message_port_id_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(MessagePortService); | 100 DISALLOW_COPY_AND_ASSIGN(MessagePortService); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } // namespace content | 103 } // namespace content |
| 104 | 104 |
| 105 #endif // CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ | 105 #endif // CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ |
| OLD | NEW |