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 #ifndef CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // associated with this message channel. | 39 // associated with this message channel. |
40 // See https://html.spec.whatwg.org/multipage/comms.html#messagechannel | 40 // See https://html.spec.whatwg.org/multipage/comms.html#messagechannel |
41 // Should be called on IO thread. | 41 // Should be called on IO thread. |
42 // The message ports that are created will have their routing id numbers equal | 42 // The message ports that are created will have their routing id numbers equal |
43 // to the message port numbers. | 43 // to the message port numbers. |
44 static void CreateMessageChannel(MessagePortDelegate* delegate, | 44 static void CreateMessageChannel(MessagePortDelegate* delegate, |
45 int* port1, | 45 int* port1, |
46 int* port2); | 46 int* port2); |
47 | 47 |
48 // Posts a MessageEvent to a message port associated with a message channel. | 48 // Posts a MessageEvent to a message port associated with a message channel. |
| 49 // Should be called on IO thread. |
49 static void PostMessageToPort( | 50 static void PostMessageToPort( |
50 int sender_port_id, | 51 int sender_port_id, |
51 const MessagePortMessage& message, | 52 const MessagePortMessage& message, |
52 const std::vector<TransferredMessagePort>& sent_ports); | 53 const std::vector<TransferredMessagePort>& sent_ports); |
53 | 54 |
54 // Close the message port. Should be called on IO thread. | 55 // Close the message port. Should be called on IO thread. |
55 static void ClosePort(int message_port_id); | 56 static void ClosePort(int message_port_id); |
56 | 57 |
57 // Queue up all the messages for this message port until ReleaseMessages | 58 // Queue up all the messages for this message port until ReleaseMessages |
58 // is called. Should be called on IO thread. | 59 // is called. Should be called on IO thread. |
59 static void HoldMessages(int message_port_id); | 60 static void HoldMessages(int message_port_id); |
60 | 61 |
61 // Release any queued messages as a result of HoldMessages. Should be | 62 // Release any queued messages as a result of HoldMessages. Should be |
62 // called on IO thread. | 63 // called on IO thread. |
63 static void ReleaseMessages(int message_port_id); | 64 static void ReleaseMessages(int message_port_id); |
64 | 65 |
65 // Cleanup the message ports that belong to the closing delegate. | 66 // Cleanup the message ports that belong to the closing delegate. |
| 67 // Should be called on IO thread. |
66 static void OnMessagePortDelegateClosing(MessagePortDelegate * delegate); | 68 static void OnMessagePortDelegateClosing(MessagePortDelegate * delegate); |
67 | 69 |
| 70 // Update message port information when the message port is transferred |
| 71 // from a different process. The updated message ports will have their |
| 72 // routing numbers equal to the message port numbers. |
| 73 // Should be called on IO thread. |
| 74 static void UpdateMessagePort(int message_port_id, |
| 75 MessagePortDelegate* delegate); |
| 76 |
68 private: | 77 private: |
69 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortProvider); | 78 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortProvider); |
70 }; | 79 }; |
71 | 80 |
72 } // namespace content | 81 } // namespace content |
73 | 82 |
74 #endif // CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_ | 83 #endif // CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_ |
OLD | NEW |