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

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

Issue 2444103002: Broadcast Channel: Avoid poking at the heap after Blink shutdown (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return; 67 return;
68 68
69 Vector<char> data; 69 Vector<char> data;
70 value->toWireBytes(data); 70 value->toWireBytes(data);
71 Vector<uint8_t> mojoData; 71 Vector<uint8_t> mojoData;
72 mojoData.appendVector(data); 72 mojoData.appendVector(data);
73 m_remoteClient->OnMessage(std::move(mojoData)); 73 m_remoteClient->OnMessage(std::move(mojoData));
74 } 74 }
75 75
76 void BroadcastChannel::close() { 76 void BroadcastChannel::close() {
77 if (!Platform::current()) {
78 // TODO(rockot): Remove this hack once renderer shutdown sequence is fixed.
79 // Note that reaching this code indicates that the MessageLoop has already
80 // been torn down, so it's impossible for further incoming messages to be
81 // dispatched on |m_binding| or reply callbacks to be invoked from
82 // |m_remoteClient|.
83 return;
84 }
77 m_remoteClient.reset(); 85 m_remoteClient.reset();
78 if (m_binding.is_bound()) 86 if (m_binding.is_bound())
79 m_binding.Close(); 87 m_binding.Close();
80 } 88 }
81 89
82 const AtomicString& BroadcastChannel::interfaceName() const { 90 const AtomicString& BroadcastChannel::interfaceName() const {
83 return EventTargetNames::BroadcastChannel; 91 return EventTargetNames::BroadcastChannel;
84 } 92 }
85 93
86 bool BroadcastChannel::hasPendingActivity() const { 94 bool BroadcastChannel::hasPendingActivity() const {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 &remoteCientRequest); 150 &remoteCientRequest);
143 m_remoteClient.Bind(std::move(remoteClientInfo)); 151 m_remoteClient.Bind(std::move(remoteClientInfo));
144 m_remoteClient.set_connection_error_handler(convertToBaseCallback( 152 m_remoteClient.set_connection_error_handler(convertToBaseCallback(
145 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this)))); 153 WTF::bind(&BroadcastChannel::onError, wrapWeakPersistent(this))));
146 154
147 provider->ConnectToChannel(m_origin, m_name, std::move(localClientInfo), 155 provider->ConnectToChannel(m_origin, m_name, std::move(localClientInfo),
148 std::move(remoteCientRequest)); 156 std::move(remoteCientRequest));
149 } 157 }
150 158
151 } // namespace blink 159 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698