Fix implicit access to raw pointer of scoped_refptr.

In following patch https://codereview.chromium.org/1963323004/
scoped_refptr will have the previous flawed "Safe Bool Idiom"
implementation removed.

This feature was incorrectly used throughout the codebase
with code implicitly accessing the raw pointer from
scoped_refptr instances. A correct "Safe Bool Idiom" would
have prevented that, but the point is moot as we can now
move to Cxx11 "explicit operator bool()".

Usage has been corrected in two ways:
+ Logic tests no longer compare pointer values, but use a
  boolean expression (typically just the variable name).
+ Casts to boolean types are now explicit with stati_cast<bool>().

BUG=610048
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/1958823002
Cr-Commit-Position: refs/heads/master@{#393125}


CrOS-Libchrome-Original-Commit: 4dac7f0d4c5050a5a827c2a1a5cd581afe1ae733
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index d273dc0..7bf83f8 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -291,7 +291,7 @@
 
 TEST_F(ThreadTest, ThreadNotStarted) {
   Thread a("Inert");
-  EXPECT_EQ(nullptr, a.task_runner());
+  EXPECT_FALSE(a.task_runner());
 }
 
 TEST_F(ThreadTest, MultipleWaitUntilThreadStarted) {
diff --git a/ipc/ipc_message_attachment_set_posix_unittest.cc b/ipc/ipc_message_attachment_set_posix_unittest.cc
index e43e431..5ebed84 100644
--- a/ipc/ipc_message_attachment_set_posix_unittest.cc
+++ b/ipc/ipc_message_attachment_set_posix_unittest.cc
@@ -154,7 +154,7 @@
       set->AddAttachment(new internal::PlatformFileAttachment(kFDBase + 2)));
 
   ASSERT_EQ(set->GetNonBrokerableAttachmentAt(0)->TakePlatformFile(), kFDBase);
-  ASSERT_EQ(set->GetNonBrokerableAttachmentAt(2), nullptr);
+  ASSERT_FALSE(set->GetNonBrokerableAttachmentAt(2));
 
   set->CommitAllDescriptors();
 }
diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc
index f38e2ab..df39105 100644
--- a/mojo/edk/system/shared_buffer_dispatcher.cc
+++ b/mojo/edk/system/shared_buffer_dispatcher.cc
@@ -276,7 +276,7 @@
   base::AutoLock lock(lock_);
   if (in_transit_)
     return false;
-  in_transit_ = shared_buffer_ != nullptr;
+  in_transit_ = static_cast<bool>(shared_buffer_);
   return in_transit_;
 }
 
diff --git a/mojo/edk/system/wait_set_dispatcher_unittest.cc b/mojo/edk/system/wait_set_dispatcher_unittest.cc
index 40ac2ac..42ac865 100644
--- a/mojo/edk/system/wait_set_dispatcher_unittest.cc
+++ b/mojo/edk/system/wait_set_dispatcher_unittest.cc
@@ -236,7 +236,7 @@
     context = 0;
     EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
               GetOneReadyDispatcher(wait_set, &woken_dispatcher, &context));
-    EXPECT_EQ(nullptr, woken_dispatcher);
+    EXPECT_FALSE(woken_dispatcher);
     EXPECT_EQ(0u, context);
     EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, nullptr));
   }