Ban raw pointers to ref-counted types on base::Bind

base::Bind is intended to reject raw pointers to ref-counted types as
it's likely a bug. However, it has been regressed and failed to reject
the problematic pointers when it's passed as lvalue reference.

HasRefCountedTypeAsRawPtr requires a non reference type to check the
assertion statement, (e.g. requires `T*` rather than `T*&`).
In MakeBindStateTypeImpl in bind_internals.h, when a pointer type is
passed to base::Bind as an rvalue reference (e.g. `T*&&`), corresponding
BoundArgs item is a non-reference pointer type (e.g. `T*`) that passes the
unittest, however when it passed as an lvalue reference (e.g. `T*&`),
corresponding BoundArgs item is a reference to the pointer (e.g. `T*&`).
That causes the failure, and was not tested.

This CL fixes the compile-time assertion and fixes all banned usage of
base::Bind.

Bug: 737010
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ic3293746c22762f7900375b2cbb29ed5363a2d00
Reviewed-on: https://chromium-review.googlesource.com/549537
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#483983}

CrOS-Libchrome-Original-Commit: 1d692a2e0d1b58e02760c9c94293a77ecb477440
5 files changed
tree: efce22806a85e8ed4b7be6820521892a28a85ecb
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/