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

Issue 2882803002: Initialize PeerConnection members in declaration order and destroy them in reverse order. (Closed)

Created:
3 years, 7 months ago by terelius
Modified:
3 years, 7 months ago
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Initialize PeerConnection members in declaration order and destroy them in reverse order. BUG=webrtc:7658 Review-Url: https://codereview.webrtc.org/2882803002 Cr-Commit-Position: refs/heads/master@{#18130} Committed: https://chromium.googlesource.com/external/webrtc/+/338602596cab95d90137409ab1d9ca462c859156

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -8 lines) Patch
M webrtc/pc/peerconnection.h View 2 chunks +9 lines, -6 lines 0 comments Download
M webrtc/pc/peerconnection.cc View 3 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 14 (8 generated)
terelius
3 years, 7 months ago (2017-05-12 22:57:18 UTC) #4
Taylor Brandstetter
lgtm
3 years, 7 months ago (2017-05-12 23:24:48 UTC) #5
tommi
lgtm
3 years, 7 months ago (2017-05-13 06:34:36 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2882803002/1
3 years, 7 months ago (2017-05-13 06:34:51 UTC) #10
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/external/webrtc/+/338602596cab95d90137409ab1d9ca462c859156
3 years, 7 months ago (2017-05-13 06:37:23 UTC) #13
nisse-webrtc
3 years, 7 months ago (2017-05-15 06:44:42 UTC) #14
Message was sent while issue was closed.
On 2017/05/13 06:37:23, commit-bot: I haz the power wrote:
> Committed patchset #1 (id:1) as
>
https://chromium.googlesource.com/external/webrtc/+/338602596cab95d90137409ab...

It seems a bit brittle if we must put declarations in the correct order, *and*
be very careful about the order things are teared down in the PeerConnection
destructor.

It would be nicer if we could just rely on the members being destructed in the
order implied by their declarations. It seems the tricky part is that the
objects that need to be destroyed last, port_allocator_ and call_, must be
destroyed on the worker thread. So to get that to be done automatically, we'd
need some helper class with a unique_ptr and a thread to use for destruction.

For the other objects, it looks a bit simpler, one would need to have streams'
Stop() method and the stat collector's WaitForPendingRequest be implied by
destruction.

|event_log_| already is set only on construction, so could be marked const. It
would be nice if we could do that for |stats_| and |stats_collector_| too, by
that depends on above reorganization of the destructor.

Powered by Google App Engine
This is Rietveld 408576698