[Mojo] Implement explicit operator bool on InterfacePtr and AssociatedInterfacePtr.
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.
[email protected]
Change-Id: I1c04df989214acf878857194afcdf0906aa3d9c5
Reviewed-on: https://chromium-review.googlesource.com/534295
Commit-Queue: Jeremy Roman <[email protected]>
Reviewed-by: Yuzhu Shen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#479382}
diff --git a/ipc/ipc_message_pipe_reader.h b/ipc/ipc_message_pipe_reader.h
index b441960..ceb62fe 100644
--- a/ipc/ipc_message_pipe_reader.h
+++ b/ipc/ipc_message_pipe_reader.h
@@ -74,7 +74,7 @@
void Close();
// Return true if the MessagePipe is alive.
- bool IsValid() { return sender_; }
+ bool IsValid() { return sender_.is_bound(); }
// Sends an IPC::Message to the other end of the pipe. Safe to call from any
// thread.