Chromium Code Reviews| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 .client() | 514 .client() |
| 515 ->dispatchWillStartUsingPeerConnectionHandler(m_peerHandler.get()); | 515 ->dispatchWillStartUsingPeerConnectionHandler(m_peerHandler.get()); |
| 516 | 516 |
| 517 if (!m_peerHandler->initialize(configuration, constraints)) { | 517 if (!m_peerHandler->initialize(configuration, constraints)) { |
| 518 m_closed = true; | 518 m_closed = true; |
| 519 m_stopped = true; | 519 m_stopped = true; |
| 520 exceptionState.throwDOMException( | 520 exceptionState.throwDOMException( |
| 521 NotSupportedError, "Failed to initialize native PeerConnection."); | 521 NotSupportedError, "Failed to initialize native PeerConnection."); |
| 522 return; | 522 return; |
| 523 } | 523 } |
| 524 | |
| 525 m_connectionHandleForScheduler = | |
| 526 document->frame()->frameScheduler()->onActiveConnectionCreated(); | |
|
haraken
2017/02/10 16:51:20
Another possible API would be to use an observer p
altimin
2017/02/10 16:57:00
I would argue that you still need to notify the sc
| |
| 524 } | 527 } |
| 525 | 528 |
| 526 RTCPeerConnection::~RTCPeerConnection() { | 529 RTCPeerConnection::~RTCPeerConnection() { |
| 527 // This checks that close() or stop() is called before the destructor. | 530 // This checks that close() or stop() is called before the destructor. |
| 528 // We are assuming that a wrapper is always created when RTCPeerConnection is | 531 // We are assuming that a wrapper is always created when RTCPeerConnection is |
| 529 // created. | 532 // created. |
| 530 DCHECK(m_closed || m_stopped); | 533 DCHECK(m_closed || m_stopped); |
| 531 } | 534 } |
| 532 | 535 |
| 533 void RTCPeerConnection::dispose() { | 536 void RTCPeerConnection::dispose() { |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1345 if (m_stopped) | 1348 if (m_stopped) |
| 1346 return; | 1349 return; |
| 1347 | 1350 |
| 1348 m_stopped = true; | 1351 m_stopped = true; |
| 1349 m_iceConnectionState = ICEConnectionStateClosed; | 1352 m_iceConnectionState = ICEConnectionStateClosed; |
| 1350 m_signalingState = SignalingStateClosed; | 1353 m_signalingState = SignalingStateClosed; |
| 1351 | 1354 |
| 1352 m_dispatchScheduledEventRunner->stop(); | 1355 m_dispatchScheduledEventRunner->stop(); |
| 1353 | 1356 |
| 1354 m_peerHandler.reset(); | 1357 m_peerHandler.reset(); |
| 1358 | |
| 1359 m_connectionHandleForScheduler.reset(); | |
| 1355 } | 1360 } |
| 1356 | 1361 |
| 1357 void RTCPeerConnection::closePeerConnection() { | 1362 void RTCPeerConnection::closePeerConnection() { |
| 1358 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); | 1363 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); |
| 1359 closeInternal(); | 1364 closeInternal(); |
| 1360 } | 1365 } |
| 1361 | 1366 |
| 1362 const AtomicString& RTCPeerConnection::interfaceName() const { | 1367 const AtomicString& RTCPeerConnection::interfaceName() const { |
| 1363 return EventTargetNames::RTCPeerConnection; | 1368 return EventTargetNames::RTCPeerConnection; |
| 1364 } | 1369 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1419 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); | 1424 DCHECK(m_signalingState != RTCPeerConnection::SignalingStateClosed); |
| 1420 m_peerHandler->stop(); | 1425 m_peerHandler->stop(); |
| 1421 m_closed = true; | 1426 m_closed = true; |
| 1422 | 1427 |
| 1423 changeIceConnectionState(ICEConnectionStateClosed); | 1428 changeIceConnectionState(ICEConnectionStateClosed); |
| 1424 changeIceGatheringState(ICEGatheringStateComplete); | 1429 changeIceGatheringState(ICEGatheringStateComplete); |
| 1425 changeSignalingState(SignalingStateClosed); | 1430 changeSignalingState(SignalingStateClosed); |
| 1426 Document* document = toDocument(getExecutionContext()); | 1431 Document* document = toDocument(getExecutionContext()); |
| 1427 HostsUsingFeatures::countAnyWorld( | 1432 HostsUsingFeatures::countAnyWorld( |
| 1428 *document, HostsUsingFeatures::Feature::RTCPeerConnectionUsed); | 1433 *document, HostsUsingFeatures::Feature::RTCPeerConnectionUsed); |
| 1434 | |
| 1435 m_connectionHandleForScheduler.reset(); | |
| 1429 } | 1436 } |
| 1430 | 1437 |
| 1431 void RTCPeerConnection::scheduleDispatchEvent(Event* event) { | 1438 void RTCPeerConnection::scheduleDispatchEvent(Event* event) { |
| 1432 scheduleDispatchEvent(event, nullptr); | 1439 scheduleDispatchEvent(event, nullptr); |
| 1433 } | 1440 } |
| 1434 | 1441 |
| 1435 void RTCPeerConnection::scheduleDispatchEvent( | 1442 void RTCPeerConnection::scheduleDispatchEvent( |
| 1436 Event* event, | 1443 Event* event, |
| 1437 std::unique_ptr<BoolFunction> setupFunction) { | 1444 std::unique_ptr<BoolFunction> setupFunction) { |
| 1438 m_scheduledEvents.push_back( | 1445 m_scheduledEvents.push_back( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1486 DEFINE_TRACE(RTCPeerConnection) { | 1493 DEFINE_TRACE(RTCPeerConnection) { |
| 1487 visitor->trace(m_localStreams); | 1494 visitor->trace(m_localStreams); |
| 1488 visitor->trace(m_remoteStreams); | 1495 visitor->trace(m_remoteStreams); |
| 1489 visitor->trace(m_dispatchScheduledEventRunner); | 1496 visitor->trace(m_dispatchScheduledEventRunner); |
| 1490 visitor->trace(m_scheduledEvents); | 1497 visitor->trace(m_scheduledEvents); |
| 1491 EventTargetWithInlineData::trace(visitor); | 1498 EventTargetWithInlineData::trace(visitor); |
| 1492 SuspendableObject::trace(visitor); | 1499 SuspendableObject::trace(visitor); |
| 1493 } | 1500 } |
| 1494 | 1501 |
| 1495 } // namespace blink | 1502 } // namespace blink |
| OLD | NEW |