| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 break; | 346 break; |
| 347 } | 347 } |
| 348 | 348 |
| 349 if (hasValidListeners) | 349 if (hasValidListeners) |
| 350 return true; | 350 return true; |
| 351 | 351 |
| 352 return m_readyState != ReadyStateClosed && bufferedAmount() > 0; | 352 return m_readyState != ReadyStateClosed && bufferedAmount() > 0; |
| 353 } | 353 } |
| 354 | 354 |
| 355 void RTCDataChannel::scheduleDispatchEvent(Event* event) { | 355 void RTCDataChannel::scheduleDispatchEvent(Event* event) { |
| 356 m_scheduledEvents.append(event); | 356 m_scheduledEvents.push_back(event); |
| 357 | 357 |
| 358 if (!m_scheduledEventTimer.isActive()) | 358 if (!m_scheduledEventTimer.isActive()) |
| 359 m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE); | 359 m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void RTCDataChannel::scheduledEventTimerFired(TimerBase*) { | 362 void RTCDataChannel::scheduledEventTimerFired(TimerBase*) { |
| 363 HeapVector<Member<Event>> events; | 363 HeapVector<Member<Event>> events; |
| 364 events.swap(m_scheduledEvents); | 364 events.swap(m_scheduledEvents); |
| 365 | 365 |
| 366 HeapVector<Member<Event>>::iterator it = events.begin(); | 366 HeapVector<Member<Event>>::iterator it = events.begin(); |
| 367 for (; it != events.end(); ++it) | 367 for (; it != events.end(); ++it) |
| 368 dispatchEvent((*it).release()); | 368 dispatchEvent((*it).release()); |
| 369 | 369 |
| 370 events.clear(); | 370 events.clear(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 DEFINE_TRACE(RTCDataChannel) { | 373 DEFINE_TRACE(RTCDataChannel) { |
| 374 visitor->trace(m_scheduledEvents); | 374 visitor->trace(m_scheduledEvents); |
| 375 EventTargetWithInlineData::trace(visitor); | 375 EventTargetWithInlineData::trace(visitor); |
| 376 SuspendableObject::trace(visitor); | 376 SuspendableObject::trace(visitor); |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace blink | 379 } // namespace blink |
| OLD | NEW |