| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const std::vector<TransferredMessagePort>& message_ports, | 62 const std::vector<TransferredMessagePort>& message_ports, |
| 63 const std::vector<int>& new_routing_ids, | 63 const std::vector<int>& new_routing_ids, |
| 64 const scoped_refptr<base::SingleThreadTaskRunner>& | 64 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 65 main_thread_task_runner); | 65 main_thread_task_runner); |
| 66 | 66 |
| 67 // Queues received and incoming messages until there are no more in-flight | 67 // Queues received and incoming messages until there are no more in-flight |
| 68 // messages, then sends all of them to the browser process. | 68 // messages, then sends all of them to the browser process. |
| 69 void QueueMessages(); | 69 void QueueMessages(); |
| 70 int message_port_id() const { return message_port_id_; } | 70 int message_port_id() const { return message_port_id_; } |
| 71 | 71 |
| 72 void set_is_stashed() { is_stashed_ = true; } |
| 73 |
| 72 private: | 74 private: |
| 73 friend class base::RefCountedThreadSafe<WebMessagePortChannelImpl>; | 75 friend class base::RefCountedThreadSafe<WebMessagePortChannelImpl>; |
| 74 ~WebMessagePortChannelImpl() override; | 76 ~WebMessagePortChannelImpl() override; |
| 75 | 77 |
| 76 // WebMessagePortChannel implementation. | 78 // WebMessagePortChannel implementation. |
| 77 virtual void setClient(blink::WebMessagePortChannelClient* client); | 79 virtual void setClient(blink::WebMessagePortChannelClient* client); |
| 78 virtual void destroy(); | 80 virtual void destroy(); |
| 79 virtual void postMessage(const blink::WebString& message, | 81 virtual void postMessage(const blink::WebString& message, |
| 80 blink::WebMessagePortChannelArray* channels); | 82 blink::WebMessagePortChannelArray* channels); |
| 81 virtual bool tryGetMessage(blink::WebString* message, | 83 virtual bool tryGetMessage(blink::WebString* message, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 108 | 110 |
| 109 blink::WebMessagePortChannelClient* client_; | 111 blink::WebMessagePortChannelClient* client_; |
| 110 base::Lock lock_; // Locks access to above. | 112 base::Lock lock_; // Locks access to above. |
| 111 | 113 |
| 112 int route_id_; // The routing id for this object. | 114 int route_id_; // The routing id for this object. |
| 113 int message_port_id_; // A globally unique identifier for this message port. | 115 int message_port_id_; // A globally unique identifier for this message port. |
| 114 // Flag to indicate if messages should be sent to the browser process as | 116 // Flag to indicate if messages should be sent to the browser process as |
| 115 // base::Value instances as opposed to being serialized using the default | 117 // base::Value instances as opposed to being serialized using the default |
| 116 // blink::WebSerializedScriptValue. | 118 // blink::WebSerializedScriptValue. |
| 117 bool send_messages_as_values_; | 119 bool send_messages_as_values_; |
| 120 bool is_stashed_; |
| 118 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 121 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 119 | 122 |
| 120 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); | 123 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 } // namespace content | 126 } // namespace content |
| 124 | 127 |
| 125 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 128 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
| OLD | NEW |