DescriptionRefCountInterface: Make AddRef() and Release() const
This CL makes AddRef() and Release() const member methods and the refcount integer mutable. This is reasonable, because they only manage the lifetime of the object, and this is also how it's done in Chromium.
The purpose is to be able to capture a const pointer in a scoped_refptr, which is currenty impossible. The practial problem this CL solves is this:
void Foo::Bar() const {}
rtc::Callback0<void> Foo::MakeClosure() const {
return rtc::Bind(&Foo::Bar, this);
}
We currently capture |this| as const Foo*. With this CL, |this| will be captured as scoped_refptr<const Foo>.
A test is also added in bind_unittest to check this behaviour.
BUG=webrtc:5065
R=perkj@webrtc.org, tommi@webrtc.org
Committed: https://crrev.com/1b40a9a8afe0d7b2244ad8dea19e8222fec3c207
Cr-Commit-Position: refs/heads/master@{#10253}
Patch Set 1 #Patch Set 2 : #
Messages
Total messages: 11 (3 generated)
|