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

Side by Side Diff: Source/modules/mediastream/RTCDataChannel.cpp

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 2 months 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 | Annotate | Revision Log
OLDNEW
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 void RTCDataChannel::stop() 272 void RTCDataChannel::stop()
273 { 273 {
274 m_stopped = true; 274 m_stopped = true;
275 m_readyState = ReadyStateClosed; 275 m_readyState = ReadyStateClosed;
276 m_handler->setClient(0); 276 m_handler->setClient(0);
277 m_scriptExecutionContext = 0; 277 m_scriptExecutionContext = 0;
278 } 278 }
279 279
280 EventTargetData* RTCDataChannel::eventTargetData()
281 {
282 return &m_eventTargetData;
283 }
284
285 EventTargetData* RTCDataChannel::ensureEventTargetData()
286 {
287 return &m_eventTargetData;
288 }
289
290 void RTCDataChannel::scheduleDispatchEvent(PassRefPtr<Event> event) 280 void RTCDataChannel::scheduleDispatchEvent(PassRefPtr<Event> event)
291 { 281 {
292 m_scheduledEvents.append(event); 282 m_scheduledEvents.append(event);
293 283
294 if (!m_scheduledEventTimer.isActive()) 284 if (!m_scheduledEventTimer.isActive())
295 m_scheduledEventTimer.startOneShot(0); 285 m_scheduledEventTimer.startOneShot(0);
296 } 286 }
297 287
298 void RTCDataChannel::scheduledEventTimerFired(Timer<RTCDataChannel>*) 288 void RTCDataChannel::scheduledEventTimerFired(Timer<RTCDataChannel>*)
299 { 289 {
300 if (m_stopped) 290 if (m_stopped)
301 return; 291 return;
302 292
303 Vector<RefPtr<Event> > events; 293 Vector<RefPtr<Event> > events;
304 events.swap(m_scheduledEvents); 294 events.swap(m_scheduledEvents);
305 295
306 Vector<RefPtr<Event> >::iterator it = events.begin(); 296 Vector<RefPtr<Event> >::iterator it = events.begin();
307 for (; it != events.end(); ++it) 297 for (; it != events.end(); ++it)
308 dispatchEvent((*it).release()); 298 dispatchEvent((*it).release());
309 299
310 events.clear(); 300 events.clear();
311 } 301 }
312 302
313 } // namespace WebCore 303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/RTCDataChannel.h ('k') | Source/modules/mediastream/RTCPeerConnection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698