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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp

Issue 1876703002: Oilpan: Replace EAGERLY_FINALIZE in EventTarget's hierarchy with pre-finalizers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, RTCConfiguration * configuration, WebMediaConstraints constraints, ExceptionState& exceptionState ) 406 RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, RTCConfiguration * configuration, WebMediaConstraints constraints, ExceptionState& exceptionState )
407 : ActiveScriptWrappable(this) 407 : ActiveScriptWrappable(this)
408 , ActiveDOMObject(context) 408 , ActiveDOMObject(context)
409 , m_signalingState(SignalingStateStable) 409 , m_signalingState(SignalingStateStable)
410 , m_iceGatheringState(ICEGatheringStateNew) 410 , m_iceGatheringState(ICEGatheringStateNew)
411 , m_iceConnectionState(ICEConnectionStateNew) 411 , m_iceConnectionState(ICEConnectionStateNew)
412 , m_dispatchScheduledEventRunner(AsyncMethodRunner<RTCPeerConnection>::creat e(this, &RTCPeerConnection::dispatchScheduledEvent)) 412 , m_dispatchScheduledEventRunner(AsyncMethodRunner<RTCPeerConnection>::creat e(this, &RTCPeerConnection::dispatchScheduledEvent))
413 , m_stopped(false) 413 , m_stopped(false)
414 , m_closed(false) 414 , m_closed(false)
415 { 415 {
416 ThreadState::current()->registerPreFinalizer(this);
416 Document* document = toDocument(getExecutionContext()); 417 Document* document = toDocument(getExecutionContext());
417 418
418 // If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the assert in the destructor. 419 // If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the assert in the destructor.
419 420
420 if (!document->frame()) { 421 if (!document->frame()) {
421 m_closed = true; 422 m_closed = true;
422 m_stopped = true; 423 m_stopped = true;
423 exceptionState.throwDOMException(NotSupportedError, "PeerConnections may not be created in detached documents."); 424 exceptionState.throwDOMException(NotSupportedError, "PeerConnections may not be created in detached documents.");
424 return; 425 return;
425 } 426 }
(...skipping 16 matching lines...) Expand all
442 } 443 }
443 } 444 }
444 445
445 RTCPeerConnection::~RTCPeerConnection() 446 RTCPeerConnection::~RTCPeerConnection()
446 { 447 {
447 // This checks that close() or stop() is called before the destructor. 448 // This checks that close() or stop() is called before the destructor.
448 // We are assuming that a wrapper is always created when RTCPeerConnection i s created. 449 // We are assuming that a wrapper is always created when RTCPeerConnection i s created.
449 DCHECK(m_closed || m_stopped); 450 DCHECK(m_closed || m_stopped);
450 } 451 }
451 452
453 void RTCPeerConnection::dispose()
454 {
455 // Promptly clears a raw reference from content/ to an on-heap object
456 // so that content/ doesn't access it in a lazy sweeping phase.
457 m_peerHandler.clear();
458 }
459
452 ScriptPromise RTCPeerConnection::createOffer(ScriptState* scriptState, const RTC OfferOptions& options) 460 ScriptPromise RTCPeerConnection::createOffer(ScriptState* scriptState, const RTC OfferOptions& options)
453 { 461 {
454 if (m_signalingState == SignalingStateClosed) 462 if (m_signalingState == SignalingStateClosed)
455 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMessage)); 463 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMessage));
456 464
457 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 465 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
458 ScriptPromise promise = resolver->promise(); 466 ScriptPromise promise = resolver->promise();
459 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestPromiseI mpl::create(this, resolver); 467 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestPromiseI mpl::create(this, resolver);
460 m_peerHandler->createOffer(request, convertToWebRTCOfferOptions(options)); 468 m_peerHandler->createOffer(request, convertToWebRTCOfferOptions(options));
461 return promise; 469 return promise;
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 { 1175 {
1168 visitor->trace(m_localStreams); 1176 visitor->trace(m_localStreams);
1169 visitor->trace(m_remoteStreams); 1177 visitor->trace(m_remoteStreams);
1170 visitor->trace(m_dispatchScheduledEventRunner); 1178 visitor->trace(m_dispatchScheduledEventRunner);
1171 visitor->trace(m_scheduledEvents); 1179 visitor->trace(m_scheduledEvents);
1172 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor); 1180 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor);
1173 ActiveDOMObject::trace(visitor); 1181 ActiveDOMObject::trace(visitor);
1174 } 1182 }
1175 1183
1176 } // namespace blink 1184 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698