| OLD | NEW |
| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 .client() | 513 .client() |
| 514 ->dispatchWillStartUsingPeerConnectionHandler(m_peerHandler.get()); | 514 ->dispatchWillStartUsingPeerConnectionHandler(m_peerHandler.get()); |
| 515 | 515 |
| 516 if (!m_peerHandler->initialize(configuration, constraints)) { | 516 if (!m_peerHandler->initialize(configuration, constraints)) { |
| 517 m_closed = true; | 517 m_closed = true; |
| 518 m_stopped = true; | 518 m_stopped = true; |
| 519 exceptionState.throwDOMException( | 519 exceptionState.throwDOMException( |
| 520 NotSupportedError, "Failed to initialize native PeerConnection."); | 520 NotSupportedError, "Failed to initialize native PeerConnection."); |
| 521 return; | 521 return; |
| 522 } | 522 } |
| 523 | |
| 524 m_connectionHandleForScheduler = | |
| 525 document->frame()->frameScheduler()->onActiveConnectionCreated(); | |
| 526 } | 523 } |
| 527 | 524 |
| 528 RTCPeerConnection::~RTCPeerConnection() { | 525 RTCPeerConnection::~RTCPeerConnection() { |
| 529 // This checks that close() or stop() is called before the destructor. | 526 // This checks that close() or stop() is called before the destructor. |
| 530 // We are assuming that a wrapper is always created when RTCPeerConnection is | 527 // We are assuming that a wrapper is always created when RTCPeerConnection is |
| 531 // created. | 528 // created. |
| 532 DCHECK(m_closed || m_stopped); | 529 DCHECK(m_closed || m_stopped); |
| 533 } | 530 } |
| 534 | 531 |
| 535 void RTCPeerConnection::dispose() { | 532 void RTCPeerConnection::dispose() { |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 if (m_stopped) | 1334 if (m_stopped) |
| 1338 return; | 1335 return; |
| 1339 | 1336 |
| 1340 m_stopped = true; | 1337 m_stopped = true; |
| 1341 m_iceConnectionState = ICEConnectionStateClosed; | 1338 m_iceConnectionState = ICEConnectionStateClosed; |
| 1342 m_signalingState = SignalingStateClosed; | 1339 m_signalingState = SignalingStateClosed; |
| 1343 | 1340 |
| 1344 m_dispatchScheduledEventRunner->stop(); | 1341 m_dispatchScheduledEventRunner->stop(); |
| 1345 | 1342 |
| 1346 m_peerHandler.reset(); | 1343 m_peerHandler.reset(); |
| 1347 | |
| 1348 m_connectionHandleForScheduler.reset(); | |
| 1349 } | 1344 } |
| 1350 | 1345 |
| 1351 void RTCPeerConnection::closePeerConnection() { | 1346 void RTCPeerConnection::closePeerConnection() { |
| 1352 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); | 1347 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); |
| 1353 closeInternal(); | 1348 closeInternal(); |
| 1354 } | 1349 } |
| 1355 | 1350 |
| 1356 const AtomicString& RTCPeerConnection::interfaceName() const { | 1351 const AtomicString& RTCPeerConnection::interfaceName() const { |
| 1357 return EventTargetNames::RTCPeerConnection; | 1352 return EventTargetNames::RTCPeerConnection; |
| 1358 } | 1353 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); | 1408 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); |
| 1414 m_peerHandler->stop(); | 1409 m_peerHandler->stop(); |
| 1415 m_closed = true; | 1410 m_closed = true; |
| 1416 | 1411 |
| 1417 changeIceConnectionState(ICEConnectionStateClosed); | 1412 changeIceConnectionState(ICEConnectionStateClosed); |
| 1418 changeIceGatheringState(ICEGatheringStateComplete); | 1413 changeIceGatheringState(ICEGatheringStateComplete); |
| 1419 changeSignalingState(SignalingStateClosed); | 1414 changeSignalingState(SignalingStateClosed); |
| 1420 Document* document = toDocument(getExecutionContext()); | 1415 Document* document = toDocument(getExecutionContext()); |
| 1421 HostsUsingFeatures::countAnyWorld( | 1416 HostsUsingFeatures::countAnyWorld( |
| 1422 *document, HostsUsingFeatures::Feature::RTCPeerConnectionUsed); | 1417 *document, HostsUsingFeatures::Feature::RTCPeerConnectionUsed); |
| 1423 | |
| 1424 m_connectionHandleForScheduler.reset(); | |
| 1425 } | 1418 } |
| 1426 | 1419 |
| 1427 void RTCPeerConnection::scheduleDispatchEvent(Event* event) { | 1420 void RTCPeerConnection::scheduleDispatchEvent(Event* event) { |
| 1428 scheduleDispatchEvent(event, nullptr); | 1421 scheduleDispatchEvent(event, nullptr); |
| 1429 } | 1422 } |
| 1430 | 1423 |
| 1431 void RTCPeerConnection::scheduleDispatchEvent( | 1424 void RTCPeerConnection::scheduleDispatchEvent( |
| 1432 Event* event, | 1425 Event* event, |
| 1433 std::unique_ptr<BoolFunction> setupFunction) { | 1426 std::unique_ptr<BoolFunction> setupFunction) { |
| 1434 m_scheduledEvents.push_back( | 1427 m_scheduledEvents.push_back( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 DEFINE_TRACE(RTCPeerConnection) { | 1475 DEFINE_TRACE(RTCPeerConnection) { |
| 1483 visitor->trace(m_localStreams); | 1476 visitor->trace(m_localStreams); |
| 1484 visitor->trace(m_remoteStreams); | 1477 visitor->trace(m_remoteStreams); |
| 1485 visitor->trace(m_dispatchScheduledEventRunner); | 1478 visitor->trace(m_dispatchScheduledEventRunner); |
| 1486 visitor->trace(m_scheduledEvents); | 1479 visitor->trace(m_scheduledEvents); |
| 1487 EventTargetWithInlineData::trace(visitor); | 1480 EventTargetWithInlineData::trace(visitor); |
| 1488 SuspendableObject::trace(visitor); | 1481 SuspendableObject::trace(visitor); |
| 1489 } | 1482 } |
| 1490 | 1483 |
| 1491 } // namespace blink | 1484 } // namespace blink |
| OLD | NEW |