OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "modules/broadcastchannel/BroadcastChannel.h" | 5 #include "modules/broadcastchannel/BroadcastChannel.h" |
6 | 6 |
7 #include "bindings/core/v8/SerializedScriptValue.h" | 7 #include "bindings/core/v8/SerializedScriptValue.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/events/EventQueue.h" | 9 #include "core/events/EventQueue.h" |
10 #include "core/events/MessageEvent.h" | 10 #include "core/events/MessageEvent.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 : ContextLifecycleObserver(executionContext), | 120 : ContextLifecycleObserver(executionContext), |
121 m_origin(executionContext->getSecurityOrigin()), | 121 m_origin(executionContext->getSecurityOrigin()), |
122 m_name(name), | 122 m_name(name), |
123 m_binding(this) { | 123 m_binding(this) { |
124 mojom::blink::BroadcastChannelProviderPtr& provider = | 124 mojom::blink::BroadcastChannelProviderPtr& provider = |
125 getThreadSpecificProvider(); | 125 getThreadSpecificProvider(); |
126 | 126 |
127 // Local BroadcastChannelClient for messages send from the browser to this | 127 // Local BroadcastChannelClient for messages send from the browser to this |
128 // channel. | 128 // channel. |
129 mojom::blink::BroadcastChannelClientAssociatedPtrInfo localClientInfo; | 129 mojom::blink::BroadcastChannelClientAssociatedPtrInfo localClientInfo; |
130 m_binding.Bind(&localClientInfo, provider.associated_group()); | 130 m_binding.Bind(&localClientInfo); |
131 m_binding.set_connection_error_handler(convertToBaseCallback( | 131 m_binding.set_connection_error_handler(convertToBaseCallback( |
132 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); | 132 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); |
133 | 133 |
134 // Remote BroadcastChannelClient for messages send from this channel to the | 134 // Remote BroadcastChannelClient for messages send from this channel to the |
135 // browser. | 135 // browser. |
136 mojom::blink::BroadcastChannelClientAssociatedPtrInfo remoteClientInfo; | 136 auto remoteCientRequest = mojo::MakeRequest(&m_remoteClient); |
137 mojo::AssociatedInterfaceRequest<mojom::blink::BroadcastChannelClient> | |
138 remoteCientRequest; | |
139 provider.associated_group()->CreateAssociatedInterface( | |
140 mojo::AssociatedGroup::WILL_PASS_REQUEST, &remoteClientInfo, | |
141 &remoteCientRequest); | |
142 m_remoteClient.Bind(std::move(remoteClientInfo)); | |
143 m_remoteClient.set_connection_error_handler(convertToBaseCallback( | 137 m_remoteClient.set_connection_error_handler(convertToBaseCallback( |
144 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); | 138 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); |
145 | 139 |
146 provider->ConnectToChannel(m_origin, m_name, std::move(localClientInfo), | 140 provider->ConnectToChannel(m_origin, m_name, std::move(localClientInfo), |
147 std::move(remoteCientRequest)); | 141 std::move(remoteCientRequest)); |
148 } | 142 } |
149 | 143 |
150 } // namespace blink | 144 } // namespace blink |
OLD | NEW |