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}
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index d273dc0..7bf83f81 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/blimp/common/blob_cache/in_memory_blob_cache_unittest.cc b/blimp/common/blob_cache/in_memory_blob_cache_unittest.cc
index 828c395..6eb98ff 100644
--- a/blimp/common/blob_cache/in_memory_blob_cache_unittest.cc
+++ b/blimp/common/blob_cache/in_memory_blob_cache_unittest.cc
@@ -36,7 +36,7 @@
TEST_F(InMemoryBlobCacheTest, SimplePutContainsAndGetOperations) {
EXPECT_FALSE(cache_.Contains(kFoo));
- EXPECT_EQ(nullptr, cache_.Get(kFoo));
+ EXPECT_FALSE(cache_.Get(kFoo));
BlobDataPtr blob_data = CreateBlobDataPtr(kDeadbeef);
cache_.Put(kFoo, blob_data);
diff --git a/cc/test/fake_video_frame_provider.cc b/cc/test/fake_video_frame_provider.cc
index 01455446..d908c9d 100644
--- a/cc/test/fake_video_frame_provider.cc
+++ b/cc/test/fake_video_frame_provider.cc
@@ -25,7 +25,7 @@
}
bool FakeVideoFrameProvider::HasCurrentFrame() {
- return frame_;
+ return static_cast<bool>(frame_);
}
scoped_refptr<media::VideoFrame> FakeVideoFrameProvider::GetCurrentFrame() {
diff --git a/cc/trees/layer_tree_host_unittest_serialization.cc b/cc/trees/layer_tree_host_unittest_serialization.cc
index 00852bc..7d989d6 100644
--- a/cc/trees/layer_tree_host_unittest_serialization.cc
+++ b/cc/trees/layer_tree_host_unittest_serialization.cc
@@ -131,31 +131,31 @@
}
EXPECT_TRUE(found_hud_layer_type);
} else {
- EXPECT_EQ(nullptr, layer_tree_host_dst_->hud_layer_);
+ EXPECT_FALSE(layer_tree_host_dst_->hud_layer_);
}
if (layer_tree_host_src_->overscroll_elasticity_layer_) {
EXPECT_EQ(layer_tree_host_src_->overscroll_elasticity_layer_->id(),
layer_tree_host_dst_->overscroll_elasticity_layer_->id());
} else {
- EXPECT_EQ(nullptr, layer_tree_host_dst_->overscroll_elasticity_layer_);
+ EXPECT_FALSE(layer_tree_host_dst_->overscroll_elasticity_layer_);
}
if (layer_tree_host_src_->page_scale_layer_) {
EXPECT_EQ(layer_tree_host_src_->page_scale_layer_->id(),
layer_tree_host_dst_->page_scale_layer_->id());
} else {
- EXPECT_EQ(nullptr, layer_tree_host_dst_->page_scale_layer_);
+ EXPECT_FALSE(layer_tree_host_dst_->page_scale_layer_);
}
if (layer_tree_host_src_->inner_viewport_scroll_layer_) {
EXPECT_EQ(layer_tree_host_src_->inner_viewport_scroll_layer_->id(),
layer_tree_host_dst_->inner_viewport_scroll_layer_->id());
} else {
- EXPECT_EQ(nullptr, layer_tree_host_dst_->inner_viewport_scroll_layer_);
+ EXPECT_FALSE(layer_tree_host_dst_->inner_viewport_scroll_layer_);
}
if (layer_tree_host_src_->outer_viewport_scroll_layer_) {
EXPECT_EQ(layer_tree_host_src_->outer_viewport_scroll_layer_->id(),
layer_tree_host_dst_->outer_viewport_scroll_layer_->id());
} else {
- EXPECT_EQ(nullptr, layer_tree_host_dst_->outer_viewport_scroll_layer_);
+ EXPECT_FALSE(layer_tree_host_dst_->outer_viewport_scroll_layer_);
}
EXPECT_EQ(layer_tree_host_src_->selection_,
layer_tree_host_dst_->selection_);
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc
index d2b697f..e20ec79 100644
--- a/chrome/browser/banners/app_banner_manager.cc
+++ b/chrome/browser/banners/app_banner_manager.cc
@@ -60,7 +60,7 @@
}
bool AppBannerManager::IsFetcherActive() {
- return data_fetcher_ != nullptr && data_fetcher_->is_active();
+ return data_fetcher_ && data_fetcher_->is_active();
}
void AppBannerManager::DidNavigateMainFrame(
@@ -116,7 +116,7 @@
}
void AppBannerManager::CancelActiveFetcher() {
- if (data_fetcher_ != nullptr) {
+ if (data_fetcher_) {
data_fetcher_->Cancel();
data_fetcher_ = nullptr;
}
diff --git a/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc b/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc
index 594a0fe..d17ef8e 100644
--- a/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc
+++ b/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc
@@ -52,8 +52,7 @@
certificate_provider::CertificateInfo cert_info;
cert_info.certificate =
net::ImportCertFromFile(net::GetTestCertsDirectory(), cert_filename);
- EXPECT_NE(nullptr, cert_info.certificate) << "Could not load "
- << cert_filename;
+ EXPECT_TRUE(cert_info.certificate) << "Could not load " << cert_filename;
cert_info.type = net::SSLPrivateKey::Type::RSA;
cert_info.supported_hashes.push_back(net::SSLPrivateKey::Hash::SHA256);
cert_info.max_signature_length_in_bytes = 123;
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 8279251d..092dab23 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -568,7 +568,8 @@
? chrome::kThemePackMaterialDesignFilename
: chrome::kThemePackFilename);
SwapThemeSupplier(BrowserThemePack::BuildFromDataPack(path, current_id));
- loaded_pack = theme_supplier_ != nullptr;
+ if (theme_supplier_)
+ loaded_pack = true;
}
if (loaded_pack) {
diff --git a/chrome/browser/ui/views/certificate_selector_browsertest.cc b/chrome/browser/ui/views/certificate_selector_browsertest.cc
index 5824ccc..be8d611 100644
--- a/chrome/browser/ui/views/certificate_selector_browsertest.cc
+++ b/chrome/browser/ui/views/certificate_selector_browsertest.cc
@@ -74,11 +74,11 @@
void SetUpInProcessBrowserTestFixture() override {
client_1_ =
net::ImportCertFromFile(net::GetTestCertsDirectory(), "client_1.pem");
- ASSERT_NE(nullptr, client_1_);
+ ASSERT_TRUE(client_1_);
client_2_ =
net::ImportCertFromFile(net::GetTestCertsDirectory(), "client_2.pem");
- ASSERT_NE(nullptr, client_2_);
+ ASSERT_TRUE(client_2_);
}
void SetUpOnMainThread() override {
diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc
index c55d106..97e1f611 100644
--- a/chrome/browser/ui/webui/options/password_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/password_manager_handler.cc
@@ -374,7 +374,7 @@
}
}
UMA_HISTOGRAM_BOOLEAN("PasswordManager.StorePasswordImportedFromCSVResult",
- store);
+ static_cast<bool>(store));
}
void PasswordManagerHandler::HandlePasswordExport(const base::ListValue* args) {
diff --git a/components/drive/drive_uploader.cc b/components/drive/drive_uploader.cc
index 93a0287..2253c82 100644
--- a/components/drive/drive_uploader.cc
+++ b/components/drive/drive_uploader.cc
@@ -200,7 +200,7 @@
}
void DriveUploader::StartBatchProcessing() {
- DCHECK(current_batch_request_ == nullptr);
+ DCHECK(!current_batch_request_);
current_batch_request_ =
new RefCountedBatchRequest(drive_service_->StartBatchRequest());
}
diff --git a/components/suggestions/image_manager_unittest.cc b/components/suggestions/image_manager_unittest.cc
index 8f6e1e7..76562b9e 100644
--- a/components/suggestions/image_manager_unittest.cc
+++ b/components/suggestions/image_manager_unittest.cc
@@ -204,7 +204,7 @@
// Expect something in the cache.
auto encoded_image =
image_manager_->GetEncodedImageFromCache(GURL(kTestUrl1));
- EXPECT_NE(nullptr, encoded_image);
+ EXPECT_TRUE(encoded_image);
base::RunLoop run_loop;
image_manager_->GetImageForURL(GURL(kTestUrl1),
diff --git a/components/tracing/child_memory_dump_manager_delegate_impl.cc b/components/tracing/child_memory_dump_manager_delegate_impl.cc
index ced940b..47711eb 100644
--- a/components/tracing/child_memory_dump_manager_delegate_impl.cc
+++ b/components/tracing/child_memory_dump_manager_delegate_impl.cc
@@ -40,7 +40,7 @@
const auto& task_runner = ctmf ? (ctmf->ipc_task_runner()) : nullptr;
// Check that we are either registering the CTMF or tearing it down, but not
// replacing a valid instance with another one (should never happen).
- DCHECK(ctmf_ == nullptr || (ctmf == nullptr && ctmf_task_runner_ != nullptr));
+ DCHECK(!ctmf_ || (!ctmf && ctmf_task_runner_));
ctmf_ = ctmf;
{
diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc
index 9fb59c3..c1e9820e 100644
--- a/content/browser/cache_storage/cache_storage.cc
+++ b/content/browser/cache_storage/cache_storage.cc
@@ -706,7 +706,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::IO);
UMA_HISTOGRAM_BOOLEAN("ServiceWorkerCache.CreateCacheStorageResult",
- cache != nullptr);
+ static_cast<bool>(cache));
if (!cache.get()) {
callback.Run(scoped_refptr<CacheStorageCache>(),
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index aded099..b7b554e 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -286,7 +286,7 @@
compositor->widget());
#endif
- const bool use_vulkan = SharedVulkanContextProvider();
+ const bool use_vulkan = static_cast<bool>(SharedVulkanContextProvider());
const bool create_gpu_output_surface =
ShouldCreateGpuOutputSurface(compositor.get());
diff --git a/content/browser/media/webrtc/webrtc_internals.cc b/content/browser/media/webrtc/webrtc_internals.cc
index 1ebc884..09d7a97 100644
--- a/content/browser/media/webrtc/webrtc_internals.cc
+++ b/content/browser/media/webrtc/webrtc_internals.cc
@@ -278,7 +278,7 @@
EnableAudioDebugRecordingsOnAllRenderProcessHosts();
#else
selecting_event_log_ = false;
- DCHECK(select_file_dialog_ == nullptr);
+ DCHECK(!select_file_dialog_);
select_file_dialog_ = ui::SelectFileDialog::Create(this, NULL);
select_file_dialog_->SelectFile(
ui::SelectFileDialog::SELECT_SAVEAS_FILE,
@@ -330,7 +330,7 @@
EnableEventLogRecordingsOnAllRenderProcessHosts();
#else
DCHECK(web_contents);
- DCHECK(select_file_dialog_ == nullptr);
+ DCHECK(!select_file_dialog_);
selecting_event_log_ = true;
select_file_dialog_ = ui::SelectFileDialog::Create(this, nullptr);
select_file_dialog_->SelectFile(
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 0062c66c..d05ae35 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -348,7 +348,7 @@
switches::kEnableVulkan)) {
scoped_refptr<cc::VulkanInProcessContextProvider>* context_provider =
g_shared_vulkan_context_provider_android_.Pointer();
- if (*context_provider == NULL)
+ if (!*context_provider)
*context_provider = cc::VulkanInProcessContextProvider::Create();
return *context_provider;
}
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 9204a93..29a4268 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -724,7 +724,7 @@
}
bool ChildThreadImpl::IsInBrowserProcess() const {
- return browser_process_io_runner_;
+ return static_cast<bool>(browser_process_io_runner_);
}
} // namespace content
diff --git a/content/child/shared_memory_data_consumer_handle.cc b/content/child/shared_memory_data_consumer_handle.cc
index a974d5c..3ceec35 100644
--- a/content/child/shared_memory_data_consumer_handle.cc
+++ b/content/child/shared_memory_data_consumer_handle.cc
@@ -163,7 +163,7 @@
}
bool is_handle_locked() const {
lock_.AssertAcquired();
- return notification_task_runner_;
+ return static_cast<bool>(notification_task_runner_);
}
bool IsReaderBoundToCurrentThread() const {
lock_.AssertAcquired();
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 977c459..eab113b4 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -1293,7 +1293,7 @@
bool WebMediaPlayerAndroid::HasCurrentFrame() {
base::AutoLock auto_lock(current_frame_lock_);
- return current_frame_;
+ return static_cast<bool>(current_frame_);
}
scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() {
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
index 68f5b0a..f6d8e32 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -116,7 +116,7 @@
PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() {
DVLOG(1) << "~PeerConnectionDependencyFactory()";
- DCHECK(pc_factory_ == NULL);
+ DCHECK(!pc_factory_);
}
blink::WebRTCPeerConnectionHandler*
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index bb9f422..76ddce5 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4410,10 +4410,10 @@
}
bool RenderFrameImpl::IsLocalRoot() const {
- bool is_local_root = render_widget_ != nullptr;
+ bool is_local_root = static_cast<bool>(render_widget_);
DCHECK_EQ(is_local_root,
!(frame_->parent() && frame_->parent()->isWebLocalFrame()));
- return render_widget_ != nullptr;
+ return is_local_root;
}
// Tell the embedding application that the URL of the active page has changed.
diff --git a/device/bluetooth/bluetooth_adapter_win.cc b/device/bluetooth/bluetooth_adapter_win.cc
index b0af257..76e1278 100644
--- a/device/bluetooth/bluetooth_adapter_win.cc
+++ b/device/bluetooth/bluetooth_adapter_win.cc
@@ -358,7 +358,7 @@
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner) {
ui_task_runner_ = ui_task_runner;
- if (ui_task_runner_ == nullptr)
+ if (!ui_task_runner_)
ui_task_runner_ = base::ThreadTaskRunnerHandle::Get();
task_manager_ =
new BluetoothTaskManagerWin(ui_task_runner_);
diff --git a/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc
index 6ecb6f7..7162754 100644
--- a/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc
+++ b/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc
@@ -200,7 +200,7 @@
TEST_F(BluetoothAdvertisementBlueZTest, RegisterSucceeded) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
- EXPECT_NE(nullptr, advertisement);
+ EXPECT_TRUE(advertisement);
UnregisterAdvertisement(advertisement);
ExpectSuccess();
@@ -209,18 +209,18 @@
TEST_F(BluetoothAdvertisementBlueZTest, DoubleRegisterFailed) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
- EXPECT_NE(nullptr, advertisement);
+ EXPECT_TRUE(advertisement);
// Creating a second advertisement should give us an error.
scoped_refptr<BluetoothAdvertisement> advertisement2 = CreateAdvertisement();
ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_ALREADY_EXISTS);
- EXPECT_EQ(nullptr, advertisement2);
+ EXPECT_FALSE(advertisement2);
}
TEST_F(BluetoothAdvertisementBlueZTest, DoubleUnregisterFailed) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
- EXPECT_NE(nullptr, advertisement);
+ EXPECT_TRUE(advertisement);
UnregisterAdvertisement(advertisement);
ExpectSuccess();
@@ -234,7 +234,7 @@
TEST_F(BluetoothAdvertisementBlueZTest, UnregisterAfterReleasedFailed) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
- EXPECT_NE(nullptr, advertisement);
+ EXPECT_TRUE(advertisement);
observer_.reset(new TestAdvertisementObserver(advertisement));
TriggerReleased(advertisement);
diff --git a/device/usb/usb_device_handle_impl.cc b/device/usb/usb_device_handle_impl.cc
index c7138c4..d6574315 100644
--- a/device/usb/usb_device_handle_impl.cc
+++ b/device/usb/usb_device_handle_impl.cc
@@ -862,7 +862,7 @@
interface_claimer;
RefreshEndpointMap();
}
- callback.Run(interface_claimer);
+ callback.Run(static_cast<bool>(interface_claimer));
}
void UsbDeviceHandleImpl::SetInterfaceAlternateSettingOnBlockingThread(
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 4548a72..ee06435 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -858,7 +858,7 @@
#endif
TEST_F(GLES2ImplementationTest, Basic) {
- EXPECT_TRUE(gl_->share_group() != NULL);
+ EXPECT_TRUE(gl_->share_group());
}
TEST_F(GLES2ImplementationTest, GetBucketContents) {
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 06ecbfe5..004a2bc 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -5093,7 +5093,7 @@
scoped_refptr<net::X509Certificate> cert =
web::CreateCertFromChain([_webView certificateChain]);
UMA_HISTOGRAM_BOOLEAN("WebController.WKWebViewHasCertForSecureConnection",
- cert);
+ static_cast<bool>(cert));
}
}
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/media/blink/video_frame_compositor.cc b/media/blink/video_frame_compositor.cc
index 0fe244c..eda58e35 100644
--- a/media/blink/video_frame_compositor.cc
+++ b/media/blink/video_frame_compositor.cc
@@ -105,7 +105,7 @@
bool VideoFrameCompositor::HasCurrentFrame() {
DCHECK(compositor_task_runner_->BelongsToCurrentThread());
- return current_frame_;
+ return static_cast<bool>(current_frame_);
}
void VideoFrameCompositor::Start(RenderCallback* callback) {
diff --git a/media/gpu/h264_decoder.cc b/media/gpu/h264_decoder.cc
index 8bb39d8..91a1d497 100644
--- a/media/gpu/h264_decoder.cc
+++ b/media/gpu/h264_decoder.cc
@@ -1141,7 +1141,7 @@
bool H264Decoder::FinishPrevFrameIfPresent() {
// If we already have a frame waiting to be decoded, decode it and finish.
- if (curr_pic_ != NULL) {
+ if (curr_pic_) {
if (!DecodePicture())
return false;
diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc
index f38e2abf..df391050 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..42ac8654 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));
}
diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc
index b3b0672b..f4eb33d2 100644
--- a/net/proxy/proxy_script_decider_unittest.cc
+++ b/net/proxy/proxy_script_decider_unittest.cc
@@ -235,7 +235,7 @@
EXPECT_EQ(kFailedDownloading,
decider.Start(config, base::TimeDelta(), true,
callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
// Check the NetLog was filled correctly.
TestNetLogEntry::List entries;
@@ -270,7 +270,7 @@
EXPECT_EQ(kFailedParsing,
decider.Start(config, base::TimeDelta(), true,
callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
}
// Fail downloading the custom PAC script, because the fetcher was NULL.
@@ -286,7 +286,7 @@
EXPECT_EQ(ERR_UNEXPECTED,
decider.Start(config, base::TimeDelta(), true,
callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
}
// Succeeds in choosing autodetect (WPAD DNS).
@@ -550,7 +550,7 @@
EXPECT_EQ(kFailedDownloading,
decider.Start(config, base::TimeDelta(), true,
callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
}
// Fails at WPAD (downloading), and fails at custom PAC (parsing).
@@ -571,7 +571,7 @@
EXPECT_EQ(kFailedParsing,
decider.Start(config, base::TimeDelta(), true,
callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
}
// This is a copy-paste of CustomPacFails1, with the exception that we give it
@@ -595,7 +595,7 @@
true, callback.callback()));
EXPECT_EQ(kFailedDownloading, callback.WaitForResult());
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
// Check the NetLog was filled correctly.
TestNetLogEntry::List entries;
@@ -635,7 +635,7 @@
EXPECT_EQ(kFailedDownloading,
decider.Start(config, base::TimeDelta::FromSeconds(-5),
true, callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
// Check the NetLog was filled correctly.
TestNetLogEntry::List entries;
@@ -725,7 +725,7 @@
// it failed downloading, not that it failed parsing.
EXPECT_EQ(kFailedDownloading,
decider.Start(config, base::TimeDelta(), true, callback.callback()));
- EXPECT_EQ(nullptr, decider.script_data());
+ EXPECT_FALSE(decider.script_data());
EXPECT_FALSE(decider.effective_config().has_pac_url());
}
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc
index dc023bbe..3b59df4 100644
--- a/net/quic/crypto/quic_crypto_server_config.cc
+++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -1009,8 +1009,7 @@
HandshakeFailureReason source_address_token_error = MAX_FAILURE_REASON;
StringPiece srct;
if (client_hello.GetStringPiece(kSourceAddressTokenTag, &srct)) {
- Config& config =
- requested_config != nullptr ? *requested_config : *primary_config;
+ Config& config = requested_config ? *requested_config : *primary_config;
source_address_token_error =
ParseSourceAddressToken(config, srct, &info->source_address_tokens);
diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc
index 91ab99b..90fd728 100644
--- a/ui/gfx/win/direct_write.cc
+++ b/ui/gfx/win/direct_write.cc
@@ -54,7 +54,7 @@
base::win::ScopedComPtr<IDWriteFactory> factory;
CreateDWriteFactory(factory.Receive());
- if (factory == nullptr)
+ if (!factory)
return;
// The skia call to create a new DirectWrite font manager instance can fail
diff --git a/ui/gl/gl_image_ozone_native_pixmap_unittest.cc b/ui/gl/gl_image_ozone_native_pixmap_unittest.cc
index 223ba69..1e5ef132 100644
--- a/ui/gl/gl_image_ozone_native_pixmap_unittest.cc
+++ b/ui/gl/gl_image_ozone_native_pixmap_unittest.cc
@@ -25,7 +25,7 @@
surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size,
gfx::BufferFormat::RGBA_8888,
gfx::BufferUsage::SCANOUT);
- EXPECT_TRUE(pixmap != nullptr);
+ EXPECT_TRUE(pixmap);
scoped_refptr<gfx::GLImageOzoneNativePixmap> image(
new gfx::GLImageOzoneNativePixmap(size, GL_RGBA));
EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat()));
diff --git a/ui/ozone/platform/drm/host/drm_cursor.cc b/ui/ozone/platform/drm/host/drm_cursor.cc
index b3acdc47..6ee48c8 100644
--- a/ui/ozone/platform/drm/host/drm_cursor.cc
+++ b/ui/ozone/platform/drm/host/drm_cursor.cc
@@ -197,7 +197,7 @@
bool DrmCursor::IsCursorVisible() {
base::AutoLock lock(lock_);
- return bitmap_;
+ return static_cast<bool>(bitmap_);
}
gfx::PointF DrmCursor::GetLocation() {