diff options
Diffstat (limited to 'chromium/ipc')
25 files changed, 92 insertions, 140 deletions
diff --git a/chromium/ipc/BUILD.gn b/chromium/ipc/BUILD.gn index 45d341e4033..994d45e8450 100644 --- a/chromium/ipc/BUILD.gn +++ b/chromium/ipc/BUILD.gn @@ -286,7 +286,6 @@ if (!is_ios) { "//base:i18n", "//base/test:test_support", "//crypto", - "//mojo/core/embedder", "//mojo/core/test:test_support", "//testing/gtest", ] diff --git a/chromium/ipc/ipc_channel.h b/chromium/ipc/ipc_channel.h index 5c3ad99b1cb..f3bf7f6ca59 100644 --- a/chromium/ipc/ipc_channel.h +++ b/chromium/ipc/ipc_channel.h @@ -24,8 +24,6 @@ #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message.h" #include "ipc/ipc_sender.h" -#include "mojo/public/cpp/bindings/associated_interface_ptr.h" -#include "mojo/public/cpp/bindings/associated_interface_request.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" @@ -110,21 +108,6 @@ class COMPONENT_EXPORT(IPC) Channel : public Sender { const std::string& name, mojo::ScopedInterfaceEndpointHandle handle) = 0; - // Remove this after done with migrating all AsscoiatedInterfacePtr to - // AsscoiatedRemote. - // Template helper to add an interface factory to this channel. - template <typename Interface> - using AssociatedInterfaceFactory = base::RepeatingCallback<void( - mojo::AssociatedInterfaceRequest<Interface>)>; - template <typename Interface> - void AddAssociatedInterface( - const AssociatedInterfaceFactory<Interface>& factory) { - AddGenericAssociatedInterface( - Interface::Name_, - base::BindRepeating(&BindAssociatedInterfaceRequest<Interface>, - factory)); - } - // Template helper to add an interface factory to this channel. template <typename Interface> using AssociatedReceiverFactory = base::RepeatingCallback<void( @@ -138,17 +121,6 @@ class COMPONENT_EXPORT(IPC) Channel : public Sender { factory)); } - // Remove this after done with migrating all AsscoiatedInterfacePtr to - // AsscoiatedRemote. - // Template helper to request a remote associated interface. - template <typename Interface> - void GetRemoteAssociatedInterface( - mojo::AssociatedInterfacePtr<Interface>* proxy) { - auto request = mojo::MakeRequest(proxy); - GetGenericRemoteAssociatedInterface(Interface::Name_, - request.PassHandle()); - } - // Template helper to request a remote associated interface. template <typename Interface> void GetRemoteAssociatedInterface( @@ -158,16 +130,6 @@ class COMPONENT_EXPORT(IPC) Channel : public Sender { } private: - // Remove this after done with migrating all AsscoiatedInterfacePtr to - // AsscoiatedRemote. - template <typename Interface> - static void BindAssociatedInterfaceRequest( - const AssociatedInterfaceFactory<Interface>& factory, - mojo::ScopedInterfaceEndpointHandle handle) { - factory.Run( - mojo::AssociatedInterfaceRequest<Interface>(std::move(handle))); - } - template <typename Interface> static void BindPendingAssociatedReceiver( const AssociatedReceiverFactory<Interface>& factory, diff --git a/chromium/ipc/ipc_channel_mojo_unittest.cc b/chromium/ipc/ipc_channel_mojo_unittest.cc index 55ec898c075..806d1d32299 100644 --- a/chromium/ipc/ipc_channel_mojo_unittest.cc +++ b/chromium/ipc/ipc_channel_mojo_unittest.cc @@ -12,6 +12,7 @@ #include "base/base_paths.h" #include "base/bind.h" +#include "base/bind_helpers.h" #include "base/callback_helpers.h" #include "base/containers/queue.h" #include "base/files/file.h" @@ -49,11 +50,11 @@ #include "ipc/ipc_test.mojom.h" #include "ipc/ipc_test_base.h" #include "ipc/ipc_test_channel_listener.h" -#include "mojo/core/embedder/embedder.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" +#include "mojo/public/cpp/system/functions.h" #include "mojo/public/cpp/system/wait.h" #include "testing/gtest/include/gtest/gtest.h" @@ -348,7 +349,7 @@ TEST_F(IPCChannelMojoTest, NoImplicitChannelClosure) { // before Init() launches a child process. Hence the base::Optional here. base::Optional<base::RunLoop> wait_for_error_loop; bool process_error_received = false; - mojo::core::SetDefaultProcessErrorCallback( + mojo::SetDefaultProcessErrorHandler( base::BindLambdaForTesting([&](const std::string&) { process_error_received = true; wait_for_error_loop->Quit(); @@ -363,6 +364,7 @@ TEST_F(IPCChannelMojoTest, NoImplicitChannelClosure) { wait_for_error_loop->Run(); EXPECT_TRUE(process_error_received); + mojo::SetDefaultProcessErrorHandler(base::NullCallback()); // Tell the child it can quit and wait for it to shut down. ListenerThatExpectsOK::SendOK(channel()); diff --git a/chromium/ipc/ipc_channel_nacl.cc b/chromium/ipc/ipc_channel_nacl.cc index fd0eeb437d4..d5fa3cb95b6 100644 --- a/chromium/ipc/ipc_channel_nacl.cc +++ b/chromium/ipc/ipc_channel_nacl.cc @@ -212,9 +212,8 @@ bool ChannelNacl::Send(Message* message) { Logging::GetInstance()->OnSendMessage(message_ptr.get()); #endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED) - TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "ChannelNacl::Send", message->header()->flags, - TRACE_EVENT_FLAG_FLOW_OUT); + TRACE_EVENT_WITH_FLOW0("toplevel.flow", "ChannelNacl::Send", + message->header()->flags, TRACE_EVENT_FLAG_FLOW_OUT); output_queue_.push_back(std::move(message_ptr)); if (!waiting_connect_) return ProcessOutgoingMessages(); diff --git a/chromium/ipc/ipc_channel_proxy.cc b/chromium/ipc/ipc_channel_proxy.cc index c1d6a32cd23..e1796abc232 100644 --- a/chromium/ipc/ipc_channel_proxy.cc +++ b/chromium/ipc/ipc_channel_proxy.cc @@ -47,7 +47,7 @@ ChannelProxy::Context::Context( // 2) Just use Channel // Note, we currently make an exception for a NULL listener. That usage // basically works, but is outside the intent of ChannelProxy. This support - // will disappear, so please don't rely on it. See crbug.com/364241 + // will disappear, so please don't rely on it. See https://crbug.com/364241 DCHECK(!listener || (ipc_task_runner_.get() != default_listener_task_runner_.get())); } @@ -174,7 +174,7 @@ void ChannelProxy::Context::OnAssociatedInterfaceRequest( // Called on the IPC::Channel thread void ChannelProxy::Context::OnChannelOpened() { - DCHECK(channel_ != NULL); + DCHECK(channel_); // Assume a reference to ourselves on behalf of this thread. This reference // will be released when we are closed. @@ -220,7 +220,7 @@ void ChannelProxy::Context::OnChannelClosed() { } void ChannelProxy::Context::Clear() { - listener_ = NULL; + listener_ = nullptr; } // Called on the IPC::Channel thread @@ -461,7 +461,7 @@ std::unique_ptr<ChannelProxy> ChannelProxy::Create( ChannelProxy::ChannelProxy(Context* context) : context_(context), did_init_(false) { #if defined(ENABLE_IPC_FUZZER) - outgoing_message_filter_ = NULL; + outgoing_message_filter_ = nullptr; #endif } @@ -472,7 +472,7 @@ ChannelProxy::ChannelProxy( : context_(new Context(listener, ipc_task_runner, listener_task_runner)), did_init_(false) { #if defined(ENABLE_IPC_FUZZER) - outgoing_message_filter_ = NULL; + outgoing_message_filter_ = nullptr; #endif } diff --git a/chromium/ipc/ipc_channel_proxy.h b/chromium/ipc/ipc_channel_proxy.h index 5b7cb6e93e9..ee7b78f0f45 100644 --- a/chromium/ipc/ipc_channel_proxy.h +++ b/chromium/ipc/ipc_channel_proxy.h @@ -24,8 +24,6 @@ #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" -#include "mojo/public/cpp/bindings/associated_interface_ptr.h" -#include "mojo/public/cpp/bindings/associated_interface_request.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/lib/message_quota_checker.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" @@ -201,16 +199,6 @@ class COMPONENT_EXPORT(IPC) ChannelProxy : public Sender { const std::string& name, mojo::ScopedInterfaceEndpointHandle handle); - // Template helper to request associated interfaces from the remote endpoint. - // Remove this after done with migrating all AsscoiatedInterfacePtr to - // AsscoiatedRemote. - template <typename Interface> - void GetRemoteAssociatedInterface( - mojo::AssociatedInterfacePtr<Interface>* proxy) { - auto request = mojo::MakeRequest(proxy); - GetGenericRemoteAssociatedInterface(Interface::Name_, request.PassHandle()); - } - // Template helper to receive associated interfaces from the remote endpoint. template <typename Interface> void GetRemoteAssociatedInterface(mojo::AssociatedRemote<Interface>* proxy) { diff --git a/chromium/ipc/ipc_fuzzing_tests.cc b/chromium/ipc/ipc_fuzzing_tests.cc index ca8827b12b7..d9a2ef6f3b4 100644 --- a/chromium/ipc/ipc_fuzzing_tests.cc +++ b/chromium/ipc/ipc_fuzzing_tests.cc @@ -74,7 +74,7 @@ TEST(IPCMessageIntegrity, ReadBytesBadIterator) { m.WriteInt(2); base::PickleIterator iter(m); - const char* data = NULL; + const char* data = nullptr; EXPECT_TRUE(iter.ReadBytes(&data, sizeof(int))); } @@ -141,8 +141,7 @@ TEST(IPCMessageIntegrity, DISABLED_ReadVectorTooLarge3) { class SimpleListener : public IPC::Listener { public: - SimpleListener() : other_(NULL) { - } + SimpleListener() : other_(nullptr) {} void Init(IPC::Sender* s) { other_ = s; } @@ -223,8 +222,7 @@ class FuzzerServerListener : public SimpleListener { class FuzzerClientListener : public SimpleListener { public: - FuzzerClientListener() : last_msg_(NULL) { - } + FuzzerClientListener() : last_msg_(nullptr) {} bool OnMessageReceived(const IPC::Message& msg) override { last_msg_ = new IPC::Message(msg); @@ -248,7 +246,7 @@ class FuzzerClientListener : public SimpleListener { return false; delete last_msg_; - last_msg_ = NULL; + last_msg_ = nullptr; return true; } @@ -259,7 +257,7 @@ class FuzzerClientListener : public SimpleListener { private: bool MsgHandlerInternal(uint32_t type_id) { base::RunLoop().Run(); - if (NULL == last_msg_) + if (!last_msg_) return false; if (FUZZER_ROUTING_ID != last_msg_->routing_id()) return false; @@ -291,7 +289,7 @@ TEST_F(IPCFuzzingTest, SanityTest) { listener.Init(channel()); ASSERT_TRUE(ConnectChannel()); - IPC::Message* msg = NULL; + IPC::Message* msg = nullptr; int value = 43; msg = new MsgClassIS(value, base::ASCIIToUTF16("expect 43")); sender()->Send(msg); diff --git a/chromium/ipc/ipc_logging.cc b/chromium/ipc/ipc_logging.cc index 905b161115f..3fcaed45dc8 100644 --- a/chromium/ipc/ipc_logging.cc +++ b/chromium/ipc/ipc_logging.cc @@ -48,9 +48,9 @@ Logging::Logging() enabled_on_stderr_(false), enabled_color_(false), queue_invoke_later_pending_(false), - sender_(NULL), + sender_(nullptr), main_thread_(base::ThreadTaskRunnerHandle::Get()), - consumer_(NULL) { + consumer_(nullptr) { #if defined(OS_WIN) // getenv triggers an unsafe warning. Simply check how big of a buffer // would be needed to fetch the value to see if the enviornment variable is diff --git a/chromium/ipc/ipc_message.cc b/chromium/ipc/ipc_message.cc index 10237293168..c26a542d984 100644 --- a/chromium/ipc/ipc_message.cc +++ b/chromium/ipc/ipc_message.cc @@ -84,7 +84,7 @@ void Message::Init() { #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED) received_time_ = 0; dont_log_ = false; - log_data_ = NULL; + log_data_ = nullptr; #endif } @@ -104,7 +104,7 @@ void Message::SetHeaderValues(int32_t routing, uint32_t type, uint32_t flags) { } void Message::EnsureMessageAttachmentSet() { - if (attachment_set_.get() == NULL) + if (!attachment_set_.get()) attachment_set_ = new MessageAttachmentSet; } diff --git a/chromium/ipc/ipc_message_attachment.cc b/chromium/ipc/ipc_message_attachment.cc index 55f0d3c5043..fb5d5a64c28 100644 --- a/chromium/ipc/ipc_message_attachment.cc +++ b/chromium/ipc/ipc_message_attachment.cc @@ -6,6 +6,7 @@ #include "base/files/scoped_file.h" #include "base/logging.h" +#include "base/notreached.h" #include "ipc/ipc_mojo_handle_attachment.h" #include "mojo/public/cpp/system/platform_handle.h" diff --git a/chromium/ipc/ipc_message_pipe_reader.cc b/chromium/ipc/ipc_message_pipe_reader.cc index 4668a981ae6..bdc5dd680d0 100644 --- a/chromium/ipc/ipc_message_pipe_reader.cc +++ b/chromium/ipc/ipc_message_pipe_reader.cc @@ -51,9 +51,8 @@ void MessagePipeReader::Close() { bool MessagePipeReader::Send(std::unique_ptr<Message> message) { CHECK(message->IsValid()); - TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "MessagePipeReader::Send", message->flags(), - TRACE_EVENT_FLAG_FLOW_OUT); + TRACE_EVENT_WITH_FLOW0("toplevel.flow", "MessagePipeReader::Send", + message->flags(), TRACE_EVENT_FLAG_FLOW_OUT); base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles; MojoResult result = MOJO_RESULT_OK; result = ChannelMojo::ReadFromMessageAttachmentSet(message.get(), &handles); @@ -101,9 +100,8 @@ void MessagePipeReader::Receive(MessageView message_view) { return; } - TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "MessagePipeReader::Receive", message.flags(), - TRACE_EVENT_FLAG_FLOW_IN); + TRACE_EVENT_WITH_FLOW0("toplevel.flow", "MessagePipeReader::Receive", + message.flags(), TRACE_EVENT_FLAG_FLOW_IN); delegate_->OnMessageReceived(message); } diff --git a/chromium/ipc/ipc_message_pipe_reader.h b/chromium/ipc/ipc_message_pipe_reader.h index 2f66ca0fd2b..b7f73d2a9ae 100644 --- a/chromium/ipc/ipc_message_pipe_reader.h +++ b/chromium/ipc/ipc_message_pipe_reader.h @@ -60,7 +60,7 @@ class COMPONENT_EXPORT(IPC) MessagePipeReader : public mojom::Channel { // Builds a reader that reads messages from |receive_handle| and lets // |delegate| know. // - // |pipe| is the message pipe handle corresponding to the channel's master + // |pipe| is the message pipe handle corresponding to the channel's primary // interface. This is the message pipe underlying both |sender| and // |receiver|. // diff --git a/chromium/ipc/ipc_message_templates.h b/chromium/ipc/ipc_message_templates.h index 9c775e13e7b..dc49e2e9800 100644 --- a/chromium/ipc/ipc_message_templates.h +++ b/chromium/ipc/ipc_message_templates.h @@ -11,7 +11,8 @@ #include <type_traits> #include <utility> -#include "base/logging.h" +#include "base/check.h" +#include "base/notreached.h" #include "base/trace_event/trace_event.h" #include "base/tuple.h" #include "build/build_config.h" diff --git a/chromium/ipc/ipc_message_utils.cc b/chromium/ipc/ipc_message_utils.cc index 92e7ca6c88a..c890d322435 100644 --- a/chromium/ipc/ipc_message_utils.cc +++ b/chromium/ipc/ipc_message_utils.cc @@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "base/json/json_writer.h" +#include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/strings/nullable_string16.h" #include "base/strings/string_number_conversions.h" @@ -79,7 +80,7 @@ void LogBytes(const std::vector<CharType>& data, std::string* out) { bool ReadValue(const base::Pickle* m, base::PickleIterator* iter, - std::unique_ptr<base::Value>* value, + base::Value* value, int recursion); void WriteValue(base::Pickle* m, const base::Value* value, int recursion) { @@ -166,15 +167,16 @@ bool ReadDictionaryValue(const base::Pickle* m, if (!ReadParam(m, iter, &size)) return false; - for (int i = 0; i < size; ++i) { - std::string key; - std::unique_ptr<base::Value> subval; - if (!ReadParam(m, iter, &key) || - !ReadValue(m, iter, &subval, recursion + 1)) + std::vector<std::pair<std::string, std::unique_ptr<base::Value>>> entries; + entries.resize(size); + for (auto& entry : entries) { + entry.second = std::make_unique<base::Value>(); + if (!ReadParam(m, iter, &entry.first) || + !ReadValue(m, iter, entry.second.get(), recursion + 1)) return false; - value->SetWithoutPathExpansion(key, std::move(subval)); } + *value = base::DictionaryValue(base::Value::DictStorage(std::move(entries))); return true; } @@ -188,19 +190,19 @@ bool ReadListValue(const base::Pickle* m, if (!ReadParam(m, iter, &size)) return false; - for (int i = 0; i < size; ++i) { - std::unique_ptr<base::Value> subval; + base::Value::ListStorage list_storage; + list_storage.resize(size); + for (base::Value& subval : list_storage) { if (!ReadValue(m, iter, &subval, recursion + 1)) return false; - value->Set(i, std::move(subval)); } - + *value = base::ListValue(std::move(list_storage)); return true; } bool ReadValue(const base::Pickle* m, base::PickleIterator* iter, - std::unique_ptr<base::Value>* value, + base::Value* value, int recursion) { if (recursion > kMaxRecursionDepth) { LOG(ERROR) << "Max recursion depth hit in ReadValue."; @@ -213,56 +215,55 @@ bool ReadValue(const base::Pickle* m, switch (static_cast<base::Value::Type>(type)) { case base::Value::Type::NONE: - *value = std::make_unique<base::Value>(); + *value = base::Value(); break; case base::Value::Type::BOOLEAN: { bool val; if (!ReadParam(m, iter, &val)) return false; - *value = std::make_unique<base::Value>(val); + *value = base::Value(val); break; } case base::Value::Type::INTEGER: { int val; if (!ReadParam(m, iter, &val)) return false; - *value = std::make_unique<base::Value>(val); + *value = base::Value(val); break; } case base::Value::Type::DOUBLE: { double val; if (!ReadParam(m, iter, &val)) return false; - *value = std::make_unique<base::Value>(val); + *value = base::Value(val); break; } case base::Value::Type::STRING: { std::string val; if (!ReadParam(m, iter, &val)) return false; - *value = std::make_unique<base::Value>(std::move(val)); + *value = base::Value(std::move(val)); break; } case base::Value::Type::BINARY: { - const char* data; - int length; - if (!iter->ReadData(&data, &length)) + base::span<const uint8_t> data; + if (!iter->ReadData(&data)) return false; - *value = base::Value::CreateWithCopiedBuffer(data, length); + *value = base::Value(data); break; } case base::Value::Type::DICTIONARY: { base::DictionaryValue val; if (!ReadDictionaryValue(m, iter, &val, recursion)) return false; - *value = std::make_unique<base::Value>(std::move(val)); + *value = std::move(val); break; } case base::Value::Type::LIST: { base::ListValue val; if (!ReadListValue(m, iter, &val, recursion)) return false; - *value = std::make_unique<base::Value>(std::move(val)); + *value = std::move(val); break; } default: diff --git a/chromium/ipc/ipc_mojo_bootstrap.cc b/chromium/ipc/ipc_mojo_bootstrap.cc index 70d47b11187..0ed06bdd403 100644 --- a/chromium/ipc/ipc_mojo_bootstrap.cc +++ b/chromium/ipc/ipc_mojo_bootstrap.cc @@ -132,9 +132,9 @@ class ChannelAssociatedGroupController control_message_proxy_(&control_message_proxy_thunk_) { thread_checker_.DetachFromThread(); control_message_handler_.SetDescription( - "IPC::mojom::Bootstrap [master] PipeControlMessageHandler"); + "IPC::mojom::Bootstrap [primary] PipeControlMessageHandler"); dispatcher_.SetValidator(std::make_unique<mojo::MessageHeaderValidator>( - "IPC::mojom::Bootstrap [master] MessageHeaderValidator")); + "IPC::mojom::Bootstrap [primary] MessageHeaderValidator")); GetMemoryDumpProvider().AddController(this); } @@ -302,10 +302,10 @@ class ChannelAssociatedGroupController if (!mojo::IsValidInterfaceId(id)) return mojo::ScopedInterfaceEndpointHandle(); - // Unless it is the master ID, |id| is from the remote side and therefore + // Unless it is the primary ID, |id| is from the remote side and therefore // its namespace bit is supposed to be different than the value that this // router would use. - if (!mojo::IsMasterInterfaceId(id) && + if (!mojo::IsPrimaryInterfaceId(id) && set_interface_id_namespace_bit_ == mojo::HasInterfaceIdNamespaceBitSet(id)) { return mojo::ScopedInterfaceEndpointHandle(); @@ -341,7 +341,7 @@ class ChannelAssociatedGroupController MarkClosedAndMaybeRemove(endpoint); } - if (!mojo::IsMasterInterfaceId(id) || reason) + if (!mojo::IsPrimaryInterfaceId(id) || reason) control_message_proxy_.NotifyPeerEndpointClosed(id, reason); } @@ -573,7 +573,7 @@ class ChannelAssociatedGroupController bool SyncWatch(const bool* should_stop) override { DCHECK(task_runner_->RunsTasksInCurrentSequence()); - // It's not legal to make sync calls from the master endpoint's thread, + // It's not legal to make sync calls from the primary endpoint's thread, // and in fact they must only happen from the proxy task runner. DCHECK(!controller_->task_runner_->BelongsToCurrentThread()); DCHECK(controller_->proxy_task_runner_->BelongsToCurrentThread()); @@ -729,18 +729,18 @@ class ChannelAssociatedGroupController // information to the task scheduler. CHECK_LE(message->data_num_bytes(), Channel::kMaximumMessageSize); - // We always post tasks to the master endpoint thread when called from + // We always post tasks to the primary endpoint thread when called from // other threads in order to simulate IPC::ChannelProxy::Send behavior. task_runner_->PostTask( FROM_HERE, base::BindOnce( - &ChannelAssociatedGroupController::SendMessageOnMasterThread, + &ChannelAssociatedGroupController::SendMessageOnPrimaryThread, this, std::move(*message))); return true; } } - void SendMessageOnMasterThread(mojo::Message message) { + void SendMessageOnPrimaryThread(mojo::Message message) { DCHECK(thread_checker_.CalledOnValidThread()); if (!SendMessage(&message)) RaiseError(); @@ -899,8 +899,8 @@ class ChannelAssociatedGroupController return true; } - // We do not expect to receive sync responses on the master endpoint thread. - // If it's happening, it's a bug. + // We do not expect to receive sync responses on the primary endpoint + // thread. If it's happening, it's a bug. DCHECK(!message->has_flag(mojo::Message::kFlagIsSync) || !message->has_flag(mojo::Message::kFlagIsResponse)); @@ -912,7 +912,7 @@ class ChannelAssociatedGroupController DCHECK(proxy_task_runner_->BelongsToCurrentThread()); mojo::InterfaceId id = message.interface_id(); - DCHECK(mojo::IsValidInterfaceId(id) && !mojo::IsMasterInterfaceId(id)); + DCHECK(mojo::IsValidInterfaceId(id) && !mojo::IsPrimaryInterfaceId(id)); base::AutoLock locker(lock_); Endpoint* endpoint = FindEndpoint(id); @@ -996,7 +996,7 @@ class ChannelAssociatedGroupController return false; } - // Checked in places which must be run on the master endpoint's thread. + // Checked in places which must be run on the primary endpoint's thread. base::ThreadChecker thread_checker_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; diff --git a/chromium/ipc/ipc_mojo_message_helper.cc b/chromium/ipc/ipc_mojo_message_helper.cc index f3170950e13..460e04f5477 100644 --- a/chromium/ipc/ipc_mojo_message_helper.cc +++ b/chromium/ipc/ipc_mojo_message_helper.cc @@ -6,6 +6,7 @@ #include <utility> +#include "base/logging.h" #include "ipc/ipc_mojo_handle_attachment.h" namespace IPC { diff --git a/chromium/ipc/ipc_mojo_param_traits.cc b/chromium/ipc/ipc_mojo_param_traits.cc index 5eeb9f0fbb7..da5b0d2214f 100644 --- a/chromium/ipc/ipc_mojo_param_traits.cc +++ b/chromium/ipc/ipc_mojo_param_traits.cc @@ -4,6 +4,7 @@ #include "ipc/ipc_mojo_param_traits.h" +#include "base/logging.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_mojo_handle_attachment.h" #include "ipc/ipc_mojo_message_helper.h" diff --git a/chromium/ipc/ipc_mojo_perftest.cc b/chromium/ipc/ipc_mojo_perftest.cc index df562d4f9ae..723b96d9ebd 100644 --- a/chromium/ipc/ipc_mojo_perftest.cc +++ b/chromium/ipc/ipc_mojo_perftest.cc @@ -42,7 +42,7 @@ class PerformanceChannelListener : public Listener { public: explicit PerformanceChannelListener(const std::string& label) : label_(label), - sender_(NULL), + sender_(nullptr), msg_count_(0), msg_size_(0), sync_(false), diff --git a/chromium/ipc/ipc_perftest_util.cc b/chromium/ipc/ipc_perftest_util.cc index cf35d3cda12..4945f83c85e 100644 --- a/chromium/ipc/ipc_perftest_util.cc +++ b/chromium/ipc/ipc_perftest_util.cc @@ -19,7 +19,7 @@ scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() { static_cast<base::SingleThreadTaskRunner*>(runner.get())); } -ChannelReflectorListener::ChannelReflectorListener() : channel_(NULL) { +ChannelReflectorListener::ChannelReflectorListener() : channel_(nullptr) { VLOG(1) << "Client listener up"; } diff --git a/chromium/ipc/ipc_sync_channel.cc b/chromium/ipc/ipc_sync_channel.cc index 823ec8d724f..d6c5b51f7a0 100644 --- a/chromium/ipc/ipc_sync_channel.cc +++ b/chromium/ipc/ipc_sync_channel.cc @@ -457,7 +457,7 @@ bool SyncChannel::SyncContext::TryToUnblockListener(const Message* msg) { } base::WaitableEvent* done_event = deserializers_.back().done_event; - TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), + TRACE_EVENT_FLOW_BEGIN0("toplevel.flow", "SyncChannel::SyncContext::TryToUnblockListener", done_event); @@ -522,7 +522,7 @@ void SyncChannel::SyncContext::CancelPendingSends() { PendingSyncMessageQueue::iterator iter; DVLOG(1) << "Canceling pending sends"; for (iter = deserializers_.begin(); iter != deserializers_.end(); iter++) { - TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), + TRACE_EVENT_FLOW_BEGIN0("toplevel.flow", "SyncChannel::SyncContext::CancelPendingSends", iter->done_event); iter->done_event->Signal(); @@ -644,8 +644,8 @@ bool SyncChannel::Send(Message* message) { scoped_refptr<mojo::SyncHandleRegistry> registry = sync_handle_registry_; WaitForReply(registry.get(), context.get(), pump_messages); - TRACE_EVENT_FLOW_END0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "SyncChannel::Send", context->GetSendDoneEvent()); + TRACE_EVENT_FLOW_END0("toplevel.flow", "SyncChannel::Send", + context->GetSendDoneEvent()); return context->Pop(); } diff --git a/chromium/ipc/ipc_sync_channel_unittest.cc b/chromium/ipc/ipc_sync_channel_unittest.cc index 31a734b8eca..6649aad6cb3 100644 --- a/chromium/ipc/ipc_sync_channel_unittest.cc +++ b/chromium/ipc/ipc_sync_channel_unittest.cc @@ -56,7 +56,7 @@ class Worker : public Listener, public Sender { mode_(mode), ipc_thread_((thread_name + "_ipc").c_str()), listener_thread_((thread_name + "_listener").c_str()), - overrided_thread_(NULL), + overrided_thread_(nullptr), shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED), is_shutdown_(false) {} @@ -73,7 +73,7 @@ class Worker : public Listener, public Sender { mode_(mode), ipc_thread_("ipc thread"), listener_thread_("listener thread"), - overrided_thread_(NULL), + overrided_thread_(nullptr), shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED), is_shutdown_(false) {} @@ -113,7 +113,7 @@ class Worker : public Listener, public Sender { is_shutdown_ = true; } void OverrideThread(base::Thread* overrided_thread) { - DCHECK(overrided_thread_ == NULL); + DCHECK(!overrided_thread_); overrided_thread_ = overrided_thread; } bool SendAnswerToLife(bool pump, bool succeed) { @@ -1396,7 +1396,7 @@ class RestrictedDispatchDeadlockServer : public Worker { void OnNoArgs() { if (server_num_ == 1) { - DCHECK(peer_ != NULL); + DCHECK(peer_); peer_->SendMessageToClient(); } } @@ -1572,7 +1572,7 @@ TEST_F(IPCSyncChannelTest, RestrictedDispatchDeadlock) { mojo::MessagePipe pipe1, pipe2; server2 = new RestrictedDispatchDeadlockServer( - 2, &server2_ready, events, NULL, std::move(pipe2.handle0)); + 2, &server2_ready, events, nullptr, std::move(pipe2.handle0)); server2->OverrideThread(&worker_thread); workers.push_back(server2); @@ -1700,13 +1700,13 @@ TEST_F(IPCSyncChannelTest, MAYBE_RestrictedDispatch4WayDeadlock) { &success)); workers.push_back(new RestrictedDispatchPipeWorker( std::move(pipe1.handle0), &event1, std::move(pipe2.handle1), &event2, 2, - NULL)); + nullptr)); workers.push_back(new RestrictedDispatchPipeWorker( std::move(pipe2.handle0), &event2, std::move(pipe3.handle1), &event3, 3, - NULL)); + nullptr)); workers.push_back(new RestrictedDispatchPipeWorker( std::move(pipe3.handle0), &event3, std::move(pipe0.handle1), &event0, 4, - NULL)); + nullptr)); RunTest(workers); EXPECT_EQ(3, success); } @@ -1770,7 +1770,8 @@ class ReentrantReplyServer1 : public Worker { class ReentrantReplyServer2 : public Worker { public: ReentrantReplyServer2(mojo::ScopedMessagePipeHandle channel_handle) - : Worker(std::move(channel_handle), Channel::MODE_SERVER), reply_(NULL) {} + : Worker(std::move(channel_handle), Channel::MODE_SERVER), + reply_(nullptr) {} private: bool OnMessageReceived(const Message& message) override { @@ -1790,7 +1791,7 @@ class ReentrantReplyServer2 : public Worker { void OnReentrant3() { DCHECK(reply_); Message* reply = reply_; - reply_ = NULL; + reply_ = nullptr; reply->set_unblock(true); Send(reply); Done(); diff --git a/chromium/ipc/ipc_sync_message_filter.cc b/chromium/ipc/ipc_sync_message_filter.cc index fbf70daf6b9..2decbc7ee4c 100644 --- a/chromium/ipc/ipc_sync_message_filter.cc +++ b/chromium/ipc/ipc_sync_message_filter.cc @@ -81,8 +81,8 @@ bool SyncMessageFilter::Send(Message* message) { const bool* stop_flags[] = { &done, &shutdown }; registry->Wait(stop_flags, 2); if (done) { - TRACE_EVENT_FLOW_END0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "SyncMessageFilter::Send", &done_event); + TRACE_EVENT_FLOW_END0("toplevel.flow", "SyncMessageFilter::Send", + &done_event); } registry->UnregisterEvent(shutdown_event_, on_shutdown_callback); @@ -131,7 +131,7 @@ bool SyncMessageFilter::OnMessageReceived(const Message& message) { (*iter)->send_result = (*iter)->deserializer->SerializeOutputParameters(message); } - TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), + TRACE_EVENT_FLOW_BEGIN0("toplevel.flow", "SyncMessageFilter::OnMessageReceived", (*iter)->done_event); (*iter)->done_event->Signal(); @@ -169,7 +169,7 @@ void SyncMessageFilter::SignalAllEvents() { lock_.AssertAcquired(); for (PendingSyncMessages::iterator iter = pending_sync_messages_.begin(); iter != pending_sync_messages_.end(); ++iter) { - TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), + TRACE_EVENT_FLOW_BEGIN0("toplevel.flow", "SyncMessageFilter::SignalAllEvents", (*iter)->done_event); (*iter)->done_event->Signal(); diff --git a/chromium/ipc/ipc_test_channel_listener.h b/chromium/ipc/ipc_test_channel_listener.h index 75635f7db39..2a4cda96135 100644 --- a/chromium/ipc/ipc_test_channel_listener.h +++ b/chromium/ipc/ipc_test_channel_listener.h @@ -21,7 +21,7 @@ class TestChannelListener : public Listener { static const size_t kLongMessageStringNumBytes = 50000; static void SendOneMessage(Sender* sender, const char* text); - TestChannelListener() : sender_(NULL), messages_left_(50) {} + TestChannelListener() : sender_(nullptr), messages_left_(50) {} ~TestChannelListener() override {} bool OnMessageReceived(const Message& message) override; diff --git a/chromium/ipc/message_router.cc b/chromium/ipc/message_router.cc index 3e6aac61d50..61effe57e38 100644 --- a/chromium/ipc/message_router.cc +++ b/chromium/ipc/message_router.cc @@ -4,6 +4,7 @@ #include "ipc/message_router.h" +#include "base/logging.h" #include "ipc/ipc_message.h" namespace IPC { diff --git a/chromium/ipc/sync_socket_unittest.cc b/chromium/ipc/sync_socket_unittest.cc index e346bae0497..f6c0aa8a030 100644 --- a/chromium/ipc/sync_socket_unittest.cc +++ b/chromium/ipc/sync_socket_unittest.cc @@ -57,8 +57,7 @@ const size_t kHelloStringLength = base::size(kHelloString); // messages from the client. class SyncSocketServerListener : public IPC::Listener { public: - SyncSocketServerListener() : chan_(NULL) { - } + SyncSocketServerListener() : chan_(nullptr) {} void Init(IPC::Channel* chan) { chan_ = chan; |