back port upstream patch

This patch is from Chromium project. It's used to handle potential issue
in scoped_refptr.

This is upstream patch porting and the original link is:
http://codereview.chromium.org/9021020/
unittest change was not included.

Change-Id: I14ce3df0653ff29713f38eceaf07e9b409cfaedc
Author: Fengwei Yin <fengwei.yin@intel.com>
Singed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 37500
1 file changed