Removes code duplication and use of the dangerous public destructor in RefCountImpl. Also making wider use of scoped_refptr and fixing various leaks in the process. BUG=webrtc:5229 R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1477013005 . Cr-Commit-Position: refs/heads/master@{#12075}