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

Side by Side Diff: webrtc/pc/peerconnection.h

Issue 2882803002: Initialize PeerConnection members in declaration order and destroy them in reverse order. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | webrtc/pc/peerconnection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 // Storing the factory as a scoped reference pointer ensures that the memory 396 // Storing the factory as a scoped reference pointer ensures that the memory
397 // in the PeerConnectionFactoryImpl remains available as long as the 397 // in the PeerConnectionFactoryImpl remains available as long as the
398 // PeerConnection is running. It is passed to PeerConnection as a raw pointer. 398 // PeerConnection is running. It is passed to PeerConnection as a raw pointer.
399 // However, since the reference counting is done in the 399 // However, since the reference counting is done in the
400 // PeerConnectionFactoryInterface all instances created using the raw pointer 400 // PeerConnectionFactoryInterface all instances created using the raw pointer
401 // will refer to the same reference count. 401 // will refer to the same reference count.
402 rtc::scoped_refptr<PeerConnectionFactory> factory_; 402 rtc::scoped_refptr<PeerConnectionFactory> factory_;
403 PeerConnectionObserver* observer_; 403 PeerConnectionObserver* observer_;
404 UMAObserver* uma_observer_; 404 UMAObserver* uma_observer_;
405
406 // The EventLog needs to outlive |call_| (and any other object that uses it).
407 std::unique_ptr<RtcEventLog> event_log_;
408
405 SignalingState signaling_state_; 409 SignalingState signaling_state_;
406 IceConnectionState ice_connection_state_; 410 IceConnectionState ice_connection_state_;
407 IceGatheringState ice_gathering_state_; 411 IceGatheringState ice_gathering_state_;
408 PeerConnectionInterface::RTCConfiguration configuration_; 412 PeerConnectionInterface::RTCConfiguration configuration_;
409 413
410 std::unique_ptr<cricket::PortAllocator> port_allocator_; 414 std::unique_ptr<cricket::PortAllocator> port_allocator_;
411 // The EventLog needs to outlive |call_|.
412 std::unique_ptr<RtcEventLog> event_log_;
413 415
414 // One PeerConnection has only one RTCP CNAME. 416 // One PeerConnection has only one RTCP CNAME.
415 // https://tools.ietf.org/html/draft-ietf-rtcweb-rtp-usage-26#section-4.9 417 // https://tools.ietf.org/html/draft-ietf-rtcweb-rtp-usage-26#section-4.9
416 std::string rtcp_cname_; 418 std::string rtcp_cname_;
417 419
418 // Streams added via AddStream. 420 // Streams added via AddStream.
419 rtc::scoped_refptr<StreamCollection> local_streams_; 421 rtc::scoped_refptr<StreamCollection> local_streams_;
420 // Streams created as a result of SetRemoteDescription. 422 // Streams created as a result of SetRemoteDescription.
421 rtc::scoped_refptr<StreamCollection> remote_streams_; 423 rtc::scoped_refptr<StreamCollection> remote_streams_;
422 424
423 std::vector<std::unique_ptr<MediaStreamObserver>> stream_observers_; 425 std::vector<std::unique_ptr<MediaStreamObserver>> stream_observers_;
424 426
425 // These lists store track info seen in local/remote descriptions. 427 // These lists store track info seen in local/remote descriptions.
426 TrackInfos remote_audio_tracks_; 428 TrackInfos remote_audio_tracks_;
427 TrackInfos remote_video_tracks_; 429 TrackInfos remote_video_tracks_;
428 TrackInfos local_audio_tracks_; 430 TrackInfos local_audio_tracks_;
429 TrackInfos local_video_tracks_; 431 TrackInfos local_video_tracks_;
430 432
431 SctpSidAllocator sid_allocator_; 433 SctpSidAllocator sid_allocator_;
432 // label -> DataChannel 434 // label -> DataChannel
433 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; 435 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_;
434 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; 436 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_;
435 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_; 437 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_;
436 438
437 bool remote_peer_supports_msid_ = false; 439 bool remote_peer_supports_msid_ = false;
438 440
441 std::unique_ptr<Call> call_;
442 std::unique_ptr<WebRtcSession> session_;
443 std::unique_ptr<StatsCollector> stats_; // A pointer is passed to senders_
444 rtc::scoped_refptr<RTCStatsCollector> stats_collector_;
445
439 std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>> 446 std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>>
440 senders_; 447 senders_;
441 std::vector< 448 std::vector<
442 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> 449 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>>
443 receivers_; 450 receivers_;
444 std::unique_ptr<WebRtcSession> session_;
445 std::unique_ptr<Call> call_;
446 std::unique_ptr<StatsCollector> stats_;
447 rtc::scoped_refptr<RTCStatsCollector> stats_collector_;
448 }; 451 };
449 452
450 } // namespace webrtc 453 } // namespace webrtc
451 454
452 #endif // WEBRTC_PC_PEERCONNECTION_H_ 455 #endif // WEBRTC_PC_PEERCONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/peerconnection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698