summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviettrungluu <viettrungluu@chromium.org>2014-09-24 16:32:54 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-24 23:46:17 +0000
commitf538bf10cbad94f7a63c5b6cbaaed61e7ff698db (patch)
treeb53f31c0b4f750d4880cc81efdf6ca4e4dad9824
parente9bc87f33688e6b8f9bdaa71031ad07fb6da086c (diff)
downloadchromium_src-f538bf10cbad94f7a63c5b6cbaaed61e7ff698db.zip
chromium_src-f538bf10cbad94f7a63c5b6cbaaed61e7ff698db.tar.gz
chromium_src-f538bf10cbad94f7a63c5b6cbaaed61e7ff698db.tar.bz2
Mojo: NULL -> nullptr in mojo/system and mojo/embedder.
R=jamesr@chromium.org Review URL: https://codereview.chromium.org/597413002 Cr-Commit-Position: refs/heads/master@{#296560}
-rw-r--r--mojo/embedder/channel_init.cc2
-rw-r--r--mojo/embedder/embedder_unittest.cc96
-rw-r--r--mojo/embedder/platform_channel_pair_posix_unittest.cc2
-rw-r--r--mojo/embedder/platform_channel_pair_win.cc39
-rw-r--r--mojo/embedder/simple_platform_shared_buffer.cc4
-rw-r--r--mojo/embedder/simple_platform_shared_buffer_posix.cc2
-rw-r--r--mojo/embedder/simple_platform_shared_buffer_win.cc4
-rw-r--r--mojo/embedder/test_embedder.cc2
-rw-r--r--mojo/system/channel.cc8
-rw-r--r--mojo/system/channel_endpoint.cc2
-rw-r--r--mojo/system/channel_unittest.cc11
-rw-r--r--mojo/system/core.cc14
-rw-r--r--mojo/system/core_test_base.cc2
-rw-r--r--mojo/system/core_unittest.cc8
-rw-r--r--mojo/system/data_pipe.cc4
-rw-r--r--mojo/system/data_pipe_consumer_dispatcher.cc4
-rw-r--r--mojo/system/data_pipe_producer_dispatcher.cc4
-rw-r--r--mojo/system/dispatcher.cc2
-rw-r--r--mojo/system/dispatcher.h2
-rw-r--r--mojo/system/dispatcher_unittest.cc18
-rw-r--r--mojo/system/entrypoints.cc2
-rw-r--r--mojo/system/handle_table.cc2
-rw-r--r--mojo/system/local_data_pipe_unittest.cc166
-rw-r--r--mojo/system/local_message_pipe_endpoint.cc2
-rw-r--r--mojo/system/memory.h6
-rw-r--r--mojo/system/memory_unittest.cc8
-rw-r--r--mojo/system/message_in_transit.h2
-rw-r--r--mojo/system/message_pipe.cc2
-rw-r--r--mojo/system/message_pipe_dispatcher.cc6
-rw-r--r--mojo/system/message_pipe_dispatcher_unittest.cc55
-rw-r--r--mojo/system/message_pipe_perftest.cc14
-rw-r--r--mojo/system/message_pipe_test_utils.cc4
-rw-r--r--mojo/system/message_pipe_unittest.cc78
-rw-r--r--mojo/system/multiprocess_message_pipe_unittest.cc36
-rw-r--r--mojo/system/platform_handle_dispatcher_unittest.cc2
-rw-r--r--mojo/system/proxy_message_pipe_endpoint.cc2
-rw-r--r--mojo/system/raw_channel.cc12
-rw-r--r--mojo/system/raw_channel_posix.cc4
-rw-r--r--mojo/system/raw_channel_unittest.cc4
-rw-r--r--mojo/system/raw_channel_win.cc20
-rw-r--r--mojo/system/remote_message_pipe_unittest.cc162
-rw-r--r--mojo/system/shared_buffer_dispatcher.cc6
-rw-r--r--mojo/system/simple_dispatcher_unittest.cc26
-rw-r--r--mojo/system/transport_data.cc2
44 files changed, 440 insertions, 413 deletions
diff --git a/mojo/embedder/channel_init.cc b/mojo/embedder/channel_init.cc
index 31cb500..4c15c83 100644
--- a/mojo/embedder/channel_init.cc
+++ b/mojo/embedder/channel_init.cc
@@ -11,7 +11,7 @@
namespace mojo {
namespace embedder {
-ChannelInit::ChannelInit() : channel_info_(NULL), weak_factory_(this) {
+ChannelInit::ChannelInit() : channel_info_(nullptr), weak_factory_(this) {
}
ChannelInit::~ChannelInit() {
diff --git a/mojo/embedder/embedder_unittest.cc b/mojo/embedder/embedder_unittest.cc
index 8ba7db8..d41df96 100644
--- a/mojo/embedder/embedder_unittest.cc
+++ b/mojo/embedder/embedder_unittest.cc
@@ -37,13 +37,13 @@ class ScopedTestChannel {
: io_thread_task_runner_(io_thread_task_runner),
bootstrap_message_pipe_(MOJO_HANDLE_INVALID),
did_create_channel_event_(true, false),
- channel_info_(NULL) {
+ channel_info_(nullptr) {
bootstrap_message_pipe_ =
CreateChannel(platform_handle.Pass(),
io_thread_task_runner_,
base::Bind(&ScopedTestChannel::DidCreateChannel,
base::Unretained(this)),
- NULL)
+ nullptr)
.release()
.value();
CHECK_NE(bootstrap_message_pipe_, MOJO_HANDLE_INVALID);
@@ -78,7 +78,7 @@ class ScopedTestChannel {
void DestroyChannel() {
CHECK(channel_info_);
DestroyChannelOnIOThread(channel_info_);
- channel_info_ = NULL;
+ channel_info_ = nullptr;
}
scoped_refptr<base::TaskRunner> io_thread_task_runner_;
@@ -133,7 +133,7 @@ TEST_F(EmbedderTest, ChannelsBasic) {
MojoWriteMessage(server_mp,
kHello,
static_cast<uint32_t>(sizeof(kHello)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -149,8 +149,8 @@ TEST_F(EmbedderTest, ChannelsBasic) {
MojoReadMessage(client_mp,
buffer,
&num_bytes,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), num_bytes);
EXPECT_STREQ(kHello, buffer);
@@ -163,8 +163,8 @@ TEST_F(EmbedderTest, ChannelsBasic) {
// the server and client channels were completely created).
server_channel.WaitForChannelCreationCompletion();
client_channel.WaitForChannelCreationCompletion();
- EXPECT_TRUE(server_channel.channel_info() != NULL);
- EXPECT_TRUE(client_channel.channel_info() != NULL);
+ EXPECT_TRUE(server_channel.channel_info());
+ EXPECT_TRUE(client_channel.channel_info());
}
EXPECT_TRUE(test::Shutdown());
@@ -185,7 +185,7 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
EXPECT_NE(client_mp, MOJO_HANDLE_INVALID);
MojoHandle h0, h1;
- EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &h0, &h1));
+ EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &h0, &h1));
// Write a message to |h0| (attaching nothing).
const char kHello[] = "hello";
@@ -193,7 +193,7 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
MojoWriteMessage(h0,
kHello,
static_cast<uint32_t>(sizeof(kHello)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -214,7 +214,7 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
MojoWriteMessage(h0,
kFoo,
static_cast<uint32_t>(sizeof(kFoo)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -271,10 +271,13 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
// Read the second message from |h1|.
memset(buffer, 0, sizeof(buffer));
num_bytes = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(
- MOJO_RESULT_OK,
- MojoReadMessage(
- h1, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ MojoReadMessage(h1,
+ buffer,
+ &num_bytes,
+ nullptr,
+ nullptr,
+ MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kFoo), num_bytes);
EXPECT_STREQ(kFoo, buffer);
@@ -284,7 +287,7 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
MojoWriteMessage(h1,
kBarBaz,
static_cast<uint32_t>(sizeof(kBarBaz)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -296,10 +299,13 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
// Read a message from |h0|.
memset(buffer, 0, sizeof(buffer));
num_bytes = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(
- MOJO_RESULT_OK,
- MojoReadMessage(
- h0, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ MojoReadMessage(h0,
+ buffer,
+ &num_bytes,
+ nullptr,
+ nullptr,
+ MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kBarBaz), num_bytes);
EXPECT_STREQ(kBarBaz, buffer);
@@ -310,8 +316,8 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) {
server_channel.WaitForChannelCreationCompletion();
client_channel.WaitForChannelCreationCompletion();
- EXPECT_TRUE(server_channel.channel_info() != NULL);
- EXPECT_TRUE(client_channel.channel_info() != NULL);
+ EXPECT_TRUE(server_channel.channel_info());
+ EXPECT_TRUE(client_channel.channel_info());
}
EXPECT_TRUE(test::Shutdown());
@@ -343,7 +349,7 @@ TEST_F(EmbedderTest, MultiprocessChannels) {
MojoHandle server_mp = server_channel.bootstrap_message_pipe();
EXPECT_NE(server_mp, MOJO_HANDLE_INVALID);
server_channel.WaitForChannelCreationCompletion();
- EXPECT_TRUE(server_channel.channel_info() != NULL);
+ EXPECT_TRUE(server_channel.channel_info());
// 1. Write a message to |server_mp| (attaching nothing).
const char kHello[] = "hello";
@@ -351,7 +357,7 @@ TEST_F(EmbedderTest, MultiprocessChannels) {
MojoWriteMessage(server_mp,
kHello,
static_cast<uint32_t>(sizeof(kHello)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -369,8 +375,8 @@ TEST_F(EmbedderTest, MultiprocessChannels) {
MojoReadMessage(server_mp,
buffer,
&num_bytes,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
const char kWorld[] = "world!";
EXPECT_EQ(sizeof(kWorld), num_bytes);
@@ -378,7 +384,7 @@ TEST_F(EmbedderTest, MultiprocessChannels) {
// Create a new message pipe (endpoints |mp0| and |mp1|).
MojoHandle mp0, mp1;
- EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &mp0, &mp1));
+ EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &mp0, &mp1));
// 3. Write something to |mp0|.
const char kFoo[] = "FOO";
@@ -386,7 +392,7 @@ TEST_F(EmbedderTest, MultiprocessChannels) {
MojoWriteMessage(mp0,
kFoo,
static_cast<uint32_t>(sizeof(kFoo)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -431,10 +437,13 @@ TEST_F(EmbedderTest, MultiprocessChannels) {
MojoWait(mp2, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE));
memset(buffer, 0, sizeof(buffer));
num_bytes = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(
- MOJO_RESULT_OK,
- MojoReadMessage(
- mp2, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ MojoReadMessage(mp2,
+ buffer,
+ &num_bytes,
+ nullptr,
+ nullptr,
+ MOJO_READ_MESSAGE_FLAG_NONE));
const char kBaz[] = "baz";
EXPECT_EQ(sizeof(kBaz), num_bytes);
EXPECT_STREQ(kBaz, buffer);
@@ -470,7 +479,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
MojoHandle client_mp = client_channel.bootstrap_message_pipe();
EXPECT_NE(client_mp, MOJO_HANDLE_INVALID);
client_channel.WaitForChannelCreationCompletion();
- CHECK(client_channel.channel_info() != NULL);
+ CHECK(client_channel.channel_info() != nullptr);
// 1. Read the first message from |client_mp|.
EXPECT_EQ(
@@ -483,8 +492,8 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
MojoReadMessage(client_mp,
buffer,
&num_bytes,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
const char kHello[] = "hello";
EXPECT_EQ(sizeof(kHello), num_bytes);
@@ -496,7 +505,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
MojoWriteMessage(client_mp,
kWorld,
static_cast<uint32_t>(sizeof(kWorld)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -532,7 +541,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
// Create a new message pipe (endpoints |mp2| and |mp3|).
MojoHandle mp2, mp3;
- EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &mp2, &mp3));
+ EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &mp2, &mp3));
// 7. Write a message to |mp3|.
const char kBaz[] = "baz";
@@ -540,7 +549,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
MojoWriteMessage(mp3,
kBaz,
static_cast<uint32_t>(sizeof(kBaz)),
- NULL,
+ nullptr,
0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
@@ -564,10 +573,13 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE));
memset(buffer, 0, sizeof(buffer));
num_bytes = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(
- MOJO_RESULT_OK,
- MojoReadMessage(
- mp1, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ MojoReadMessage(mp1,
+ buffer,
+ &num_bytes,
+ nullptr,
+ nullptr,
+ MOJO_READ_MESSAGE_FLAG_NONE));
const char kFoo[] = "FOO";
EXPECT_EQ(sizeof(kFoo), num_bytes);
EXPECT_STREQ(kFoo, buffer);
diff --git a/mojo/embedder/platform_channel_pair_posix_unittest.cc b/mojo/embedder/platform_channel_pair_posix_unittest.cc
index 8ca354f..523b767 100644
--- a/mojo/embedder/platform_channel_pair_posix_unittest.cc
+++ b/mojo/embedder/platform_channel_pair_posix_unittest.cc
@@ -53,7 +53,7 @@ class PlatformChannelPairPosixTest : public testing::Test {
virtual void TearDown() OVERRIDE {
// Restore the |SIGPIPE| handler.
- ASSERT_EQ(0, sigaction(SIGPIPE, &old_action_, NULL));
+ ASSERT_EQ(0, sigaction(SIGPIPE, &old_action_, nullptr));
}
private:
diff --git a/mojo/embedder/platform_channel_pair_win.cc b/mojo/embedder/platform_channel_pair_win.cc
index a130e74..a9130b4 100644
--- a/mojo/embedder/platform_channel_pair_win.cc
+++ b/mojo/embedder/platform_channel_pair_win.cc
@@ -36,15 +36,15 @@ PlatformChannelPair::PlatformChannelPair() {
const DWORD kOpenMode =
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE;
const DWORD kPipeMode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE;
- server_handle_.reset(
- PlatformHandle(CreateNamedPipeW(pipe_name.c_str(),
- kOpenMode,
- kPipeMode,
- 1, // Max instances.
- 4096, // Out buffer size.
- 4096, // In buffer size.
- 5000, // Timeout in milliseconds.
- NULL))); // Default security descriptor.
+ server_handle_.reset(PlatformHandle(
+ CreateNamedPipeW(pipe_name.c_str(),
+ kOpenMode,
+ kPipeMode,
+ 1, // Max instances.
+ 4096, // Out buffer size.
+ 4096, // In buffer size.
+ 5000, // Timeout in milliseconds.
+ nullptr))); // Default security descriptor.
PCHECK(server_handle_.is_valid());
const DWORD kDesiredAccess = GENERIC_READ | GENERIC_WRITE;
@@ -53,20 +53,21 @@ PlatformChannelPair::PlatformChannelPair() {
const DWORD kFlags =
SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS | FILE_FLAG_OVERLAPPED;
// Allow the handle to be inherited by child processes.
- SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), NULL,
- TRUE};
- client_handle_.reset(PlatformHandle(CreateFileW(pipe_name.c_str(),
- kDesiredAccess,
- 0, // No sharing.
- &security_attributes,
- OPEN_EXISTING,
- kFlags,
- NULL))); // No template file.
+ SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES),
+ nullptr, TRUE};
+ client_handle_.reset(
+ PlatformHandle(CreateFileW(pipe_name.c_str(),
+ kDesiredAccess,
+ 0, // No sharing.
+ &security_attributes,
+ OPEN_EXISTING,
+ kFlags,
+ nullptr))); // No template file.
PCHECK(client_handle_.is_valid());
// Since a client has connected, ConnectNamedPipe() should return zero and
// GetLastError() should return ERROR_PIPE_CONNECTED.
- CHECK(!ConnectNamedPipe(server_handle_.get().handle, NULL));
+ CHECK(!ConnectNamedPipe(server_handle_.get().handle, nullptr));
PCHECK(GetLastError() == ERROR_PIPE_CONNECTED);
}
diff --git a/mojo/embedder/simple_platform_shared_buffer.cc b/mojo/embedder/simple_platform_shared_buffer.cc
index 278de00..fc5ee8c 100644
--- a/mojo/embedder/simple_platform_shared_buffer.cc
+++ b/mojo/embedder/simple_platform_shared_buffer.cc
@@ -20,7 +20,7 @@ SimplePlatformSharedBuffer* SimplePlatformSharedBuffer::Create(
// We can't just delete it directly, due to the "in destructor" (debug)
// check.
scoped_refptr<SimplePlatformSharedBuffer> deleter(rv);
- return NULL;
+ return nullptr;
}
return rv;
@@ -38,7 +38,7 @@ SimplePlatformSharedBuffer::CreateFromPlatformHandle(
// We can't just delete it directly, due to the "in destructor" (debug)
// check.
scoped_refptr<SimplePlatformSharedBuffer> deleter(rv);
- return NULL;
+ return nullptr;
}
return rv;
diff --git a/mojo/embedder/simple_platform_shared_buffer_posix.cc b/mojo/embedder/simple_platform_shared_buffer_posix.cc
index 3076aa8..55ec73c 100644
--- a/mojo/embedder/simple_platform_shared_buffer_posix.cc
+++ b/mojo/embedder/simple_platform_shared_buffer_posix.cc
@@ -127,7 +127,7 @@ scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::MapImpl(
DCHECK_LE(static_cast<uint64_t>(real_offset),
static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
- void* real_base = mmap(NULL,
+ void* real_base = mmap(nullptr,
real_length,
PROT_READ | PROT_WRITE,
MAP_SHARED,
diff --git a/mojo/embedder/simple_platform_shared_buffer_win.cc b/mojo/embedder/simple_platform_shared_buffer_win.cc
index d2caa2e..1167ac5 100644
--- a/mojo/embedder/simple_platform_shared_buffer_win.cc
+++ b/mojo/embedder/simple_platform_shared_buffer_win.cc
@@ -34,11 +34,11 @@ bool SimplePlatformSharedBuffer::Init() {
// multiple of 64 KB). This may cause problems with NaCl. Cross this bridge
// when we get there. crbug.com/210609
handle_.reset(PlatformHandle(CreateFileMapping(INVALID_HANDLE_VALUE,
- NULL,
+ nullptr,
PAGE_READWRITE,
0,
static_cast<DWORD>(num_bytes_),
- NULL)));
+ nullptr)));
if (!handle_.is_valid()) {
PLOG(ERROR) << "CreateFileMapping";
return false;
diff --git a/mojo/embedder/test_embedder.cc b/mojo/embedder/test_embedder.cc
index 7f50abb..f388423 100644
--- a/mojo/embedder/test_embedder.cc
+++ b/mojo/embedder/test_embedder.cc
@@ -48,7 +48,7 @@ void InitWithSimplePlatformSupport() {
bool Shutdown() {
system::Core* core = system::entrypoints::GetCore();
CHECK(core);
- system::entrypoints::SetCore(NULL);
+ system::entrypoints::SetCore(nullptr);
bool rv = system::internal::ShutdownCheckNoLeaks(core);
delete core;
diff --git a/mojo/system/channel.cc b/mojo/system/channel.cc
index f466539..8c8be07 100644
--- a/mojo/system/channel.cc
+++ b/mojo/system/channel.cc
@@ -246,7 +246,7 @@ void Channel::DetachMessagePipeEndpoint(
switch (it->second->state_) {
case ChannelEndpoint::STATE_NORMAL:
it->second->state_ = ChannelEndpoint::STATE_WAIT_REMOTE_REMOVE_ACK;
- it->second->message_pipe_ = NULL;
+ it->second->message_pipe_ = nullptr;
if (remote_id == MessageInTransit::kInvalidEndpointId)
return;
// We have to send a remove message (outside the lock).
@@ -495,7 +495,7 @@ bool Channel::RemoveMessagePipeEndpoint(
it->second->state_ = ChannelEndpoint::STATE_WAIT_LOCAL_DETACH;
message_pipe = it->second->message_pipe_;
port = it->second->port_;
- it->second->message_pipe_ = NULL;
+ it->second->message_pipe_ = nullptr;
// We have to send a remove ack message (outside the lock).
break;
case ChannelEndpoint::STATE_WAIT_LOCAL_DETACH:
@@ -534,8 +534,8 @@ bool Channel::SendControlMessage(MessageInTransit::Subtype subtype,
MessageInTransit::EndpointId remote_id) {
DVLOG(2) << "Sending channel control message: subtype " << subtype
<< ", local ID " << local_id << ", remote ID " << remote_id;
- scoped_ptr<MessageInTransit> message(
- new MessageInTransit(MessageInTransit::kTypeChannel, subtype, 0, NULL));
+ scoped_ptr<MessageInTransit> message(new MessageInTransit(
+ MessageInTransit::kTypeChannel, subtype, 0, nullptr));
message->set_source_id(local_id);
message->set_destination_id(remote_id);
return WriteMessage(message.Pass());
diff --git a/mojo/system/channel_endpoint.cc b/mojo/system/channel_endpoint.cc
index dd0deb2..d788f90 100644
--- a/mojo/system/channel_endpoint.cc
+++ b/mojo/system/channel_endpoint.cc
@@ -85,7 +85,7 @@ void ChannelEndpoint::DetachFromChannel() {
DCHECK_NE(local_id_, MessageInTransit::kInvalidEndpointId);
// TODO(vtl): Once we combine "run" into "attach", |remote_id_| should valid
// here as well.
- channel_ = NULL;
+ channel_ = nullptr;
local_id_ = MessageInTransit::kInvalidEndpointId;
remote_id_ = MessageInTransit::kInvalidEndpointId;
}
diff --git a/mojo/system/channel_unittest.cc b/mojo/system/channel_unittest.cc
index e710096..17e9548 100644
--- a/mojo/system/channel_unittest.cc
+++ b/mojo/system/channel_unittest.cc
@@ -110,7 +110,7 @@ TEST_F(ChannelTest, InitShutdown) {
// Okay to destroy |Channel| on not-the-I/O-thread.
EXPECT_TRUE(channel()->HasOneRef());
- *mutable_channel() = NULL;
+ *mutable_channel() = nullptr;
}
// ChannelTest.InitFails -------------------------------------------------------
@@ -178,7 +178,7 @@ TEST_F(ChannelTest, InitFails) {
// Should destroy |Channel| with no |Shutdown()| (on not-the-I/O-thread).
EXPECT_TRUE(channel()->HasOneRef());
- *mutable_channel() = NULL;
+ *mutable_channel() = nullptr;
}
// ChannelTest.CloseBeforeRun --------------------------------------------------
@@ -252,8 +252,9 @@ TEST_F(ChannelTest, ShutdownAfterAttach) {
Waiter waiter;
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
// Don't wait for the shutdown to run ...
io_thread()->PostTask(FROM_HERE,
@@ -262,7 +263,7 @@ TEST_F(ChannelTest, ShutdownAfterAttach) {
// ... since this |Wait()| should fail once the channel is shut down.
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- waiter.Wait(MOJO_DEADLINE_INDEFINITE, NULL));
+ waiter.Wait(MOJO_DEADLINE_INDEFINITE, nullptr));
HandleSignalsState hss;
mp->RemoveWaiter(0, &waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
diff --git a/mojo/system/core.cc b/mojo/system/core.cc
index 5e94609..db9d70f 100644
--- a/mojo/system/core.cc
+++ b/mojo/system/core.cc
@@ -90,7 +90,7 @@ MojoHandle Core::AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher) {
scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) {
if (handle == MOJO_HANDLE_INVALID)
- return NULL;
+ return nullptr;
base::AutoLock locker(handle_table_lock_);
return handle_table_.GetDispatcher(handle);
@@ -131,7 +131,7 @@ MojoResult Core::Wait(MojoHandle handle,
1,
deadline,
&unused,
- signals_state.IsNull() ? NULL : &hss);
+ signals_state.IsNull() ? nullptr : &hss);
if (rv != MOJO_RESULT_INVALID_ARGUMENT && !signals_state.IsNull())
signals_state.Put(hss);
return rv;
@@ -159,7 +159,7 @@ MojoResult Core::WaitMany(UserPointer<const MojoHandle> handles,
num_handles,
deadline,
&index,
- NULL);
+ nullptr);
} else {
UserPointer<MojoHandleSignalsState>::Writer signals_states_writer(
signals_states, num_handles);
@@ -236,7 +236,7 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
// Easy case: not sending any handles.
if (num_handles == 0)
- return dispatcher->WriteMessage(bytes, num_bytes, NULL, flags);
+ return dispatcher->WriteMessage(bytes, num_bytes, nullptr, flags);
// We have to handle |handles| here, since we have to mark them busy in the
// global handle table. We can't delegate this to the dispatcher, since the
@@ -309,7 +309,7 @@ MojoResult Core::ReadMessage(MojoHandle message_pipe_handle,
if (num_handles_value == 0) {
// Easy case: won't receive any handles.
rv = dispatcher->ReadMessage(
- bytes, num_bytes, NULL, &num_handles_value, flags);
+ bytes, num_bytes, nullptr, &num_handles_value, flags);
} else {
DispatcherVector dispatchers;
rv = dispatcher->ReadMessage(
@@ -574,7 +574,7 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
MojoResult rv = MOJO_RESULT_OK;
for (i = 0; i < num_handles; i++) {
rv = dispatchers[i]->AddWaiter(
- &waiter, signals[i], i, signals_states ? &signals_states[i] : NULL);
+ &waiter, signals[i], i, signals_states ? &signals_states[i] : nullptr);
if (rv != MOJO_RESULT_OK) {
*result_index = i;
break;
@@ -592,7 +592,7 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
// destroyed, but this would still be required if the waiter were in TLS.)
for (i = 0; i < num_added; i++) {
dispatchers[i]->RemoveWaiter(&waiter,
- signals_states ? &signals_states[i] : NULL);
+ signals_states ? &signals_states[i] : nullptr);
}
if (signals_states) {
for (; i < num_handles; i++)
diff --git a/mojo/system/core_test_base.cc b/mojo/system/core_test_base.cc
index ad61495..6fe3a70 100644
--- a/mojo/system/core_test_base.cc
+++ b/mojo/system/core_test_base.cc
@@ -181,7 +181,7 @@ void CoreTestBase::SetUp() {
void CoreTestBase::TearDown() {
delete core_;
- core_ = NULL;
+ core_ = nullptr;
}
MojoHandle CoreTestBase::CreateMockHandle(CoreTestBase::MockHandleInfo* info) {
diff --git a/mojo/system/core_unittest.cc b/mojo/system/core_unittest.cc
index 8d1441c..f229883 100644
--- a/mojo/system/core_unittest.cc
+++ b/mojo/system/core_unittest.cc
@@ -1097,7 +1097,7 @@ TEST_F(CoreTest, DataPipe) {
EXPECT_EQ(-1, elements[1]);
// Two-phase write.
- void* write_ptr = NULL;
+ void* write_ptr = nullptr;
num_bytes = 0u;
ASSERT_EQ(MOJO_RESULT_OK,
core()->BeginWriteData(ph,
@@ -1150,7 +1150,7 @@ TEST_F(CoreTest, DataPipe) {
MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_ALL_OR_NONE));
// Read the remaining two characters, in two-phase mode (all-or-none).
- const void* read_ptr = NULL;
+ const void* read_ptr = nullptr;
num_bytes = 2;
ASSERT_EQ(MOJO_RESULT_OK,
core()->BeginReadData(ch,
@@ -1361,7 +1361,7 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
ch_received = MOJO_HANDLE_INVALID;
// Make sure that |ph| can't be sent if it's in a two-phase write.
- void* write_ptr = NULL;
+ void* write_ptr = nullptr;
num_bytes = 0;
ASSERT_EQ(MOJO_RESULT_OK,
core()->BeginWriteData(ph,
@@ -1420,7 +1420,7 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
// Make sure that |ch| can't be sent if it's in a two-phase read.
- const void* read_ptr = NULL;
+ const void* read_ptr = nullptr;
num_bytes = 1;
ASSERT_EQ(MOJO_RESULT_OK,
core()->BeginReadData(ch,
diff --git a/mojo/system/data_pipe.cc b/mojo/system/data_pipe.cc
index dfef4c4..767657d 100644
--- a/mojo/system/data_pipe.cc
+++ b/mojo/system/data_pipe.cc
@@ -436,8 +436,8 @@ DataPipe::DataPipe(bool has_local_producer,
capacity_num_bytes_(validated_options.capacity_num_bytes),
producer_open_(true),
consumer_open_(true),
- producer_waiter_list_(has_local_producer ? new WaiterList() : NULL),
- consumer_waiter_list_(has_local_consumer ? new WaiterList() : NULL),
+ producer_waiter_list_(has_local_producer ? new WaiterList() : nullptr),
+ consumer_waiter_list_(has_local_consumer ? new WaiterList() : nullptr),
producer_two_phase_max_num_bytes_written_(0),
consumer_two_phase_max_num_bytes_read_(0) {
// Check that the passed in options actually are validated.
diff --git a/mojo/system/data_pipe_consumer_dispatcher.cc b/mojo/system/data_pipe_consumer_dispatcher.cc
index 2ca4726..fe083e0 100644
--- a/mojo/system/data_pipe_consumer_dispatcher.cc
+++ b/mojo/system/data_pipe_consumer_dispatcher.cc
@@ -36,7 +36,7 @@ void DataPipeConsumerDispatcher::CancelAllWaitersNoLock() {
void DataPipeConsumerDispatcher::CloseImplNoLock() {
lock().AssertAcquired();
data_pipe_->ConsumerClose();
- data_pipe_ = NULL;
+ data_pipe_ = nullptr;
}
scoped_refptr<Dispatcher>
@@ -46,7 +46,7 @@ DataPipeConsumerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
scoped_refptr<DataPipeConsumerDispatcher> rv =
new DataPipeConsumerDispatcher();
rv->Init(data_pipe_);
- data_pipe_ = NULL;
+ data_pipe_ = nullptr;
return scoped_refptr<Dispatcher>(rv.get());
}
diff --git a/mojo/system/data_pipe_producer_dispatcher.cc b/mojo/system/data_pipe_producer_dispatcher.cc
index 3850f1a..b7e7db3 100644
--- a/mojo/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/system/data_pipe_producer_dispatcher.cc
@@ -36,7 +36,7 @@ void DataPipeProducerDispatcher::CancelAllWaitersNoLock() {
void DataPipeProducerDispatcher::CloseImplNoLock() {
lock().AssertAcquired();
data_pipe_->ProducerClose();
- data_pipe_ = NULL;
+ data_pipe_ = nullptr;
}
scoped_refptr<Dispatcher>
@@ -46,7 +46,7 @@ DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
scoped_refptr<DataPipeProducerDispatcher> rv =
new DataPipeProducerDispatcher();
rv->Init(data_pipe_);
- data_pipe_ = NULL;
+ data_pipe_ = nullptr;
return scoped_refptr<Dispatcher>(rv.get());
}
diff --git a/mojo/system/dispatcher.cc b/mojo/system/dispatcher.cc
index 263ca29..214e291 100644
--- a/mojo/system/dispatcher.cc
+++ b/mojo/system/dispatcher.cc
@@ -482,7 +482,7 @@ bool Dispatcher::EndSerializeAndClose(
void DispatcherTransport::End() {
DCHECK(dispatcher_);
dispatcher_->lock_.Release();
- dispatcher_ = NULL;
+ dispatcher_ = nullptr;
}
} // namespace system
diff --git a/mojo/system/dispatcher.h b/mojo/system/dispatcher.h
index 26f8091..6df2055 100644
--- a/mojo/system/dispatcher.h
+++ b/mojo/system/dispatcher.h
@@ -372,7 +372,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
// |Dispatcher*|.
class MOJO_SYSTEM_IMPL_EXPORT DispatcherTransport {
public:
- DispatcherTransport() : dispatcher_(NULL) {}
+ DispatcherTransport() : dispatcher_(nullptr) {}
void End();
diff --git a/mojo/system/dispatcher_unittest.cc b/mojo/system/dispatcher_unittest.cc
index 1a7bba5..3cce263 100644
--- a/mojo/system/dispatcher_unittest.cc
+++ b/mojo/system/dispatcher_unittest.cc
@@ -45,12 +45,12 @@ TEST(DispatcherTest, Basic) {
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
d->WriteMessage(
- NullUserPointer(), 0, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE));
+ NullUserPointer(), 0, nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
d->ReadMessage(NullUserPointer(),
NullUserPointer(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(
MOJO_RESULT_INVALID_ARGUMENT,
@@ -91,12 +91,12 @@ TEST(DispatcherTest, Basic) {
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
d->WriteMessage(
- NullUserPointer(), 0, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE));
+ NullUserPointer(), 0, nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
d->ReadMessage(NullUserPointer(),
NullUserPointer(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(
MOJO_RESULT_INVALID_ARGUMENT,
@@ -175,14 +175,14 @@ class ThreadSafetyStressThread : public base::SimpleThread {
EXPECT_EQ(
MOJO_RESULT_INVALID_ARGUMENT,
dispatcher_->WriteMessage(
- NullUserPointer(), 0, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE));
+ NullUserPointer(), 0, nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
break;
case READ_MESSAGE:
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
dispatcher_->ReadMessage(NullUserPointer(),
NullUserPointer(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
break;
case WRITE_DATA:
diff --git a/mojo/system/entrypoints.cc b/mojo/system/entrypoints.cc
index 32c7235..9b5d3bf 100644
--- a/mojo/system/entrypoints.cc
+++ b/mojo/system/entrypoints.cc
@@ -11,7 +11,7 @@
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/system/core.h"
-static mojo::system::Core* g_core = NULL;
+static mojo::system::Core* g_core = nullptr;
using mojo::system::MakeUserPointer;
diff --git a/mojo/system/handle_table.cc b/mojo/system/handle_table.cc
index e05e365..5c7c74c 100644
--- a/mojo/system/handle_table.cc
+++ b/mojo/system/handle_table.cc
@@ -36,7 +36,7 @@ Dispatcher* HandleTable::GetDispatcher(MojoHandle handle) {
HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle);
if (it == handle_to_entry_map_.end())
- return NULL;
+ return nullptr;
return it->second.dispatcher.get();
}
diff --git a/mojo/system/local_data_pipe_unittest.cc b/mojo/system/local_data_pipe_unittest.cc
index eb9eddd..e1079d9 100644
--- a/mojo/system/local_data_pipe_unittest.cc
+++ b/mojo/system/local_data_pipe_unittest.cc
@@ -254,9 +254,9 @@ TEST(LocalDataPipeTest, BasicProducerWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 56, NULL));
+ dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 56, nullptr));
// And it shouldn't be writable yet.
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ProducerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -266,7 +266,7 @@ TEST(LocalDataPipeTest, BasicProducerWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 78, NULL));
+ dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 78, nullptr));
// Read one element.
elements[0] = -1;
@@ -289,12 +289,12 @@ TEST(LocalDataPipeTest, BasicProducerWaiting) {
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfiable_signals);
// Try writing, using a two-phase write.
- void* buffer = NULL;
+ void* buffer = nullptr;
num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
EXPECT_EQ(MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
MakeUserPointer(&buffer), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(buffer != NULL);
+ EXPECT_TRUE(buffer);
EXPECT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
static_cast<int32_t*>(buffer)[0] = 789;
@@ -306,16 +306,16 @@ TEST(LocalDataPipeTest, BasicProducerWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 90, NULL));
+ dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 90, nullptr));
// Read one element, using a two-phase read.
- const void* read_buffer = NULL;
+ const void* read_buffer = nullptr;
num_bytes = 0u;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_buffer), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(read_buffer != NULL);
+ EXPECT_TRUE(read_buffer);
// Since we only read one element (after having written three in all), the
// two-phase read should only allow us to read one. This checks an
// implementation detail!
@@ -346,7 +346,7 @@ TEST(LocalDataPipeTest, BasicProducerWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 12, NULL));
+ dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 12, nullptr));
// Close the consumer.
dp->ConsumerClose();
@@ -391,10 +391,10 @@ TEST(LocalDataPipeTest, BasicConsumerWaiting) {
// Not yet readable.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 34, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ dp->ConsumerAddWaiter(
+ &waiter, MOJO_HANDLE_SIGNAL_READABLE, 34, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ConsumerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -446,9 +446,9 @@ TEST(LocalDataPipeTest, BasicConsumerWaiting) {
// Adding a waiter should now succeed.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 90, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ dp->ConsumerAddWaiter(
+ &waiter, MOJO_HANDLE_SIGNAL_READABLE, 90, nullptr));
// Write one element.
elements[0] = 789;
@@ -512,14 +512,14 @@ TEST(LocalDataPipeTest, BasicConsumerWaiting) {
HandleSignalsState hss;
// Write two elements.
- int32_t* elements = NULL;
- void* buffer = NULL;
+ int32_t* elements = nullptr;
+ void* buffer = nullptr;
// Request room for three (but we'll only write two).
uint32_t num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
EXPECT_EQ(MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
MakeUserPointer(&buffer), MakeUserPointer(&num_bytes), true));
- EXPECT_TRUE(buffer != NULL);
+ EXPECT_TRUE(buffer);
EXPECT_GE(num_bytes, static_cast<uint32_t>(3u * sizeof(elements[0])));
elements = static_cast<int32_t*>(buffer);
elements[0] = 123;
@@ -539,13 +539,13 @@ TEST(LocalDataPipeTest, BasicConsumerWaiting) {
// Read one element.
// Request two in all-or-none mode, but only read one.
- const void* read_buffer = NULL;
+ const void* read_buffer = nullptr;
num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_buffer), MakeUserPointer(&num_bytes), true));
- EXPECT_TRUE(read_buffer != NULL);
+ EXPECT_TRUE(read_buffer);
EXPECT_EQ(static_cast<uint32_t>(2u * sizeof(elements[0])), num_bytes);
const int32_t* read_elements = static_cast<const int32_t*>(read_buffer);
EXPECT_EQ(123, read_elements[0]);
@@ -564,13 +564,13 @@ TEST(LocalDataPipeTest, BasicConsumerWaiting) {
// Read one element.
// Request three, but not in all-or-none mode.
- read_buffer = NULL;
+ read_buffer = nullptr;
num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_buffer), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(read_buffer != NULL);
+ EXPECT_TRUE(read_buffer);
EXPECT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
read_elements = static_cast<const int32_t*>(read_buffer);
EXPECT_EQ(456, read_elements[0]);
@@ -580,9 +580,9 @@ TEST(LocalDataPipeTest, BasicConsumerWaiting) {
// Adding a waiter should now succeed.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 56, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ dp->ConsumerAddWaiter(
+ &waiter, MOJO_HANDLE_SIGNAL_READABLE, 56, nullptr));
// Close the producer.
dp->ProducerClose();
@@ -626,20 +626,20 @@ TEST(LocalDataPipeTest, BasicTwoPhaseWaiting) {
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfiable_signals);
uint32_t num_bytes = static_cast<uint32_t>(1u * sizeof(int32_t));
- void* write_ptr = NULL;
+ void* write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(write_ptr != NULL);
+ EXPECT_TRUE(write_ptr);
EXPECT_GE(num_bytes, static_cast<uint32_t>(1u * sizeof(int32_t)));
// At this point, it shouldn't be writable.
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 1, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ dp->ProducerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_WRITABLE, 1, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ProducerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -649,8 +649,8 @@ TEST(LocalDataPipeTest, BasicTwoPhaseWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 2, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 2, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ConsumerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -682,12 +682,12 @@ TEST(LocalDataPipeTest, BasicTwoPhaseWaiting) {
// Start another two-phase write and check that it's readable even in the
// middle of it.
num_bytes = static_cast<uint32_t>(1u * sizeof(int32_t));
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(write_ptr != NULL);
+ EXPECT_TRUE(write_ptr);
EXPECT_GE(num_bytes, static_cast<uint32_t>(1u * sizeof(int32_t)));
// It should be readable.
@@ -704,12 +704,12 @@ TEST(LocalDataPipeTest, BasicTwoPhaseWaiting) {
// Start a two-phase read.
num_bytes = static_cast<uint32_t>(1u * sizeof(int32_t));
- const void* read_ptr = NULL;
+ const void* read_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(read_ptr != NULL);
+ EXPECT_TRUE(read_ptr);
EXPECT_EQ(static_cast<uint32_t>(1u * sizeof(int32_t)), num_bytes);
// At this point, it should still be writable.
@@ -725,8 +725,8 @@ TEST(LocalDataPipeTest, BasicTwoPhaseWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 7, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 7, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ConsumerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -778,8 +778,8 @@ TEST(LocalDataPipeTest, BasicMayDiscardWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 1, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 1, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ConsumerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -861,8 +861,8 @@ TEST(LocalDataPipeTest, BasicMayDiscardWaiting) {
waiter.Init();
ASSERT_EQ(
MOJO_RESULT_OK,
- dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 7, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ dp->ConsumerAddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 7, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
dp->ConsumerRemoveWaiter(&waiter, &hss);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -994,12 +994,12 @@ TEST(LocalDataPipeTest, MayDiscard) {
// buffer has exactly the capacity requested).
num_bytes = 0u;
- void* write_ptr = NULL;
+ void* write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), false));
- EXPECT_TRUE(write_ptr != NULL);
+ EXPECT_TRUE(write_ptr);
EXPECT_EQ(6u * sizeof(int32_t), num_bytes);
Seq(400, 6, static_cast<int32_t*>(write_ptr));
EXPECT_EQ(MOJO_RESULT_OK, dp->ProducerEndWriteData(6u * sizeof(int32_t)));
@@ -1009,7 +1009,7 @@ TEST(LocalDataPipeTest, MayDiscard) {
// |ProducerBeginWriteData()| ignores |*num_bytes| except in "all-or-none"
// mode.
num_bytes = 6u * sizeof(int32_t);
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
@@ -1022,7 +1022,7 @@ TEST(LocalDataPipeTest, MayDiscard) {
// Requesting a 10-element buffer in all-or-none mode fails at this point.
num_bytes = 10u * sizeof(int32_t);
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OUT_OF_RANGE,
dp->ProducerBeginWriteData(
@@ -1031,7 +1031,7 @@ TEST(LocalDataPipeTest, MayDiscard) {
// But requesting, say, a 5-element (up to 9, really) buffer should be okay.
// It will discard two elements.
num_bytes = 5u * sizeof(int32_t);
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
@@ -1046,7 +1046,7 @@ TEST(LocalDataPipeTest, MayDiscard) {
// Do this again. Make sure we can get a buffer all the way out to the end of
// the internal buffer.
num_bytes = 5u * sizeof(int32_t);
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
@@ -1366,7 +1366,7 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// Try writing way too much (two-phase).
uint32_t num_bytes = 20u * sizeof(int32_t);
- void* write_ptr = NULL;
+ void* write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OUT_OF_RANGE,
dp->ProducerBeginWriteData(
@@ -1376,7 +1376,7 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// (two-phase).
COMPILE_ASSERT(sizeof(int32_t) > 1u, wow_int32_ts_have_size_1);
num_bytes = 1u;
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_INVALID_ARGUMENT,
dp->ProducerBeginWriteData(
@@ -1384,35 +1384,35 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// Try reading way too much (two-phase).
num_bytes = 20u * sizeof(int32_t);
- const void* read_ptr = NULL;
+ const void* read_ptr = nullptr;
EXPECT_EQ(MOJO_RESULT_OUT_OF_RANGE,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
// Write half (two-phase).
num_bytes = 5u * sizeof(int32_t);
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), true));
// May provide more space than requested.
EXPECT_GE(num_bytes, 5u * sizeof(int32_t));
- EXPECT_TRUE(write_ptr != NULL);
+ EXPECT_TRUE(write_ptr);
Seq(0, 5, static_cast<int32_t*>(write_ptr));
EXPECT_EQ(MOJO_RESULT_OK, dp->ProducerEndWriteData(5u * sizeof(int32_t)));
// Try reading an amount which isn't a multiple of the element size
// (two-phase).
num_bytes = 1u;
- read_ptr = NULL;
+ read_ptr = nullptr;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
// Read one (two-phase).
num_bytes = 1u * sizeof(int32_t);
- read_ptr = NULL;
+ read_ptr = nullptr;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
@@ -1428,7 +1428,7 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// Assuming a tight circular buffer of the specified capacity, we can't do a
// two-phase write of six now.
num_bytes = 6u * sizeof(int32_t);
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OUT_OF_RANGE,
dp->ProducerBeginWriteData(
@@ -1451,7 +1451,7 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// But a two-phase read of ten should fail.
num_bytes = 10u * sizeof(int32_t);
- read_ptr = NULL;
+ read_ptr = nullptr;
EXPECT_EQ(MOJO_RESULT_OUT_OF_RANGE,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
@@ -1461,7 +1461,7 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// A two-phase read of nine should work.
num_bytes = 9u * sizeof(int32_t);
- read_ptr = NULL;
+ read_ptr = nullptr;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
@@ -1479,7 +1479,7 @@ TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
// A two-phase read of two should fail, with "failed precondition".
num_bytes = 2u * sizeof(int32_t);
- read_ptr = NULL;
+ read_ptr = nullptr;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
dp->ConsumerBeginReadData(
MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
@@ -1533,13 +1533,13 @@ TEST(LocalDataPipeTest, WrapAround) {
// Check that a two-phase write can now only write (at most) 80 bytes. (This
// checks an implementation detail; this behavior is not guaranteed, but we
// need it for this test.)
- void* write_buffer_ptr = NULL;
+ void* write_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ProducerBeginWriteData(MakeUserPointer(&write_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(write_buffer_ptr != NULL);
+ EXPECT_TRUE(write_buffer_ptr);
EXPECT_EQ(80u, num_bytes);
EXPECT_EQ(MOJO_RESULT_OK, dp->ProducerEndWriteData(0u));
@@ -1555,13 +1555,13 @@ TEST(LocalDataPipeTest, WrapAround) {
// Check that a two-phase read can now only read (at most) 90 bytes. (This
// checks an implementation detail; this behavior is not guaranteed, but we
// need it for this test.)
- const void* read_buffer_ptr = NULL;
+ const void* read_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ConsumerBeginReadData(MakeUserPointer(&read_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(read_buffer_ptr != NULL);
+ EXPECT_TRUE(read_buffer_ptr);
EXPECT_EQ(90u, num_bytes);
EXPECT_EQ(MOJO_RESULT_OK, dp->ConsumerEndReadData(0u));
@@ -1619,23 +1619,23 @@ TEST(LocalDataPipeTest, CloseWriteRead) {
EXPECT_EQ(kTestDataSize, num_bytes);
// Start two-phase write.
- void* write_buffer_ptr = NULL;
+ void* write_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ProducerBeginWriteData(MakeUserPointer(&write_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(write_buffer_ptr != NULL);
+ EXPECT_TRUE(write_buffer_ptr);
EXPECT_GT(num_bytes, 0u);
// Start two-phase read.
- const void* read_buffer_ptr = NULL;
+ const void* read_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ConsumerBeginReadData(MakeUserPointer(&read_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(read_buffer_ptr != NULL);
+ EXPECT_TRUE(read_buffer_ptr);
EXPECT_EQ(2u * kTestDataSize, num_bytes);
// Close the producer.
@@ -1646,13 +1646,13 @@ TEST(LocalDataPipeTest, CloseWriteRead) {
EXPECT_EQ(MOJO_RESULT_OK, dp->ConsumerEndReadData(kTestDataSize));
// And start another.
- read_buffer_ptr = NULL;
+ read_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ConsumerBeginReadData(MakeUserPointer(&read_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(read_buffer_ptr != NULL);
+ EXPECT_TRUE(read_buffer_ptr);
EXPECT_EQ(kTestDataSize, num_bytes);
// Close the consumer, which cancels the two-phase read.
@@ -1672,23 +1672,23 @@ TEST(LocalDataPipeTest, CloseWriteRead) {
EXPECT_EQ(kTestDataSize, num_bytes);
// Start two-phase write.
- void* write_buffer_ptr = NULL;
+ void* write_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ProducerBeginWriteData(MakeUserPointer(&write_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(write_buffer_ptr != NULL);
+ EXPECT_TRUE(write_buffer_ptr);
ASSERT_GT(num_bytes, kTestDataSize);
// Start two-phase read.
- const void* read_buffer_ptr = NULL;
+ const void* read_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ConsumerBeginReadData(MakeUserPointer(&read_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(read_buffer_ptr != NULL);
+ EXPECT_TRUE(read_buffer_ptr);
EXPECT_EQ(kTestDataSize, num_bytes);
// Close the consumer.
@@ -1709,7 +1709,7 @@ TEST(LocalDataPipeTest, CloseWriteRead) {
false));
// As will trying to start another two-phase write.
- write_buffer_ptr = NULL;
+ write_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
dp->ProducerBeginWriteData(MakeUserPointer(&write_buffer_ptr),
@@ -1725,13 +1725,13 @@ TEST(LocalDataPipeTest, CloseWriteRead) {
scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
// Start two-phase write.
- void* write_buffer_ptr = NULL;
+ void* write_buffer_ptr = nullptr;
uint32_t num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_OK,
dp->ProducerBeginWriteData(MakeUserPointer(&write_buffer_ptr),
MakeUserPointer(&num_bytes),
false));
- EXPECT_TRUE(write_buffer_ptr != NULL);
+ EXPECT_TRUE(write_buffer_ptr);
ASSERT_GT(num_bytes, kTestDataSize);
dp->ConsumerClose();
@@ -1771,7 +1771,7 @@ TEST(LocalDataPipeTest, CloseWriteRead) {
UserPointer<void>(buffer), MakeUserPointer(&num_bytes), false));
// A two-phase read should also fail.
- const void* read_buffer_ptr = NULL;
+ const void* read_buffer_ptr = nullptr;
num_bytes = 0u;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
dp->ConsumerBeginReadData(MakeUserPointer(&read_buffer_ptr),
@@ -1817,7 +1817,7 @@ TEST(LocalDataPipeTest, TwoPhaseMoreInvalidArguments) {
// Try ending a two-phase write with an invalid amount (too much).
num_bytes = 0u;
- void* write_ptr = NULL;
+ void* write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
@@ -1837,7 +1837,7 @@ TEST(LocalDataPipeTest, TwoPhaseMoreInvalidArguments) {
// Try ending a two-phase write with an invalid amount (not a multiple of the
// element size).
num_bytes = 0u;
- write_ptr = NULL;
+ write_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ProducerBeginWriteData(
@@ -1877,7 +1877,7 @@ TEST(LocalDataPipeTest, TwoPhaseMoreInvalidArguments) {
// Try ending a two-phase read with an invalid amount (too much).
num_bytes = 0u;
- const void* read_ptr = NULL;
+ const void* read_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
@@ -1894,7 +1894,7 @@ TEST(LocalDataPipeTest, TwoPhaseMoreInvalidArguments) {
// Try ending a two-phase read with an invalid amount (not a multiple of the
// element size).
num_bytes = 0u;
- read_ptr = NULL;
+ read_ptr = nullptr;
EXPECT_EQ(
MOJO_RESULT_OK,
dp->ConsumerBeginReadData(
@@ -1943,7 +1943,7 @@ TEST(LocalDataPipeTest, DISABLED_MayDiscardTwoPhaseConsistent) {
EXPECT_EQ(2u, num_bytes);
// Begin reading.
- const void* read_ptr = NULL;
+ const void* read_ptr = nullptr;
num_bytes = 2u;
EXPECT_EQ(
MOJO_RESULT_OK,
@@ -1981,7 +1981,7 @@ TEST(LocalDataPipeTest, DISABLED_MayDiscardTwoPhaseConsistent) {
false));
// And if we read, we should get the new values.
- read_ptr = NULL;
+ read_ptr = nullptr;
num_bytes = 2u;
EXPECT_EQ(
MOJO_RESULT_OK,
diff --git a/mojo/system/local_message_pipe_endpoint.cc b/mojo/system/local_message_pipe_endpoint.cc
index 16f58bc..24b7e7c 100644
--- a/mojo/system/local_message_pipe_endpoint.cc
+++ b/mojo/system/local_message_pipe_endpoint.cc
@@ -108,7 +108,7 @@ MojoResult LocalMessagePipeEndpoint::ReadMessage(
*num_dispatchers = 0;
}
- message = NULL;
+ message = nullptr;
if (enough_space || (flags & MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)) {
message_queue_.DiscardMessage();
diff --git a/mojo/system/memory.h b/mojo/system/memory.h
index 3602be7..acbbb54 100644
--- a/mojo/system/memory.h
+++ b/mojo/system/memory.h
@@ -91,15 +91,15 @@ class UserPointer {
// |MakeUserPointer()| (or |NullUserPointer()| for null pointers). (The common
// exception is when you have, e.g., a |char*| and want to get a
// |UserPointer<void>|.)
- UserPointer() : pointer_(NULL) {}
+ UserPointer() : pointer_(nullptr) {}
explicit UserPointer(Type* pointer) : pointer_(pointer) {}
// Allow implicit conversion from the "null user pointer".
- UserPointer(NullUserPointer) : pointer_(NULL) {}
+ UserPointer(NullUserPointer) : pointer_(nullptr) {}
~UserPointer() {}
// Allow assignment from the "null user pointer".
UserPointer<Type>& operator=(NullUserPointer) {
- pointer_ = NULL;
+ pointer_ = nullptr;
return *this;
}
diff --git a/mojo/system/memory_unittest.cc b/mojo/system/memory_unittest.cc
index 5cfcb32..37acaf7 100644
--- a/mojo/system/memory_unittest.cc
+++ b/mojo/system/memory_unittest.cc
@@ -176,7 +176,7 @@ TEST(MemoryTest, InvalidDeath) {
// Null:
{
- UserPointer<char> ptr(NULL);
+ UserPointer<char> ptr(nullptr);
char array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
@@ -186,7 +186,7 @@ TEST(MemoryTest, InvalidDeath) {
EXPECT_DEATH_IF_SUPPORTED(ptr.PutArray(array, 5), kMemoryCheckFailedRegex);
}
{
- UserPointer<int32_t> ptr(NULL);
+ UserPointer<int32_t> ptr(nullptr);
int32_t array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
@@ -196,7 +196,7 @@ TEST(MemoryTest, InvalidDeath) {
EXPECT_DEATH_IF_SUPPORTED(ptr.PutArray(array, 5), kMemoryCheckFailedRegex);
}
{
- UserPointer<int64_t> ptr(NULL);
+ UserPointer<int64_t> ptr(nullptr);
int64_t array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
@@ -207,7 +207,7 @@ TEST(MemoryTest, InvalidDeath) {
}
// Also check a const pointer:
{
- UserPointer<const int32_t> ptr(NULL);
+ UserPointer<const int32_t> ptr(nullptr);
int32_t array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
diff --git a/mojo/system/message_in_transit.h b/mojo/system/message_in_transit.h
index c812d56..9101f365 100644
--- a/mojo/system/message_in_transit.h
+++ b/mojo/system/message_in_transit.h
@@ -106,7 +106,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit {
const void* transport_data_buffer() const {
return (total_size() > main_buffer_size())
? static_cast<const char*>(buffer_) + main_buffer_size()
- : NULL;
+ : nullptr;
}
size_t transport_data_buffer_size() const {
return total_size() - main_buffer_size();
diff --git a/mojo/system/message_pipe.cc b/mojo/system/message_pipe.cc
index 4a75a29..e2aabe3 100644
--- a/mojo/system/message_pipe.cc
+++ b/mojo/system/message_pipe.cc
@@ -184,7 +184,7 @@ scoped_refptr<ChannelEndpoint> MessagePipe::ConvertLocalToProxy(unsigned port) {
MojoResult MessagePipe::EnqueueMessage(unsigned port,
scoped_ptr<MessageInTransit> message) {
- return EnqueueMessageInternal(port, message.Pass(), NULL);
+ return EnqueueMessageInternal(port, message.Pass(), nullptr);
}
bool MessagePipe::Attach(unsigned port, ChannelEndpoint* channel_endpoint) {
diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
index 94aceb0..abe0ecb 100644
--- a/mojo/system/message_pipe_dispatcher.cc
+++ b/mojo/system/message_pipe_dispatcher.cc
@@ -162,7 +162,7 @@ void MessagePipeDispatcher::CancelAllWaitersNoLock() {
void MessagePipeDispatcher::CloseImplNoLock() {
lock().AssertAcquired();
message_pipe_->Close(port_);
- message_pipe_ = NULL;
+ message_pipe_ = nullptr;
port_ = kInvalidPort;
}
@@ -176,7 +176,7 @@ MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
scoped_refptr<MessagePipeDispatcher> rv =
new MessagePipeDispatcher(kDefaultCreateOptions);
rv->Init(message_pipe_, port_);
- message_pipe_ = NULL;
+ message_pipe_ = nullptr;
port_ = kInvalidPort;
return scoped_refptr<Dispatcher>(rv.get());
}
@@ -265,7 +265,7 @@ bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock(
static_cast<SerializedMessagePipeDispatcher*>(destination)->endpoint_id =
endpoint_id;
- message_pipe_ = NULL;
+ message_pipe_ = nullptr;
port_ = kInvalidPort;
*actual_size = sizeof(SerializedMessagePipeDispatcher);
diff --git a/mojo/system/message_pipe_dispatcher_unittest.cc b/mojo/system/message_pipe_dispatcher_unittest.cc
index 2acb8cb..bd55ecf 100644
--- a/mojo/system/message_pipe_dispatcher_unittest.cc
+++ b/mojo/system/message_pipe_dispatcher_unittest.cc
@@ -65,12 +65,12 @@ TEST(MessagePipeDispatcherTest, Basic) {
// |d1|), then wait.
w.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- d0->AddWaiter(&w, MOJO_HANDLE_SIGNAL_READABLE, 1, NULL));
+ d0->AddWaiter(&w, MOJO_HANDLE_SIGNAL_READABLE, 1, nullptr));
buffer[0] = 123456789;
EXPECT_EQ(MOJO_RESULT_OK,
d1->WriteMessage(UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK, w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -101,7 +101,7 @@ TEST(MessagePipeDispatcherTest, Basic) {
d0->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kBufferSize, buffer_size);
EXPECT_EQ(123456789, buffer[0]);
@@ -109,9 +109,9 @@ TEST(MessagePipeDispatcherTest, Basic) {
// Wait for zero time for readability on |d0| (will time out).
w.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- d0->AddWaiter(&w, MOJO_HANDLE_SIGNAL_READABLE, 3, NULL));
+ d0->AddWaiter(&w, MOJO_HANDLE_SIGNAL_READABLE, 3, nullptr));
stopwatch.Start();
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, NULL));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, nullptr));
EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout());
hss = HandleSignalsState();
d0->RemoveWaiter(&w, &hss);
@@ -122,10 +122,10 @@ TEST(MessagePipeDispatcherTest, Basic) {
// Wait for non-zero, finite time for readability on |d0| (will time out).
w.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- d0->AddWaiter(&w, MOJO_HANDLE_SIGNAL_READABLE, 3, NULL));
+ d0->AddWaiter(&w, MOJO_HANDLE_SIGNAL_READABLE, 3, nullptr));
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
- w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), NULL));
+ w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), nullptr));
base::TimeDelta elapsed = stopwatch.Elapsed();
EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout());
EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout());
@@ -158,7 +158,7 @@ TEST(MessagePipeDispatcherTest, InvalidParams) {
EXPECT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
d0->WriteMessage(UserPointer<const void>(buffer),
std::numeric_limits<uint32_t>::max(),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, d0->Close());
@@ -188,21 +188,22 @@ TEST(MessagePipeDispatcherTest, InvalidParamsDeath) {
// Null buffer with nonzero buffer size.
EXPECT_DEATH_IF_SUPPORTED(
d0->WriteMessage(
- NullUserPointer(), 1, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE),
+ NullUserPointer(), 1, nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE),
kMemoryCheckFailedRegex);
// |ReadMessage|:
// Null buffer with nonzero buffer size.
// First write something so that we actually have something to read.
- EXPECT_EQ(
- MOJO_RESULT_OK,
- d1->WriteMessage(
- UserPointer<const void>("x"), 1, NULL, MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ d1->WriteMessage(UserPointer<const void>("x"),
+ 1,
+ nullptr,
+ MOJO_WRITE_MESSAGE_FLAG_NONE));
uint32_t buffer_size = 1;
EXPECT_DEATH_IF_SUPPORTED(d0->ReadMessage(NullUserPointer(),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
kMemoryCheckFailedRegex);
@@ -235,13 +236,13 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
EXPECT_EQ(MOJO_RESULT_OK,
d1->WriteMessage(UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
buffer[0] = 234567890;
EXPECT_EQ(MOJO_RESULT_OK,
d1->WriteMessage(UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Try waiting for readable on |d0|; should fail (already satisfied).
@@ -261,7 +262,7 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
d1->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
// Close |d1|.
@@ -282,7 +283,7 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
d0->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kBufferSize, buffer_size);
EXPECT_EQ(123456789, buffer[0]);
@@ -302,7 +303,7 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
d0->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kBufferSize, buffer_size);
EXPECT_EQ(234567890, buffer[0]);
@@ -331,7 +332,7 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
d0->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
// Try writing to |d0|; should fail (other end closed).
@@ -339,7 +340,7 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
d0->WriteMessage(UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, d0->Close());
@@ -393,7 +394,7 @@ TEST(MessagePipeDispatcherTest, MAYBE_BasicThreaded) {
EXPECT_EQ(MOJO_RESULT_OK,
d0->WriteMessage(UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
} // Joins the thread.
elapsed = stopwatch.Elapsed();
@@ -435,7 +436,7 @@ TEST(MessagePipeDispatcherTest, MAYBE_BasicThreaded) {
d1->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kBufferSize, buffer_size);
EXPECT_EQ(123456789, buffer[0]);
@@ -546,7 +547,7 @@ class WriterThread : public base::SimpleThread {
EXPECT_EQ(MOJO_RESULT_OK,
write_dispatcher_->WriteMessage(UserPointer<const void>(buffer),
bytes_to_write,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
*bytes_written_ += bytes_to_write;
}
@@ -555,7 +556,7 @@ class WriterThread : public base::SimpleThread {
EXPECT_EQ(MOJO_RESULT_OK,
write_dispatcher_->WriteMessage(UserPointer<const void>("quit"),
4,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
}
@@ -601,7 +602,7 @@ class ReaderThread : public base::SimpleThread {
<< "result: " << result;
if (result == MOJO_RESULT_OK) {
// Actually need to wait.
- EXPECT_EQ(MOJO_RESULT_OK, w.Wait(MOJO_DEADLINE_INDEFINITE, NULL));
+ EXPECT_EQ(MOJO_RESULT_OK, w.Wait(MOJO_DEADLINE_INDEFINITE, nullptr));
read_dispatcher_->RemoveWaiter(&w, &hss);
}
// We may not actually be readable, since we're racing with other threads.
@@ -614,7 +615,7 @@ class ReaderThread : public base::SimpleThread {
result = read_dispatcher_->ReadMessage(UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE);
EXPECT_TRUE(result == MOJO_RESULT_OK || result == MOJO_RESULT_SHOULD_WAIT)
<< "result: " << result;
diff --git a/mojo/system/message_pipe_perftest.cc b/mojo/system/message_pipe_perftest.cc
index 33cffee..7a8584a 100644
--- a/mojo/system/message_pipe_perftest.cc
+++ b/mojo/system/message_pipe_perftest.cc
@@ -50,7 +50,7 @@ class MultiprocessMessagePipePerfTest
CHECK_EQ(mp->WriteMessage(0,
UserPointer<const void>(payload_.data()),
static_cast<uint32_t>(payload_.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
HandleSignalsState hss;
@@ -60,8 +60,8 @@ class MultiprocessMessagePipePerfTest
CHECK_EQ(mp->ReadMessage(0,
UserPointer<void>(&read_buffer_[0]),
MakeUserPointer(&read_buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
CHECK_EQ(read_buffer_size, static_cast<uint32_t>(payload_.size()));
@@ -71,7 +71,7 @@ class MultiprocessMessagePipePerfTest
CHECK_EQ(mp->WriteMessage(0,
UserPointer<const void>(""),
0,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
}
@@ -130,8 +130,8 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
CHECK_EQ(mp->ReadMessage(0,
UserPointer<void>(&buffer[0]),
MakeUserPointer(&read_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
@@ -142,7 +142,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
CHECK_EQ(mp->WriteMessage(0,
UserPointer<const void>(&buffer[0]),
static_cast<uint32_t>(read_size),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
}
diff --git a/mojo/system/message_pipe_test_utils.cc b/mojo/system/message_pipe_test_utils.cc
index c70f0a0c..3c0a8cc 100644
--- a/mojo/system/message_pipe_test_utils.cc
+++ b/mojo/system/message_pipe_test_utils.cc
@@ -27,7 +27,7 @@ MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp,
: add_result;
}
- MojoResult wait_result = waiter.Wait(MOJO_DEADLINE_INDEFINITE, NULL);
+ MojoResult wait_result = waiter.Wait(MOJO_DEADLINE_INDEFINITE, nullptr);
mp->RemoveWaiter(0, &waiter, signals_state);
return wait_result;
}
@@ -94,7 +94,7 @@ void ChannelThread::InitChannelOnIOThread(
void ChannelThread::ShutdownChannelOnIOThread() {
CHECK(channel_.get());
channel_->Shutdown();
- channel_ = NULL;
+ channel_ = nullptr;
}
#if !defined(OS_IOS)
diff --git a/mojo/system/message_pipe_unittest.cc b/mojo/system/message_pipe_unittest.cc
index 7cd9cbd..318a824 100644
--- a/mojo/system/message_pipe_unittest.cc
+++ b/mojo/system/message_pipe_unittest.cc
@@ -43,7 +43,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kBufferSize, buffer_size);
EXPECT_EQ(123, buffer[0]);
@@ -58,7 +58,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
// Write from port 1 (to port 0).
@@ -68,7 +68,7 @@ TEST(MessagePipeTest, Basic) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Read from port 0.
@@ -80,7 +80,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
EXPECT_EQ(789012345, buffer[0]);
@@ -93,7 +93,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
// Write two messages from port 0 (to port 1).
@@ -103,7 +103,7 @@ TEST(MessagePipeTest, Basic) {
mp->WriteMessage(0,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
buffer[0] = 234567890;
buffer[1] = 0;
@@ -111,7 +111,7 @@ TEST(MessagePipeTest, Basic) {
mp->WriteMessage(0,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Read from port 1 with buffer size 0 (should get the size of next message).
@@ -122,7 +122,7 @@ TEST(MessagePipeTest, Basic) {
NullUserPointer(),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
@@ -136,7 +136,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
EXPECT_EQ(123, buffer[0]);
@@ -151,7 +151,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
EXPECT_EQ(123456789, buffer[0]);
@@ -166,7 +166,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
EXPECT_EQ(234567890, buffer[0]);
@@ -179,7 +179,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
// Write from port 0 (to port 1).
@@ -189,7 +189,7 @@ TEST(MessagePipeTest, Basic) {
mp->WriteMessage(0,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Close port 0.
@@ -202,7 +202,7 @@ TEST(MessagePipeTest, Basic) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Read from port 1; should still get message (even though port 0 was closed).
@@ -214,7 +214,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
EXPECT_EQ(345678901, buffer[0]);
@@ -227,7 +227,7 @@ TEST(MessagePipeTest, Basic) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
mp->Close(1);
@@ -247,7 +247,7 @@ TEST(MessagePipeTest, CloseWithQueuedIncomingMessages) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
}
@@ -258,7 +258,7 @@ TEST(MessagePipeTest, CloseWithQueuedIncomingMessages) {
NullUserPointer(),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kBufferSize, buffer_size);
@@ -281,7 +281,7 @@ TEST(MessagePipeTest, DiscardMode) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Read/discard from port 0 (no buffer); get size.
@@ -291,7 +291,7 @@ TEST(MessagePipeTest, DiscardMode) {
NullUserPointer(),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
@@ -302,7 +302,7 @@ TEST(MessagePipeTest, DiscardMode) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
// Write from port 1 (to port 0).
@@ -312,7 +312,7 @@ TEST(MessagePipeTest, DiscardMode) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Read from port 0 (buffer big enough).
@@ -324,7 +324,7 @@ TEST(MessagePipeTest, DiscardMode) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
EXPECT_EQ(890123456, buffer[0]);
@@ -337,7 +337,7 @@ TEST(MessagePipeTest, DiscardMode) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
// Write from port 1 (to port 0).
@@ -347,7 +347,7 @@ TEST(MessagePipeTest, DiscardMode) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Read/discard from port 0 (buffer too small); get size.
@@ -357,7 +357,7 @@ TEST(MessagePipeTest, DiscardMode) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
EXPECT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
@@ -368,7 +368,7 @@ TEST(MessagePipeTest, DiscardMode) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
// Write from port 1 (to port 0).
@@ -378,7 +378,7 @@ TEST(MessagePipeTest, DiscardMode) {
mp->WriteMessage(1,
UserPointer<const void>(buffer),
static_cast<uint32_t>(sizeof(buffer[0])),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Discard from port 0.
@@ -388,7 +388,7 @@ TEST(MessagePipeTest, DiscardMode) {
NullUserPointer(),
NullUserPointer(),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
// Read again from port 0 -- it should be empty.
@@ -398,7 +398,7 @@ TEST(MessagePipeTest, DiscardMode) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
mp->Close(0);
@@ -438,8 +438,8 @@ TEST(MessagePipeTest, BasicWaiting) {
// Not yet readable.
waiter.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- mp->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 1, NULL));
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, NULL));
+ mp->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 1, nullptr));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, nullptr));
hss = HandleSignalsState();
mp->RemoveWaiter(0, &waiter, &hss);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
@@ -452,7 +452,7 @@ TEST(MessagePipeTest, BasicWaiting) {
mp->WriteMessage(0,
UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Port 1 should already be readable now.
@@ -514,7 +514,7 @@ TEST(MessagePipeTest, BasicWaiting) {
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(123456789, buffer[0]);
@@ -522,7 +522,7 @@ TEST(MessagePipeTest, BasicWaiting) {
waiter.Init();
hss = HandleSignalsState();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- mp->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 6, NULL));
+ mp->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 6, nullptr));
EXPECT_EQ(0u, hss.satisfied_signals);
EXPECT_EQ(0u, hss.satisfiable_signals);
@@ -544,7 +544,7 @@ TEST(MessagePipeTest, ThreadedWaiting) {
thread.waiter()->Init();
ASSERT_EQ(MOJO_RESULT_OK,
mp->AddWaiter(
- 1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 1, NULL));
+ 1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 1, nullptr));
thread.Start();
buffer[0] = 123456789;
@@ -553,7 +553,7 @@ TEST(MessagePipeTest, ThreadedWaiting) {
mp->WriteMessage(0,
UserPointer<const void>(buffer),
kBufferSize,
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
HandleSignalsState hss;
@@ -578,7 +578,7 @@ TEST(MessagePipeTest, ThreadedWaiting) {
thread.waiter()->Init();
ASSERT_EQ(MOJO_RESULT_OK,
mp->AddWaiter(
- 1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 2, NULL));
+ 1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 2, nullptr));
thread.Start();
// Close port 1 first -- this should result in the waiter being cancelled.
@@ -601,7 +601,7 @@ TEST(MessagePipeTest, ThreadedWaiting) {
thread.waiter()->Init();
ASSERT_EQ(MOJO_RESULT_OK,
mp->AddWaiter(
- 1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 3, NULL));
+ 1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 3, nullptr));
thread.Start();
// Close port 0 first -- this should wake the waiter up, since port 1 will
diff --git a/mojo/system/multiprocess_message_pipe_unittest.cc b/mojo/system/multiprocess_message_pipe_unittest.cc
index 7991c28..3d40f33 100644
--- a/mojo/system/multiprocess_message_pipe_unittest.cc
+++ b/mojo/system/multiprocess_message_pipe_unittest.cc
@@ -75,8 +75,8 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(EchoEcho) {
CHECK_EQ(mp->ReadMessage(0,
UserPointer<void>(&read_buffer[0]),
MakeUserPointer(&read_buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
read_buffer.resize(read_buffer_size);
@@ -91,7 +91,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(EchoEcho) {
CHECK_EQ(mp->WriteMessage(0,
UserPointer<const void>(write_buffer.data()),
static_cast<uint32_t>(write_buffer.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
}
@@ -113,7 +113,7 @@ TEST_F(MultiprocessMessagePipeTest, Basic) {
mp->WriteMessage(0,
UserPointer<const void>(hello.data()),
static_cast<uint32_t>(hello.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
HandleSignalsState hss;
@@ -130,8 +130,8 @@ TEST_F(MultiprocessMessagePipeTest, Basic) {
CHECK_EQ(mp->ReadMessage(0,
UserPointer<void>(&read_buffer[0]),
MakeUserPointer(&read_buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
read_buffer.resize(read_buffer_size);
@@ -160,7 +160,7 @@ TEST_F(MultiprocessMessagePipeTest, QueueMessages) {
mp->WriteMessage(0,
UserPointer<const void>(write_buffer.data()),
static_cast<uint32_t>(write_buffer.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
}
@@ -169,7 +169,7 @@ TEST_F(MultiprocessMessagePipeTest, QueueMessages) {
mp->WriteMessage(0,
UserPointer<const void>(quitquitquit.data()),
static_cast<uint32_t>(quitquitquit.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
for (size_t i = 0; i < kNumMessages; i++) {
@@ -187,8 +187,8 @@ TEST_F(MultiprocessMessagePipeTest, QueueMessages) {
CHECK_EQ(mp->ReadMessage(0,
UserPointer<void>(&read_buffer[0]),
MakeUserPointer(&read_buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
read_buffer.resize(read_buffer_size);
@@ -272,7 +272,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(CheckSharedBuffer) {
CHECK_EQ(mp->WriteMessage(0,
UserPointer<const void>(&go2[0]),
static_cast<uint32_t>(go2.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
@@ -290,8 +290,8 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(CheckSharedBuffer) {
CHECK_EQ(mp->ReadMessage(0,
UserPointer<void>(&read_buffer[0]),
MakeUserPointer(&num_bytes),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE),
MOJO_RESULT_OK);
read_buffer.resize(num_bytes);
@@ -355,7 +355,7 @@ TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) {
transport.End();
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
// Wait for a message from the child.
HandleSignalsState hss;
@@ -370,8 +370,8 @@ TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) {
mp->ReadMessage(0,
UserPointer<void>(&read_buffer[0]),
MakeUserPointer(&num_bytes),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
read_buffer.resize(num_bytes);
EXPECT_EQ(std::string("go 2"), read_buffer);
@@ -391,7 +391,7 @@ TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) {
mp->WriteMessage(0,
UserPointer<const void>(&go3[0]),
static_cast<uint32_t>(go3.size()),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Wait for |mp| to become readable, which should fail.
@@ -504,7 +504,7 @@ TEST_F(MultiprocessMessagePipeTest, MAYBE_PlatformHandlePassing) {
transport.End();
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
// Wait for it to become readable, which should fail.
HandleSignalsState hss;
diff --git a/mojo/system/platform_handle_dispatcher_unittest.cc b/mojo/system/platform_handle_dispatcher_unittest.cc
index 62247e7..7a68e45 100644
--- a/mojo/system/platform_handle_dispatcher_unittest.cc
+++ b/mojo/system/platform_handle_dispatcher_unittest.cc
@@ -88,7 +88,7 @@ TEST(PlatformHandleDispatcherTest, CreateEquivalentDispatcherAndClose) {
transport.End();
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
ASSERT_EQ(Dispatcher::kTypePlatformHandle, generic_dispatcher->GetType());
dispatcher = static_cast<PlatformHandleDispatcher*>(generic_dispatcher.get());
diff --git a/mojo/system/proxy_message_pipe_endpoint.cc b/mojo/system/proxy_message_pipe_endpoint.cc
index a52099f..fda3f42 100644
--- a/mojo/system/proxy_message_pipe_endpoint.cc
+++ b/mojo/system/proxy_message_pipe_endpoint.cc
@@ -108,7 +108,7 @@ void ProxyMessagePipeEndpoint::Detach() {
DCHECK(is_attached());
channel_endpoint_->DetachFromMessagePipe();
- channel_endpoint_ = NULL;
+ channel_endpoint_ = nullptr;
is_running_ = false;
paused_message_queue_.Clear();
}
diff --git a/mojo/system/raw_channel.cc b/mojo/system/raw_channel.cc
index 036fa79..6533af9 100644
--- a/mojo/system/raw_channel.cc
+++ b/mojo/system/raw_channel.cc
@@ -149,8 +149,8 @@ void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
// RawChannel ------------------------------------------------------------------
RawChannel::RawChannel()
- : message_loop_for_io_(NULL),
- delegate_(NULL),
+ : message_loop_for_io_(nullptr),
+ delegate_(nullptr),
read_stopped_(false),
write_stopped_(false),
weak_ptr_factory_(this) {
@@ -184,8 +184,8 @@ bool RawChannel::Init(Delegate* delegate) {
write_buffer_.reset(new WriteBuffer(GetSerializedPlatformHandleSize()));
if (!OnInit()) {
- delegate_ = NULL;
- message_loop_for_io_ = NULL;
+ delegate_ = nullptr;
+ message_loop_for_io_ = nullptr;
read_buffer_.reset();
write_buffer_.reset();
return false;
@@ -216,7 +216,7 @@ void RawChannel::Shutdown() {
<< "Shutting down RawChannel with write buffer nonempty";
// Reset the delegate so that it won't receive further calls.
- delegate_ = NULL;
+ delegate_ = nullptr;
read_stopped_ = true;
write_stopped_ = true;
weak_ptr_factory_.InvalidateWeakPtrs();
@@ -319,7 +319,7 @@ void RawChannel::OnReadCompleted(IOResult io_result, size_t bytes_read) {
message_size, &read_buffer_->buffer_[read_buffer_start]);
DCHECK_EQ(message_view.total_size(), message_size);
- const char* error_message = NULL;
+ const char* error_message = nullptr;
if (!message_view.IsValid(GetSerializedPlatformHandleSize(),
&error_message)) {
DCHECK(error_message);
diff --git a/mojo/system/raw_channel_posix.cc b/mojo/system/raw_channel_posix.cc
index 01453f6..6ee8594 100644
--- a/mojo/system/raw_channel_posix.cc
+++ b/mojo/system/raw_channel_posix.cc
@@ -138,7 +138,7 @@ void RawChannelPosix::EnqueueMessageNoLock(
MessageInTransit::kTypeRawChannel,
MessageInTransit::kSubtypeRawChannelPosixExtraPlatformHandles,
0,
- NULL));
+ nullptr));
embedder::ScopedPlatformHandleVectorPtr fds(
new embedder::PlatformHandleVector(
platform_handles->begin() + i,
@@ -405,7 +405,7 @@ void RawChannelPosix::OnFileCanWriteWithoutBlocking(int fd) {
}
RawChannel::IOResult RawChannelPosix::ReadImpl(size_t* bytes_read) {
- char* buffer = NULL;
+ char* buffer = nullptr;
size_t bytes_to_read = 0;
read_buffer()->GetBuffer(&buffer, &bytes_to_read);
diff --git a/mojo/system/raw_channel_unittest.cc b/mojo/system/raw_channel_unittest.cc
index a731400..c1b6a8a 100644
--- a/mojo/system/raw_channel_unittest.cc
+++ b/mojo/system/raw_channel_unittest.cc
@@ -42,7 +42,7 @@ scoped_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
new MessageInTransit(MessageInTransit::kTypeMessagePipeEndpoint,
MessageInTransit::kSubtypeMessagePipeEndpointData,
num_bytes,
- bytes.empty() ? NULL : &bytes[0]));
+ bytes.empty() ? nullptr : &bytes[0]));
}
bool CheckMessageData(const void* bytes, uint32_t num_bytes) {
@@ -144,7 +144,7 @@ class TestMessageReaderAndChecker {
// If we have the header....
size_t message_size;
if (MessageInTransit::GetNextMessageSize(
- bytes_.empty() ? NULL : &bytes_[0],
+ bytes_.empty() ? nullptr : &bytes_[0],
bytes_.size(),
&message_size)) {
// If we've read the whole message....
diff --git a/mojo/system/raw_channel_win.cc b/mojo/system/raw_channel_win.cc
index 0132795..99e674f 100644
--- a/mojo/system/raw_channel_win.cc
+++ b/mojo/system/raw_channel_win.cc
@@ -50,8 +50,8 @@ class VistaOrHigherFunctions {
VistaOrHigherFunctions::VistaOrHigherFunctions()
: is_vista_or_higher_(base::win::GetVersion() >= base::win::VERSION_VISTA),
- set_file_completion_notification_modes_(NULL),
- cancel_io_ex_(NULL) {
+ set_file_completion_notification_modes_(nullptr),
+ cancel_io_ex_(nullptr) {
if (!is_vista_or_higher_)
return;
@@ -279,7 +279,7 @@ void RawChannelWin::RawChannelIOHandler::DetachFromOwnerNoLock(
if (pending_write_)
preserved_write_buffer_after_detach_ = write_buffer.Pass();
- owner_ = NULL;
+ owner_ = nullptr;
if (ShouldSelfDestruct())
delete this;
}
@@ -347,7 +347,7 @@ void RawChannelWin::RawChannelIOHandler::OnWriteCompleted(DWORD bytes_written,
RawChannelWin::RawChannelWin(embedder::ScopedPlatformHandle handle)
: handle_(handle.Pass()),
- io_handler_(NULL),
+ io_handler_(nullptr),
skip_completion_port_on_success_(
g_vista_or_higher_functions.Get().is_vista_or_higher()) {
DCHECK(handle_.is_valid());
@@ -367,7 +367,7 @@ RawChannel::IOResult RawChannelWin::Read(size_t* bytes_read) {
DCHECK(io_handler_);
DCHECK(!io_handler_->pending_read());
- char* buffer = NULL;
+ char* buffer = nullptr;
size_t bytes_to_read = 0;
read_buffer()->GetBuffer(&buffer, &bytes_to_read);
@@ -553,14 +553,16 @@ void RawChannelWin::OnShutdownNoLock(scoped_ptr<ReadBuffer> read_buffer,
// soon as possible.
// Note: |CancelIo()| only cancels read/write requests started from this
// thread.
- if (g_vista_or_higher_functions.Get().is_vista_or_higher())
- g_vista_or_higher_functions.Get().CancelIoEx(io_handler_->handle(), NULL);
- else
+ if (g_vista_or_higher_functions.Get().is_vista_or_higher()) {
+ g_vista_or_higher_functions.Get().CancelIoEx(io_handler_->handle(),
+ nullptr);
+ } else {
CancelIo(io_handler_->handle());
+ }
}
io_handler_->DetachFromOwnerNoLock(read_buffer.Pass(), write_buffer.Pass());
- io_handler_ = NULL;
+ io_handler_ = nullptr;
}
} // namespace
diff --git a/mojo/system/remote_message_pipe_unittest.cc b/mojo/system/remote_message_pipe_unittest.cc
index ee1c80f..de4f859 100644
--- a/mojo/system/remote_message_pipe_unittest.cc
+++ b/mojo/system/remote_message_pipe_unittest.cc
@@ -109,11 +109,11 @@ class RemoteMessagePipeTest : public testing::Test {
if (channels_[0].get()) {
channels_[0]->Shutdown();
- channels_[0] = NULL;
+ channels_[0] = nullptr;
}
if (channels_[1].get()) {
channels_[1]->Shutdown();
- channels_[1] = NULL;
+ channels_[1] = nullptr;
}
}
@@ -198,15 +198,16 @@ TEST_F(RemoteMessagePipeTest, Basic) {
// Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
// Write to MP 0, port 0.
EXPECT_EQ(MOJO_RESULT_OK,
mp0->WriteMessage(0,
UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Wait.
@@ -224,8 +225,8 @@ TEST_F(RemoteMessagePipeTest, Basic) {
mp1->ReadMessage(1,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(buffer_size));
EXPECT_STREQ(kHello, buffer);
@@ -233,14 +234,15 @@ TEST_F(RemoteMessagePipeTest, Basic) {
// Write in the other direction: MP 1, port 1 -> ... -> MP 0, port 0.
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp0->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp0->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, nullptr));
EXPECT_EQ(MOJO_RESULT_OK,
mp1->WriteMessage(1,
UserPointer<const void>(kWorld),
sizeof(kWorld),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -257,8 +259,8 @@ TEST_F(RemoteMessagePipeTest, Basic) {
mp0->ReadMessage(0,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kWorld), static_cast<size_t>(buffer_size));
EXPECT_STREQ(kWorld, buffer);
@@ -315,14 +317,15 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
// Write: MP 2, port 0 -> MP 3, port 1.
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp3->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp3->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, nullptr));
EXPECT_EQ(MOJO_RESULT_OK,
mp2->WriteMessage(0,
UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -340,24 +343,24 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
mp0->ReadMessage(0,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
mp1->ReadMessage(1,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
mp2->ReadMessage(0,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
// Read from MP 3, port 1.
@@ -366,8 +369,8 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
mp3->ReadMessage(1,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(buffer_size));
EXPECT_STREQ(kHello, buffer);
@@ -375,14 +378,15 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
// Write: MP 0, port 0 -> MP 1, port 1 again.
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
EXPECT_EQ(MOJO_RESULT_OK,
mp0->WriteMessage(0,
UserPointer<const void>(kWorld),
sizeof(kWorld),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -400,24 +404,24 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
mp0->ReadMessage(0,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
mp2->ReadMessage(0,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
mp3->ReadMessage(1,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
@@ -425,8 +429,8 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
mp1->ReadMessage(1,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kWorld), static_cast<size_t>(buffer_size));
EXPECT_STREQ(kWorld, buffer);
@@ -457,7 +461,7 @@ TEST_F(RemoteMessagePipeTest, CloseBeforeConnect) {
mp0->WriteMessage(0,
UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
BootstrapChannelEndpointNoWait(0, ep0);
@@ -471,8 +475,9 @@ TEST_F(RemoteMessagePipeTest, CloseBeforeConnect) {
// Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
BootstrapChannelEndpointNoWait(1, ep1);
@@ -493,8 +498,8 @@ TEST_F(RemoteMessagePipeTest, CloseBeforeConnect) {
mp1->ReadMessage(1,
UserPointer<void>(buffer),
MakeUserPointer(&buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(buffer_size));
EXPECT_STREQ(kHello, buffer);
@@ -524,8 +529,9 @@ TEST_F(RemoteMessagePipeTest, HandlePassing) {
// Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
// Write to MP 0, port 0.
{
@@ -546,7 +552,7 @@ TEST_F(RemoteMessagePipeTest, HandlePassing) {
// |dispatcher| should have been closed. This is |DCHECK()|ed when the
// |dispatcher| is destroyed.
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
}
// Wait.
@@ -583,16 +589,16 @@ TEST_F(RemoteMessagePipeTest, HandlePassing) {
// Add the waiter now, before it becomes readable to avoid a race.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- dispatcher->AddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ dispatcher->AddWaiter(
+ &waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, nullptr));
// Write to "local_mp", port 1.
EXPECT_EQ(MOJO_RESULT_OK,
local_mp->WriteMessage(1,
UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// TODO(vtl): FIXME -- We (racily) crash if I close |dispatcher| immediately
@@ -615,22 +621,22 @@ TEST_F(RemoteMessagePipeTest, HandlePassing) {
dispatcher->ReadMessage(UserPointer<void>(read_buffer),
MakeUserPointer(&read_buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(read_buffer_size));
EXPECT_STREQ(kHello, read_buffer);
// Prepare to wait on "local_mp", port 1.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- local_mp->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ local_mp->AddWaiter(
+ 1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, nullptr));
// Write to the dispatcher.
EXPECT_EQ(MOJO_RESULT_OK,
dispatcher->WriteMessage(UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Wait.
@@ -650,8 +656,8 @@ TEST_F(RemoteMessagePipeTest, HandlePassing) {
local_mp->ReadMessage(1,
UserPointer<void>(read_buffer),
MakeUserPointer(&read_buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(read_buffer_size));
EXPECT_STREQ(kHello, read_buffer);
@@ -710,8 +716,9 @@ TEST_F(RemoteMessagePipeTest, MAYBE_SharedBufferPassing) {
// Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
// Write to MP 0, port 0.
{
@@ -732,7 +739,7 @@ TEST_F(RemoteMessagePipeTest, MAYBE_SharedBufferPassing) {
// |dispatcher| should have been closed. This is |DCHECK()|ed when the
// |dispatcher| is destroyed.
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
}
// Wait.
@@ -834,8 +841,9 @@ TEST_F(RemoteMessagePipeTest, MAYBE_PlatformHandlePassing) {
// Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
// Write to MP 0, port 0.
{
@@ -856,7 +864,7 @@ TEST_F(RemoteMessagePipeTest, MAYBE_PlatformHandlePassing) {
// |dispatcher| should have been closed. This is |DCHECK()|ed when the
// |dispatcher| is destroyed.
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
}
// Wait.
@@ -975,8 +983,9 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
// Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
// Write to MP 0, port 0.
{
@@ -997,7 +1006,7 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
// |dispatcher| should have been closed. This is |DCHECK()|ed when the
// |dispatcher| is destroyed.
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
}
// Wait.
@@ -1038,8 +1047,9 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
// Prepare to wait on MP 0, port 0. (Add the waiter now. Otherwise, if we do
// it later, it might already be readable.)
waiter.Init();
- ASSERT_EQ(MOJO_RESULT_OK,
- mp0->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, NULL));
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ mp0->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, nullptr));
// Write to MP 1, port 1.
{
@@ -1060,7 +1070,7 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
// |dispatcher| should have been closed. This is |DCHECK()|ed when the
// |dispatcher| is destroyed.
EXPECT_TRUE(dispatcher->HasOneRef());
- dispatcher = NULL;
+ dispatcher = nullptr;
}
// Wait.
@@ -1096,16 +1106,16 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
// Add the waiter now, before it becomes readable to avoid a race.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- dispatcher->AddWaiter(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ dispatcher->AddWaiter(
+ &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, nullptr));
// Write to "local_mp", port 1.
EXPECT_EQ(MOJO_RESULT_OK,
local_mp->WriteMessage(1,
UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Wait for the dispatcher to become readable.
@@ -1125,22 +1135,22 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
dispatcher->ReadMessage(UserPointer<void>(read_buffer),
MakeUserPointer(&read_buffer_size),
0,
- NULL,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(read_buffer_size));
EXPECT_STREQ(kHello, read_buffer);
// Prepare to wait on "local_mp", port 1.
waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- local_mp->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, NULL));
+ ASSERT_EQ(MOJO_RESULT_OK,
+ local_mp->AddWaiter(
+ 1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, nullptr));
// Write to the dispatcher.
EXPECT_EQ(MOJO_RESULT_OK,
dispatcher->WriteMessage(UserPointer<const void>(kHello),
sizeof(kHello),
- NULL,
+ nullptr,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Wait.
@@ -1160,8 +1170,8 @@ TEST_F(RemoteMessagePipeTest, PassMessagePipeHandleAcrossAndBack) {
local_mp->ReadMessage(1,
UserPointer<void>(read_buffer),
MakeUserPointer(&read_buffer_size),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(sizeof(kHello), static_cast<size_t>(read_buffer_size));
EXPECT_STREQ(kHello, read_buffer);
diff --git a/mojo/system/shared_buffer_dispatcher.cc b/mojo/system/shared_buffer_dispatcher.cc
index bf882ba..6229f08 100644
--- a/mojo/system/shared_buffer_dispatcher.cc
+++ b/mojo/system/shared_buffer_dispatcher.cc
@@ -180,7 +180,7 @@ MojoResult SharedBufferDispatcher::ValidateDuplicateOptions(
void SharedBufferDispatcher::CloseImplNoLock() {
lock().AssertAcquired();
DCHECK(shared_buffer_.get());
- shared_buffer_ = NULL;
+ shared_buffer_ = nullptr;
}
scoped_refptr<Dispatcher>
@@ -258,7 +258,7 @@ bool SharedBufferDispatcher::EndSerializeAndCloseImplNoLock(
shared_buffer_->HasOneRef() ? shared_buffer_->PassPlatformHandle()
: shared_buffer_->DuplicatePlatformHandle());
if (!platform_handle.is_valid()) {
- shared_buffer_ = NULL;
+ shared_buffer_ = nullptr;
return false;
}
@@ -267,7 +267,7 @@ bool SharedBufferDispatcher::EndSerializeAndCloseImplNoLock(
platform_handles->push_back(platform_handle.release());
*actual_size = sizeof(SerializedSharedBufferDispatcher);
- shared_buffer_ = NULL;
+ shared_buffer_ = nullptr;
return true;
}
diff --git a/mojo/system/simple_dispatcher_unittest.cc b/mojo/system/simple_dispatcher_unittest.cc
index ecd991da..d5faa34 100644
--- a/mojo/system/simple_dispatcher_unittest.cc
+++ b/mojo/system/simple_dispatcher_unittest.cc
@@ -114,7 +114,7 @@ TEST(SimpleDispatcherTest, MAYBE_Basic) {
w.Init();
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 1, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 1, nullptr));
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK, w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -130,7 +130,7 @@ TEST(SimpleDispatcherTest, MAYBE_Basic) {
w.Init();
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, nullptr));
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK, w.Wait(0, &context));
@@ -146,7 +146,7 @@ TEST(SimpleDispatcherTest, MAYBE_Basic) {
w.Init();
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, nullptr));
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK,
@@ -163,9 +163,9 @@ TEST(SimpleDispatcherTest, MAYBE_Basic) {
w.Init();
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr));
stopwatch.Start();
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, NULL));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, nullptr));
EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout());
hss = HandleSignalsState();
d->RemoveWaiter(&w, &hss);
@@ -178,10 +178,10 @@ TEST(SimpleDispatcherTest, MAYBE_Basic) {
w.Init();
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 5, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 5, nullptr));
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
- w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), NULL));
+ w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), nullptr));
base::TimeDelta elapsed = stopwatch.Elapsed();
EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout());
EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout());
@@ -218,7 +218,7 @@ TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE |
MOJO_HANDLE_SIGNAL_WRITABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, nullptr));
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
@@ -235,7 +235,7 @@ TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE |
MOJO_HANDLE_SIGNAL_WRITABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, nullptr));
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, w.Wait(0, &context));
@@ -252,7 +252,7 @@ TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE |
MOJO_HANDLE_SIGNAL_WRITABLE);
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr));
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
@@ -290,7 +290,7 @@ TEST(SimpleDispatcherTest, BasicClosed) {
d = new MockSimpleDispatcher();
w.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, nullptr));
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_CANCELLED, w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -302,7 +302,7 @@ TEST(SimpleDispatcherTest, BasicClosed) {
d = new MockSimpleDispatcher();
w.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, nullptr));
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_CANCELLED, w.Wait(0, &context));
@@ -315,7 +315,7 @@ TEST(SimpleDispatcherTest, BasicClosed) {
d = new MockSimpleDispatcher();
w.Init();
ASSERT_EQ(MOJO_RESULT_OK,
- d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, NULL));
+ d->AddWaiter(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr));
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_CANCELLED,
diff --git a/mojo/system/transport_data.cc b/mojo/system/transport_data.cc
index d14ac71f..568df28 100644
--- a/mojo/system/transport_data.cc
+++ b/mojo/system/transport_data.cc
@@ -297,7 +297,7 @@ const char* TransportData::ValidateBuffer(
return kInvalidSerializedDispatcher;
}
- return NULL;
+ return nullptr;
}
// static