| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler)); | 78 RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler)); |
| 79 channel->suspendIfNeeded(); | 79 channel->suspendIfNeeded(); |
| 80 | 80 |
| 81 return channel; | 81 return channel; |
| 82 } | 82 } |
| 83 | 83 |
| 84 RTCDataChannel::RTCDataChannel( | 84 RTCDataChannel::RTCDataChannel( |
| 85 ExecutionContext* context, | 85 ExecutionContext* context, |
| 86 std::unique_ptr<WebRTCDataChannelHandler> handler) | 86 std::unique_ptr<WebRTCDataChannelHandler> handler) |
| 87 : ActiveScriptWrappable(this), | 87 : ActiveScriptWrappable(this), |
| 88 ActiveDOMObject(context), | 88 SuspendableObject(context), |
| 89 m_handler(std::move(handler)), | 89 m_handler(std::move(handler)), |
| 90 m_readyState(ReadyStateConnecting), | 90 m_readyState(ReadyStateConnecting), |
| 91 m_binaryType(BinaryTypeArrayBuffer), | 91 m_binaryType(BinaryTypeArrayBuffer), |
| 92 m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired), | 92 m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired), |
| 93 m_bufferedAmountLowThreshold(0U), | 93 m_bufferedAmountLowThreshold(0U), |
| 94 m_stopped(false) { | 94 m_stopped(false) { |
| 95 ThreadState::current()->registerPreFinalizer(this); | 95 ThreadState::current()->registerPreFinalizer(this); |
| 96 m_handler->setClient(this); | 96 m_handler->setClient(this); |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 void RTCDataChannel::didDetectError() { | 290 void RTCDataChannel::didDetectError() { |
| 291 scheduleDispatchEvent(Event::create(EventTypeNames::error)); | 291 scheduleDispatchEvent(Event::create(EventTypeNames::error)); |
| 292 } | 292 } |
| 293 | 293 |
| 294 const AtomicString& RTCDataChannel::interfaceName() const { | 294 const AtomicString& RTCDataChannel::interfaceName() const { |
| 295 return EventTargetNames::RTCDataChannel; | 295 return EventTargetNames::RTCDataChannel; |
| 296 } | 296 } |
| 297 | 297 |
| 298 ExecutionContext* RTCDataChannel::getExecutionContext() const { | 298 ExecutionContext* RTCDataChannel::getExecutionContext() const { |
| 299 return ActiveDOMObject::getExecutionContext(); | 299 return SuspendableObject::getExecutionContext(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // ActiveDOMObject | 302 // SuspendableObject |
| 303 void RTCDataChannel::suspend() { | 303 void RTCDataChannel::suspend() { |
| 304 m_scheduledEventTimer.stop(); | 304 m_scheduledEventTimer.stop(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void RTCDataChannel::resume() { | 307 void RTCDataChannel::resume() { |
| 308 if (!m_scheduledEvents.isEmpty() && !m_scheduledEventTimer.isActive()) | 308 if (!m_scheduledEvents.isEmpty() && !m_scheduledEventTimer.isActive()) |
| 309 m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE); | 309 m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void RTCDataChannel::contextDestroyed() { | 312 void RTCDataChannel::contextDestroyed() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 HeapVector<Member<Event>>::iterator it = events.begin(); | 368 HeapVector<Member<Event>>::iterator it = events.begin(); |
| 369 for (; it != events.end(); ++it) | 369 for (; it != events.end(); ++it) |
| 370 dispatchEvent((*it).release()); | 370 dispatchEvent((*it).release()); |
| 371 | 371 |
| 372 events.clear(); | 372 events.clear(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 DEFINE_TRACE(RTCDataChannel) { | 375 DEFINE_TRACE(RTCDataChannel) { |
| 376 visitor->trace(m_scheduledEvents); | 376 visitor->trace(m_scheduledEvents); |
| 377 EventTargetWithInlineData::trace(visitor); | 377 EventTargetWithInlineData::trace(visitor); |
| 378 ActiveDOMObject::trace(visitor); | 378 SuspendableObject::trace(visitor); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace blink | 381 } // namespace blink |
| OLD | NEW |