| Index: Source/modules/mediastream/RTCPeerConnection.cpp
 | 
| diff --git a/Source/modules/mediastream/RTCPeerConnection.cpp b/Source/modules/mediastream/RTCPeerConnection.cpp
 | 
| index dc48f27011337df4ac91c840b9776f8d976c5e43..f97318529df00d9cd070ff6bc00cd9f7de916841 100644
 | 
| --- a/Source/modules/mediastream/RTCPeerConnection.cpp
 | 
| +++ b/Source/modules/mediastream/RTCPeerConnection.cpp
 | 
| @@ -69,6 +69,8 @@
 | 
|  
 | 
|  namespace WebCore {
 | 
|  
 | 
| +DEFINE_GC_INFO(RTCPeerConnection);
 | 
| +
 | 
|  namespace {
 | 
|  
 | 
|  static bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState state, ExceptionState& exceptionState)
 | 
| @@ -157,7 +159,7 @@ PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction
 | 
|      return rtcConfiguration.release();
 | 
|  }
 | 
|  
 | 
| -PassRefPtr<RTCPeerConnection> RTCPeerConnection::create(ExecutionContext* context, const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
 | 
| +PassRefPtrWillBeRawPtr<RTCPeerConnection> RTCPeerConnection::create(ExecutionContext* context, const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
 | 
|  {
 | 
|      RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration, exceptionState);
 | 
|      if (exceptionState.hadException())
 | 
| @@ -167,7 +169,7 @@ PassRefPtr<RTCPeerConnection> RTCPeerConnection::create(ExecutionContext* contex
 | 
|      if (exceptionState.hadException())
 | 
|          return 0;
 | 
|  
 | 
| -    RefPtr<RTCPeerConnection> peerConnection = adoptRef(new RTCPeerConnection(context, configuration.release(), constraints, exceptionState));
 | 
| +    RefPtrWillBeRawPtr<RTCPeerConnection> peerConnection = adoptRefCountedWillBeRefCountedGarbageCollected(new RTCPeerConnection(context, configuration.release(), constraints, exceptionState));
 | 
|      peerConnection->suspendIfNeeded();
 | 
|      if (exceptionState.hadException())
 | 
|          return 0;
 | 
| @@ -246,12 +248,12 @@ void RTCPeerConnection::createAnswer(PassOwnPtr<RTCSessionDescriptionCallback> s
 | 
|      m_peerHandler->createAnswer(request.release(), constraints);
 | 
|  }
 | 
|  
 | 
| -void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
 | 
| +void RTCPeerConnection::setLocalDescription(PassRefPtrWillBeRawPtr<RTCSessionDescription> prpSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
 | 
|  {
 | 
|      if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
 | 
|          return;
 | 
|  
 | 
| -    RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription;
 | 
| +    RefPtrWillBeRawPtr<RTCSessionDescription> sessionDescription = prpSessionDescription;
 | 
|      if (!sessionDescription) {
 | 
|          exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType("session description", "RTCSessionDescription"));
 | 
|          return;
 | 
| @@ -261,22 +263,22 @@ void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> pr
 | 
|      m_peerHandler->setLocalDescription(request.release(), sessionDescription->webSessionDescription());
 | 
|  }
 | 
|  
 | 
| -PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionState& exceptionState)
 | 
| +PassRefPtrWillBeRawPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionState& exceptionState)
 | 
|  {
 | 
|      blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescription();
 | 
|      if (webSessionDescription.isNull())
 | 
|          return 0;
 | 
|  
 | 
| -    RefPtr<RTCSessionDescription> sessionDescription = RTCSessionDescription::create(webSessionDescription);
 | 
| +    RefPtrWillBeRawPtr<RTCSessionDescription> sessionDescription = RTCSessionDescription::create(webSessionDescription);
 | 
|      return sessionDescription.release();
 | 
|  }
 | 
|  
 | 
| -void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
 | 
| +void RTCPeerConnection::setRemoteDescription(PassRefPtrWillBeRawPtr<RTCSessionDescription> prpSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, ExceptionState& exceptionState)
 | 
|  {
 | 
|      if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
 | 
|          return;
 | 
|  
 | 
| -    RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription;
 | 
| +    RefPtrWillBeRawPtr<RTCSessionDescription> sessionDescription = prpSessionDescription;
 | 
|      if (!sessionDescription) {
 | 
|          exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType("session description", "RTCSessionDescription"));
 | 
|          return;
 | 
| @@ -286,13 +288,13 @@ void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> p
 | 
|      m_peerHandler->setRemoteDescription(request.release(), sessionDescription->webSessionDescription());
 | 
|  }
 | 
|  
 | 
| -PassRefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(ExceptionState& exceptionState)
 | 
| +PassRefPtrWillBeRawPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription(ExceptionState& exceptionState)
 | 
|  {
 | 
|      blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescription();
 | 
|      if (webSessionDescription.isNull())
 | 
|          return 0;
 | 
|  
 | 
| -    RefPtr<RTCSessionDescription> desc = RTCSessionDescription::create(webSessionDescription);
 | 
| +    RefPtrWillBeRawPtr<RTCSessionDescription> desc = RTCSessionDescription::create(webSessionDescription);
 | 
|      return desc.release();
 | 
|  }
 | 
|  
 | 
| @@ -413,12 +415,12 @@ String RTCPeerConnection::iceConnectionState() const
 | 
|      return String();
 | 
|  }
 | 
|  
 | 
| -void RTCPeerConnection::addStream(PassRefPtr<MediaStream> prpStream, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
 | 
| +void RTCPeerConnection::addStream(PassRefPtrWillBeRawPtr<MediaStream> prpStream, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
 | 
|  {
 | 
|      if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
 | 
|          return;
 | 
|  
 | 
| -    RefPtr<MediaStream> stream = prpStream;
 | 
| +    RefPtrWillBeRawPtr<MediaStream> stream = prpStream;
 | 
|      if (!stream) {
 | 
|          exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType("stream", "MediaStream"));
 | 
|          return;
 | 
| @@ -438,7 +440,7 @@ void RTCPeerConnection::addStream(PassRefPtr<MediaStream> prpStream, const Dicti
 | 
|          exceptionState.throwDOMException(SyntaxError, "Unable to add the provided stream.");
 | 
|  }
 | 
|  
 | 
| -void RTCPeerConnection::removeStream(PassRefPtr<MediaStream> prpStream, ExceptionState& exceptionState)
 | 
| +void RTCPeerConnection::removeStream(PassRefPtrWillBeRawPtr<MediaStream> prpStream, ExceptionState& exceptionState)
 | 
|  {
 | 
|      if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
 | 
|          return;
 | 
| @@ -448,7 +450,7 @@ void RTCPeerConnection::removeStream(PassRefPtr<MediaStream> prpStream, Exceptio
 | 
|          return;
 | 
|      }
 | 
|  
 | 
| -    RefPtr<MediaStream> stream = prpStream;
 | 
| +    RefPtrWillBeRawPtr<MediaStream> stream = prpStream;
 | 
|  
 | 
|      size_t pos = m_localStreams.find(stream);
 | 
|      if (pos == kNotFound)
 | 
| @@ -491,7 +493,7 @@ void RTCPeerConnection::getStats(PassOwnPtr<RTCStatsCallback> successCallback, P
 | 
|      m_peerHandler->getStats(statsRequest.release());
 | 
|  }
 | 
|  
 | 
| -PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, const Dictionary& options, ExceptionState& exceptionState)
 | 
| +PassRefPtrWillBeRawPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, const Dictionary& options, ExceptionState& exceptionState)
 | 
|  {
 | 
|      if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
 | 
|          return 0;
 | 
| @@ -512,7 +514,7 @@ PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, co
 | 
|      options.get("protocol", protocolString);
 | 
|      init.protocol = protocolString;
 | 
|  
 | 
| -    RefPtr<RTCDataChannel> channel = RTCDataChannel::create(executionContext(), m_peerHandler.get(), label, init, exceptionState);
 | 
| +    RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executionContext(), m_peerHandler.get(), label, init, exceptionState);
 | 
|      if (exceptionState.hadException())
 | 
|          return 0;
 | 
|      m_dataChannels.append(channel);
 | 
| @@ -528,7 +530,7 @@ bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId)
 | 
|      return false;
 | 
|  }
 | 
|  
 | 
| -PassRefPtr<RTCDTMFSender> RTCPeerConnection::createDTMFSender(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionState& exceptionState)
 | 
| +PassRefPtrWillBeRawPtr<RTCDTMFSender> RTCPeerConnection::createDTMFSender(PassRefPtrWillBeRawPtr<MediaStreamTrack> prpTrack, ExceptionState& exceptionState)
 | 
|  {
 | 
|      if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
 | 
|          return 0;
 | 
| @@ -538,14 +540,14 @@ PassRefPtr<RTCDTMFSender> RTCPeerConnection::createDTMFSender(PassRefPtr<MediaSt
 | 
|          return 0;
 | 
|      }
 | 
|  
 | 
| -    RefPtr<MediaStreamTrack> track = prpTrack;
 | 
| +    RefPtrWillBeRawPtr<MediaStreamTrack> track = prpTrack;
 | 
|  
 | 
|      if (!hasLocalStreamWithTrackId(track->id())) {
 | 
|          exceptionState.throwDOMException(SyntaxError, "No local stream is available for the track provided.");
 | 
|          return 0;
 | 
|      }
 | 
|  
 | 
| -    RefPtr<RTCDTMFSender> dtmfSender = RTCDTMFSender::create(executionContext(), m_peerHandler.get(), track.release(), exceptionState);
 | 
| +    RefPtrWillBeRawPtr<RTCDTMFSender> dtmfSender = RTCDTMFSender::create(executionContext(), m_peerHandler.get(), track.release(), exceptionState);
 | 
|      if (exceptionState.hadException())
 | 
|          return 0;
 | 
|      return dtmfSender.release();
 | 
| @@ -574,7 +576,7 @@ void RTCPeerConnection::didGenerateICECandidate(const blink::WebRTCICECandidate&
 | 
|      if (webCandidate.isNull())
 | 
|          scheduleDispatchEvent(RTCIceCandidateEvent::create(false, false, 0));
 | 
|      else {
 | 
| -        RefPtr<RTCIceCandidate> iceCandidate = RTCIceCandidate::create(webCandidate);
 | 
| +        RefPtrWillBeRawPtr<RTCIceCandidate> iceCandidate = RTCIceCandidate::create(webCandidate);
 | 
|          scheduleDispatchEvent(RTCIceCandidateEvent::create(false, false, iceCandidate.release()));
 | 
|      }
 | 
|  }
 | 
| @@ -604,7 +606,7 @@ void RTCPeerConnection::didAddRemoteStream(const blink::WebMediaStream& remoteSt
 | 
|      if (m_signalingState == SignalingStateClosed)
 | 
|          return;
 | 
|  
 | 
| -    RefPtr<MediaStream> stream = MediaStream::create(executionContext(), remoteStream);
 | 
| +    RefPtrWillBeRawPtr<MediaStream> stream = MediaStream::create(executionContext(), remoteStream);
 | 
|      m_remoteStreams.append(stream);
 | 
|  
 | 
|      scheduleDispatchEvent(MediaStreamEvent::create(EventTypeNames::addstream, false, false, stream.release()));
 | 
| @@ -617,7 +619,7 @@ void RTCPeerConnection::didRemoveRemoteStream(const blink::WebMediaStream& remot
 | 
|      MediaStreamDescriptor* streamDescriptor = remoteStream;
 | 
|      ASSERT(streamDescriptor->client());
 | 
|  
 | 
| -    RefPtr<MediaStream> stream = static_cast<MediaStream*>(streamDescriptor->client());
 | 
| +    RefPtrWillBeRawPtr<MediaStream> stream = static_cast<MediaStream*>(streamDescriptor->client());
 | 
|      stream->streamEnded();
 | 
|  
 | 
|      if (m_signalingState == SignalingStateClosed)
 | 
| @@ -637,7 +639,7 @@ void RTCPeerConnection::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*
 | 
|      if (m_signalingState == SignalingStateClosed)
 | 
|          return;
 | 
|  
 | 
| -    RefPtr<RTCDataChannel> channel = RTCDataChannel::create(executionContext(), adoptPtr(handler));
 | 
| +    RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executionContext(), adoptPtr(handler));
 | 
|      m_dataChannels.append(channel);
 | 
|  
 | 
|      scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachannel, false, false, channel.release()));
 | 
| @@ -672,7 +674,7 @@ void RTCPeerConnection::stop()
 | 
|      m_iceConnectionState = ICEConnectionStateClosed;
 | 
|      m_signalingState = SignalingStateClosed;
 | 
|  
 | 
| -    Vector<RefPtr<RTCDataChannel> >::iterator i = m_dataChannels.begin();
 | 
| +    WillBeHeapVector<RefPtrWillBeMember<RTCDataChannel> >::iterator i = m_dataChannels.begin();
 | 
|      for (; i != m_dataChannels.end(); ++i)
 | 
|          (*i)->stop();
 | 
|  
 | 
| @@ -722,4 +724,9 @@ void RTCPeerConnection::dispatchScheduledEvent()
 | 
|      events.clear();
 | 
|  }
 | 
|  
 | 
| +void RTCPeerConnection::trace(Visitor* visitor)
 | 
| +{
 | 
| +    visitor->trace(m_dataChannels);
 | 
| +}
 | 
| +
 | 
|  } // namespace WebCore
 | 
| 
 |