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

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

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

Powered by Google App Engine
This is Rietveld 408576698