| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 5 #ifndef CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
| 6 #define CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 6 #define CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Extracts port IDs for passing on to the browser process, and queues any | 49 // Extracts port IDs for passing on to the browser process, and queues any |
| 50 // received messages. Takes ownership of the passed array (and deletes it). | 50 // received messages. Takes ownership of the passed array (and deletes it). |
| 51 static std::vector<TransferredMessagePort> ExtractMessagePortIDs( | 51 static std::vector<TransferredMessagePort> ExtractMessagePortIDs( |
| 52 blink::WebMessagePortChannelArray* channels); | 52 blink::WebMessagePortChannelArray* channels); |
| 53 | 53 |
| 54 // Extracts port IDs for passing on to the browser process, and queues any | 54 // Extracts port IDs for passing on to the browser process, and queues any |
| 55 // received messages. | 55 // received messages. |
| 56 static std::vector<TransferredMessagePort> ExtractMessagePortIDs( | 56 static std::vector<TransferredMessagePort> ExtractMessagePortIDs( |
| 57 const blink::WebMessagePortChannelArray& channels); | 57 const blink::WebMessagePortChannelArray& channels); |
| 58 | 58 |
| 59 // Extracts port IDs for passing on to the browser process, but doesn't |
| 60 // send a separate IPC to the browser to initiate queueing messages. Instead |
| 61 // calling code is responsible for initiating the queueing in the browser |
| 62 // process. This is useful when transfering ports over an IPC channel that |
| 63 // does not share ordering guarentees with regular IPC. |
| 64 static std::vector<TransferredMessagePort> |
| 65 ExtractMessagePortIDsWithoutQueueing( |
| 66 scoped_ptr<blink::WebMessagePortChannelArray> channels); |
| 67 |
| 59 // Creates WebMessagePortChannelImpl instances for port IDs passed in from the | 68 // Creates WebMessagePortChannelImpl instances for port IDs passed in from the |
| 60 // browser process. | 69 // browser process. |
| 61 static blink::WebMessagePortChannelArray CreatePorts( | 70 static blink::WebMessagePortChannelArray CreatePorts( |
| 62 const std::vector<TransferredMessagePort>& message_ports, | 71 const std::vector<TransferredMessagePort>& message_ports, |
| 63 const std::vector<int>& new_routing_ids, | 72 const std::vector<int>& new_routing_ids, |
| 64 const scoped_refptr<base::SingleThreadTaskRunner>& | 73 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 65 main_thread_task_runner); | 74 main_thread_task_runner); |
| 66 | 75 |
| 67 // Queues received and incoming messages until there are no more in-flight | 76 // Queues received and incoming messages until there are no more in-flight |
| 68 // messages, then sends all of them to the browser process. | 77 // messages, then sends all of them to the browser process. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 bool send_messages_as_values_; | 128 bool send_messages_as_values_; |
| 120 bool is_stashed_; | 129 bool is_stashed_; |
| 121 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 130 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 122 | 131 |
| 123 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); | 132 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); |
| 124 }; | 133 }; |
| 125 | 134 |
| 126 } // namespace content | 135 } // namespace content |
| 127 | 136 |
| 128 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 137 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
| OLD | NEW |