[Mojo] Implement explicit operator bool on InterfacePtr and AssociatedInterfacePtr

Desktop / Chromium - Jeremy Roman [chromium.org] - 14 June 2017 11:00 EDT

This explaces the "safe bool" pattern (operator Testable), and is the recommended pattern for this from C++11 onwards. The only major difference from a use standpoint is that the conversion no longer occurs implicitly when returning from a bool function. Those cases have been made explicit.

This is similar to templates like std::unique_ptr.

TBR=jam@chromium.org

Change-Id: I1c04df989214acf878857194afcdf0906aa3d9c5 Reviewed-on: https://chromium-review.googlesource.com/534295 Commit-Queue: Jeremy Roman

c134829 [Mojo] Implement explicit operator bool on InterfacePtr and AssociatedInterfacePtr.
components/arc/test/fake_file_system_instance.cc | 2 +-
ipc/ipc_message_pipe_reader.h | 2 +-
.../services/mojo_audio_output_stream_unittest.cc | 2 +-
mojo/public/cpp/bindings/associated_interface_ptr.h | 21 ++-------------------
mojo/public/cpp/bindings/interface_ptr.h | 20 ++------------------
.../Source/modules/sensor/SensorProviderProxy.h | 2 +-
6 files changed, 8 insertions(+), 41 deletions(-)

Upstream: git.chromium.org


  • Share