| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track,
PassOwnPtr<WebRTCDTMFSenderHandler> handler) | 59 RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track,
PassOwnPtr<WebRTCDTMFSenderHandler> handler) |
| 60 : ActiveDOMObject(context) | 60 : ActiveDOMObject(context) |
| 61 , m_track(track) | 61 , m_track(track) |
| 62 , m_duration(defaultToneDurationMs) | 62 , m_duration(defaultToneDurationMs) |
| 63 , m_interToneGap(defaultInterToneGapMs) | 63 , m_interToneGap(defaultInterToneGapMs) |
| 64 , m_handler(handler) | 64 , m_handler(handler) |
| 65 , m_stopped(false) | 65 , m_stopped(false) |
| 66 , m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired) | 66 , m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired) |
| 67 { | 67 { |
| 68 ThreadState::current()->registerPreFinalizer(this); |
| 68 m_handler->setClient(this); | 69 m_handler->setClient(this); |
| 69 } | 70 } |
| 70 | 71 |
| 71 RTCDTMFSender::~RTCDTMFSender() | 72 RTCDTMFSender::~RTCDTMFSender() |
| 72 { | 73 { |
| 73 } | 74 } |
| 74 | 75 |
| 76 void RTCDTMFSender::dispose() |
| 77 { |
| 78 // Promptly clears a raw reference from content/ to an on-heap object |
| 79 // so that content/ doesn't access it in a lazy sweeping phase. |
| 80 m_handler->setClient(nullptr); |
| 81 m_handler.clear(); |
| 82 } |
| 83 |
| 75 bool RTCDTMFSender::canInsertDTMF() const | 84 bool RTCDTMFSender::canInsertDTMF() const |
| 76 { | 85 { |
| 77 return m_handler->canInsertDTMF(); | 86 return m_handler->canInsertDTMF(); |
| 78 } | 87 } |
| 79 | 88 |
| 80 MediaStreamTrack* RTCDTMFSender::track() const | 89 MediaStreamTrack* RTCDTMFSender::track() const |
| 81 { | 90 { |
| 82 return m_track.get(); | 91 return m_track.get(); |
| 83 } | 92 } |
| 84 | 93 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 141 } |
| 133 | 142 |
| 134 ExecutionContext* RTCDTMFSender::getExecutionContext() const | 143 ExecutionContext* RTCDTMFSender::getExecutionContext() const |
| 135 { | 144 { |
| 136 return ActiveDOMObject::getExecutionContext(); | 145 return ActiveDOMObject::getExecutionContext(); |
| 137 } | 146 } |
| 138 | 147 |
| 139 void RTCDTMFSender::stop() | 148 void RTCDTMFSender::stop() |
| 140 { | 149 { |
| 141 m_stopped = true; | 150 m_stopped = true; |
| 142 m_handler->setClient(0); | 151 m_handler->setClient(nullptr); |
| 143 } | 152 } |
| 144 | 153 |
| 145 void RTCDTMFSender::scheduleDispatchEvent(Event* event) | 154 void RTCDTMFSender::scheduleDispatchEvent(Event* event) |
| 146 { | 155 { |
| 147 m_scheduledEvents.append(event); | 156 m_scheduledEvents.append(event); |
| 148 | 157 |
| 149 if (!m_scheduledEventTimer.isActive()) | 158 if (!m_scheduledEventTimer.isActive()) |
| 150 m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE); | 159 m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE); |
| 151 } | 160 } |
| 152 | 161 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 165 | 174 |
| 166 DEFINE_TRACE(RTCDTMFSender) | 175 DEFINE_TRACE(RTCDTMFSender) |
| 167 { | 176 { |
| 168 visitor->trace(m_track); | 177 visitor->trace(m_track); |
| 169 visitor->trace(m_scheduledEvents); | 178 visitor->trace(m_scheduledEvents); |
| 170 RefCountedGarbageCollectedEventTargetWithInlineData<RTCDTMFSender>::trace(vi
sitor); | 179 RefCountedGarbageCollectedEventTargetWithInlineData<RTCDTMFSender>::trace(vi
sitor); |
| 171 ActiveDOMObject::trace(visitor); | 180 ActiveDOMObject::trace(visitor); |
| 172 } | 181 } |
| 173 | 182 |
| 174 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |