| Index: third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
|
| diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
|
| index e0101c9769e82c8047a95be27f8f2ad0e9bba938..b3436128d240ee773e1b44cb97d491be7122233d 100644
|
| --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
|
| +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
|
| @@ -75,13 +75,20 @@ RTCDataChannel::RTCDataChannel(ExecutionContext* context, PassOwnPtr<WebRTCDataC
|
| , m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired)
|
| , m_bufferedAmountLowThreshold(0U)
|
| {
|
| + ThreadState::current()->registerPreFinalizer(this);
|
| m_handler->setClient(this);
|
| }
|
|
|
| RTCDataChannel::~RTCDataChannel()
|
| {
|
| - // Notify the client that the channel is gone.
|
| - m_handler->setClient(0);
|
| +}
|
| +
|
| +void RTCDataChannel::dispose()
|
| +{
|
| + // Promptly clears a raw reference from content/ to an on-heap object
|
| + // so that content/ doesn't access it in a lazy sweeping phase.
|
| + m_handler->setClient(nullptr);
|
| + m_handler.clear();
|
| }
|
|
|
| RTCDataChannel::ReadyState RTCDataChannel::getHandlerState() const
|
|
|