On 2015/04/17 11:26:46, jochen wrote:
> RTCSessionDescription should be an active dom object to keep its wrapper
> alive
+haraken, so he can correct me if I'm totally wrong.
It doesn't really seem to me that making RTCSessionDescription an
ActiveDOMObject is the right approach. It's not really active, AFAICT; it's
just
referenced from another object (that happens to be active.)
Looks to me like doing anything other than simply returning the same
RTCSessionDescription pointer from the getter (e.g.
RTCPeerConnection::localDescription()) every time should be enough. The IDL
compiler automatically adds code to keep the V8 wrapper alive by adding a
reference from the RTCPeerConnection wrapper to the RTCSessionDescription
wrapper.
https://codereview.chromium.org/1010393002/diff/20001/Source/modules/mediastream/RTCPeerConnection.cpp
File Source/modules/mediastream/RTCPeerConnection.cpp (right):
https://codereview.chromium.org/1010393002/diff/20001/Source/modules/mediastream/RTCPeerConnection.cpp#newcode347
Source/modules/mediastream/RTCPeerConnection.cpp:347:
m_localDescription->setWebSessionDescription(webSessionDescription);
I think the semantics might be somewhat incorrect here (and in
setLocalDescription() + same for remote).
I don't know what might make the description change (since I don't know
WebRTC at all) but if it were to change, it seems more reasonable to
return a new RTCSessionDescription object, instead of mutating the one
we have, and might have returned earlier.
The spec definitely says to return the last description successfully via
setLocalDescription(), which implies that setLocalDescription() should
make this setter later return a different object. That is, that
setLocalDescription() should simply store the description argument in
m_localDescription so that we can return it later.
And then we should perhaps have an update mechanism here so that if we
have an existing description in m_localDescription but what
m_peerHandler->localDescription() returns doesn't match it, that we
create a new RTCSessionDescription object with that information and
store it in m_localDescription.
This is all somewhat complicated though by the fact that
RTCSessionDescription objects aren't immutable, meaning whatever
description we return to the script (or that a script sets via
setLocalDescription()) could later be modified directly by the script,
which the specification doesn't mention (or at least not where I'd
expect to find it mentioned.)
https://codereview.chromium.org/1010393002/