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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #include "public/platform/WebRTCDataChannelHandler.h" 83 #include "public/platform/WebRTCDataChannelHandler.h"
84 #include "public/platform/WebRTCDataChannelInit.h" 84 #include "public/platform/WebRTCDataChannelInit.h"
85 #include "public/platform/WebRTCICECandidate.h" 85 #include "public/platform/WebRTCICECandidate.h"
86 #include "public/platform/WebRTCKeyParams.h" 86 #include "public/platform/WebRTCKeyParams.h"
87 #include "public/platform/WebRTCOfferOptions.h" 87 #include "public/platform/WebRTCOfferOptions.h"
88 #include "public/platform/WebRTCSessionDescription.h" 88 #include "public/platform/WebRTCSessionDescription.h"
89 #include "public/platform/WebRTCSessionDescriptionRequest.h" 89 #include "public/platform/WebRTCSessionDescriptionRequest.h"
90 #include "public/platform/WebRTCStatsRequest.h" 90 #include "public/platform/WebRTCStatsRequest.h"
91 #include "public/platform/WebRTCVoidRequest.h" 91 #include "public/platform/WebRTCVoidRequest.h"
92 #include "wtf/CurrentTime.h" 92 #include "wtf/CurrentTime.h"
93 #include "wtf/PtrUtil.h" 93
94 #include <memory> 94 #include <memory>
95 95
96 namespace blink { 96 namespace blink {
97 97
98 namespace { 98 namespace {
99 99
100 const char kSignalingStateClosedMessage[] = "The RTCPeerConnection's signalingSt ate is 'closed'."; 100 const char kSignalingStateClosedMessage[] = "The RTCPeerConnection's signalingSt ate is 'closed'.";
101 101
102 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat e, ExceptionState& exceptionState) 102 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat e, ExceptionState& exceptionState)
103 { 103 {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 // If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the assert in the destructor. 449 // If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the assert in the destructor.
450 450
451 if (!document->frame()) { 451 if (!document->frame()) {
452 m_closed = true; 452 m_closed = true;
453 m_stopped = true; 453 m_stopped = true;
454 exceptionState.throwDOMException(NotSupportedError, "PeerConnections may not be created in detached documents."); 454 exceptionState.throwDOMException(NotSupportedError, "PeerConnections may not be created in detached documents.");
455 return; 455 return;
456 } 456 }
457 457
458 m_peerHandler = wrapUnique(Platform::current()->createRTCPeerConnectionHandl er(this)); 458 m_peerHandler = adoptPtr(Platform::current()->createRTCPeerConnectionHandler (this));
459 if (!m_peerHandler) { 459 if (!m_peerHandler) {
460 m_closed = true; 460 m_closed = true;
461 m_stopped = true; 461 m_stopped = true;
462 exceptionState.throwDOMException(NotSupportedError, "No PeerConnection h andler can be created, perhaps WebRTC is disabled?"); 462 exceptionState.throwDOMException(NotSupportedError, "No PeerConnection h andler can be created, perhaps WebRTC is disabled?");
463 return; 463 return;
464 } 464 }
465 465
466 document->frame()->loader().client()->dispatchWillStartUsingPeerConnectionHa ndler(m_peerHandler.get()); 466 document->frame()->loader().client()->dispatchWillStartUsingPeerConnectionHa ndler(m_peerHandler.get());
467 467
468 if (!m_peerHandler->initialize(configuration, constraints)) { 468 if (!m_peerHandler->initialize(configuration, constraints)) {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } else { 740 } else {
741 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(NotSupportedError, unsupportedParamsString)); 741 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(NotSupportedError, unsupportedParamsString));
742 } 742 }
743 break; 743 break;
744 default: 744 default:
745 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "The 1st argument provided is an AlgorithmIdentifier, but the algorithm is not supported.")); 745 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "The 1st argument provided is an AlgorithmIdentifier, but the algorithm is not supported."));
746 break; 746 break;
747 } 747 }
748 DCHECK(!keyParams.isNull()); 748 DCHECK(!keyParams.isNull());
749 749
750 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = wrapUniqu e( 750 OwnPtr<WebRTCCertificateGenerator> certificateGenerator = adoptPtr(
751 Platform::current()->createRTCCertificateGenerator()); 751 Platform::current()->createRTCCertificateGenerator());
752 752
753 // |keyParams| was successfully constructed, but does the certificate genera tor support these parameters? 753 // |keyParams| was successfully constructed, but does the certificate genera tor support these parameters?
754 if (!certificateGenerator->isSupportedKeyParams(keyParams.get())) { 754 if (!certificateGenerator->isSupportedKeyParams(keyParams.get())) {
755 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, unsupportedParamsString)); 755 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, unsupportedParamsString));
756 } 756 }
757 757
758 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 758 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
759 ScriptPromise promise = resolver->promise(); 759 ScriptPromise promise = resolver->promise();
760 760
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1095 }
1096 1096
1097 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle r) 1097 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle r)
1098 { 1098 {
1099 DCHECK(!m_closed); 1099 DCHECK(!m_closed);
1100 DCHECK(getExecutionContext()->isContextThread()); 1100 DCHECK(getExecutionContext()->isContextThread());
1101 1101
1102 if (m_signalingState == SignalingStateClosed) 1102 if (m_signalingState == SignalingStateClosed)
1103 return; 1103 return;
1104 1104
1105 RTCDataChannel* channel = RTCDataChannel::create(getExecutionContext(), wrap Unique(handler)); 1105 RTCDataChannel* channel = RTCDataChannel::create(getExecutionContext(), adop tPtr(handler));
1106 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne l, false, false, channel)); 1106 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne l, false, false, channel));
1107 } 1107 }
1108 1108
1109 void RTCPeerConnection::releasePeerConnectionHandler() 1109 void RTCPeerConnection::releasePeerConnectionHandler()
1110 { 1110 {
1111 stop(); 1111 stop();
1112 } 1112 }
1113 1113
1114 void RTCPeerConnection::closePeerConnection() 1114 void RTCPeerConnection::closePeerConnection()
1115 { 1115 {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 { 1227 {
1228 visitor->trace(m_localStreams); 1228 visitor->trace(m_localStreams);
1229 visitor->trace(m_remoteStreams); 1229 visitor->trace(m_remoteStreams);
1230 visitor->trace(m_dispatchScheduledEventRunner); 1230 visitor->trace(m_dispatchScheduledEventRunner);
1231 visitor->trace(m_scheduledEvents); 1231 visitor->trace(m_scheduledEvents);
1232 EventTargetWithInlineData::trace(visitor); 1232 EventTargetWithInlineData::trace(visitor);
1233 ActiveDOMObject::trace(visitor); 1233 ActiveDOMObject::trace(visitor);
1234 } 1234 }
1235 1235
1236 } // namespace blink 1236 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698