Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp

Issue 2570463005: Retire ThreadState::registerPreFinalizer<T>() (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 close(); 123 close();
124 } 124 }
125 125
126 BroadcastChannel::BroadcastChannel(ExecutionContext* executionContext, 126 BroadcastChannel::BroadcastChannel(ExecutionContext* executionContext,
127 const String& name) 127 const String& name)
128 : ActiveScriptWrappable(this), 128 : ActiveScriptWrappable(this),
129 ContextLifecycleObserver(executionContext), 129 ContextLifecycleObserver(executionContext),
130 m_origin(executionContext->getSecurityOrigin()), 130 m_origin(executionContext->getSecurityOrigin()),
131 m_name(name), 131 m_name(name),
132 m_binding(this) { 132 m_binding(this) {
133 ThreadState::current()->registerPreFinalizer(this);
134
135 mojom::blink::BroadcastChannelProviderPtr& provider = 133 mojom::blink::BroadcastChannelProviderPtr& provider =
136 getThreadSpecificProvider(); 134 getThreadSpecificProvider();
137 135
138 // Local BroadcastChannelClient for messages send from the browser to this 136 // Local BroadcastChannelClient for messages send from the browser to this
139 // channel. 137 // channel.
140 mojom::blink::BroadcastChannelClientAssociatedPtrInfo localClientInfo; 138 mojom::blink::BroadcastChannelClientAssociatedPtrInfo localClientInfo;
141 m_binding.Bind(&localClientInfo, provider.associated_group()); 139 m_binding.Bind(&localClientInfo, provider.associated_group());
142 m_binding.set_connection_error_handler(convertToBaseCallback( 140 m_binding.set_connection_error_handler(convertToBaseCallback(
143 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); 141 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this))));
144 142
145 // Remote BroadcastChannelClient for messages send from this channel to the 143 // Remote BroadcastChannelClient for messages send from this channel to the
146 // browser. 144 // browser.
147 mojom::blink::BroadcastChannelClientAssociatedPtrInfo remoteClientInfo; 145 mojom::blink::BroadcastChannelClientAssociatedPtrInfo remoteClientInfo;
148 mojo::AssociatedInterfaceRequest<mojom::blink::BroadcastChannelClient> 146 mojo::AssociatedInterfaceRequest<mojom::blink::BroadcastChannelClient>
149 remoteCientRequest; 147 remoteCientRequest;
150 provider.associated_group()->CreateAssociatedInterface( 148 provider.associated_group()->CreateAssociatedInterface(
151 mojo::AssociatedGroup::WILL_PASS_REQUEST, &remoteClientInfo, 149 mojo::AssociatedGroup::WILL_PASS_REQUEST, &remoteClientInfo,
152 &remoteCientRequest); 150 &remoteCientRequest);
153 m_remoteClient.Bind(std::move(remoteClientInfo)); 151 m_remoteClient.Bind(std::move(remoteClientInfo));
154 m_remoteClient.set_connection_error_handler(convertToBaseCallback( 152 m_remoteClient.set_connection_error_handler(convertToBaseCallback(
155 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); 153 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this))));
156 154
157 provider->ConnectToChannel(m_origin, m_name, std::move(localClientInfo), 155 provider->ConnectToChannel(m_origin, m_name, std::move(localClientInfo),
158 std::move(remoteCientRequest)); 156 std::move(remoteCientRequest));
159 } 157 }
160 158
161 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698