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

Unified Diff: Source/modules/mediastream/RTCPeerConnection.cpp

Issue 27571005: Replace Timers used in ActiveDOMObject with AsyncMethodRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/mediastream/RTCPeerConnection.cpp
diff --git a/Source/modules/mediastream/RTCPeerConnection.cpp b/Source/modules/mediastream/RTCPeerConnection.cpp
index 655531292fe0cb3daa097e3102ae6b5f20a867c1..6aeba4184d2c64f6c12afdcea69e3e269f43a6a0 100644
--- a/Source/modules/mediastream/RTCPeerConnection.cpp
+++ b/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -137,7 +137,7 @@ RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, PassRefPtr<RTCCo
, m_signalingState(SignalingStateStable)
, m_iceGatheringState(IceGatheringStateNew)
, m_iceConnectionState(IceConnectionStateNew)
- , m_scheduledEventTimer(this, &RTCPeerConnection::scheduledEventTimerFired)
+ , m_dispatchScheduledEventRunner(this, &RTCPeerConnection::dispatchScheduledEvent)
, m_stopped(false)
{
ScriptWrappable::init(this);
@@ -624,6 +624,16 @@ ExecutionContext* RTCPeerConnection::executionContext() const
return ActiveDOMObject::executionContext();
}
+void RTCPeerConnection::suspend()
+{
+ m_dispatchScheduledEventRunner.suspend();
+}
+
+void RTCPeerConnection::resume()
+{
+ m_dispatchScheduledEventRunner.resume();
+}
+
void RTCPeerConnection::stop()
{
if (m_stopped)
@@ -636,6 +646,8 @@ void RTCPeerConnection::stop()
Vector<RefPtr<RTCDataChannel> >::iterator i = m_dataChannels.begin();
for (; i != m_dataChannels.end(); ++i)
(*i)->stop();
+
+ m_dispatchScheduledEventRunner.stop();
}
void RTCPeerConnection::changeSignalingState(SignalingState signalingState)
@@ -663,11 +675,10 @@ void RTCPeerConnection::scheduleDispatchEvent(PassRefPtr<Event> event)
{
m_scheduledEvents.append(event);
- if (!m_scheduledEventTimer.isActive())
- m_scheduledEventTimer.startOneShot(0);
+ m_dispatchScheduledEventRunner.runAsync();
}
-void RTCPeerConnection::scheduledEventTimerFired(Timer<RTCPeerConnection>*)
+void RTCPeerConnection::dispatchScheduledEvent()
{
if (m_stopped)
return;

Powered by Google App Engine
This is Rietveld 408576698