[weak_ptr] make weak_ptr unusable after destruction

When accidentally using a WeakPtrFactory after it is destructed (for
example, during destruction of another member of the object that
contained the factory), it was possible to get a weak pointer that is
never invalidated, but points to invalid memory.
This makes these bugs easier to detect: we change the internal pointer
to an known invalid value and dcheck that its value is not the poisoned
one in GetWeakPtr.

TEST=dchecks when getting a reference after destruction

Change-Id: Ib60c44f2d55ed0dfd239d23ae2f23d6a5d05ac8c
1 file changed