diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/mojo/public/cpp/bindings/lib | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/mojo/public/cpp/bindings/lib')
14 files changed, 54 insertions, 62 deletions
diff --git a/chromium/mojo/public/cpp/bindings/lib/array_internal.h b/chromium/mojo/public/cpp/bindings/lib/array_internal.h index e34349f2a72..cb8c5b30907 100644 --- a/chromium/mojo/public/cpp/bindings/lib/array_internal.h +++ b/chromium/mojo/public/cpp/bindings/lib/array_internal.h @@ -11,8 +11,8 @@ #include <limits> #include <new> +#include "base/check.h" #include "base/component_export.h" -#include "base/logging.h" #include "base/macros.h" #include "mojo/public/c/system/macros.h" #include "mojo/public/cpp/bindings/lib/bindings_internal.h" diff --git a/chromium/mojo/public/cpp/bindings/lib/binding_state.cc b/chromium/mojo/public/cpp/bindings/lib/binding_state.cc index f0eab656f1e..ecfe41c4652 100644 --- a/chromium/mojo/public/cpp/bindings/lib/binding_state.cc +++ b/chromium/mojo/public/cpp/bindings/lib/binding_state.cc @@ -36,9 +36,9 @@ void BindingStateBase::ResumeIncomingMethodCallProcessing() { router_->ResumeIncomingMethodCallProcessing(); } -bool BindingStateBase::WaitForIncomingMethodCall(MojoDeadline deadline) { +bool BindingStateBase::WaitForIncomingMethodCall() { DCHECK(router_); - return router_->WaitForIncomingMessage(deadline); + return router_->WaitForIncomingMessage(); } void BindingStateBase::PauseRemoteCallbacksUntilFlushCompletes( @@ -121,11 +121,11 @@ void BindingStateBase::BindInternal( : MultiplexRouter::SINGLE_INTERFACE); router_ = new MultiplexRouter(std::move(receiver_state->pipe), config, false, sequenced_runner); - router_->SetMasterInterfaceName(interface_name); + router_->SetPrimaryInterfaceName(interface_name); router_->SetConnectionGroup(std::move(receiver_state->connection_group)); endpoint_client_.reset(new InterfaceEndpointClient( - router_->CreateLocalEndpointHandle(kMasterInterfaceId), stub, + router_->CreateLocalEndpointHandle(kPrimaryInterfaceId), stub, std::move(request_validator), has_sync_methods, std::move(sequenced_runner), interface_version, interface_name)); endpoint_client_->SetIdleTrackingEnabledCallback( diff --git a/chromium/mojo/public/cpp/bindings/lib/binding_state.h b/chromium/mojo/public/cpp/bindings/lib/binding_state.h index cadb81a7fa6..598668482ff 100644 --- a/chromium/mojo/public/cpp/bindings/lib/binding_state.h +++ b/chromium/mojo/public/cpp/bindings/lib/binding_state.h @@ -11,8 +11,8 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/check.h" #include "base/component_export.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" @@ -48,8 +48,7 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) BindingStateBase { void PauseIncomingMethodCallProcessing(); void ResumeIncomingMethodCallProcessing(); - bool WaitForIncomingMethodCall( - MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE); + bool WaitForIncomingMethodCall(); void PauseRemoteCallbacksUntilFlushCompletes(PendingFlush flush); void FlushAsync(AsyncFlusher flusher); diff --git a/chromium/mojo/public/cpp/bindings/lib/connector.cc b/chromium/mojo/public/cpp/bindings/lib/connector.cc index 5c92e2d65ba..c342d655d29 100644 --- a/chromium/mojo/public/cpp/bindings/lib/connector.cc +++ b/chromium/mojo/public/cpp/bindings/lib/connector.cc @@ -229,7 +229,7 @@ void Connector::SetConnectionGroup(ConnectionGroup::Ref ref) { connection_group_ = std::move(ref); } -bool Connector::WaitForIncomingMessage(MojoDeadline deadline) { +bool Connector::WaitForIncomingMessage() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (error_) @@ -237,23 +237,13 @@ bool Connector::WaitForIncomingMessage(MojoDeadline deadline) { ResumeIncomingMethodCallProcessing(); - // TODO(rockot): Use a timed Wait here. Nobody uses anything but 0 or - // INDEFINITE deadlines at present, so we only support those. - DCHECK(deadline == 0 || deadline == MOJO_DEADLINE_INDEFINITE); - - MojoResult rv = MOJO_RESULT_UNKNOWN; - if (deadline == 0 && !message_pipe_->QuerySignalsState().readable()) + MojoResult rv = Wait(message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE); + if (rv != MOJO_RESULT_OK) { + // Users that call WaitForIncomingMessage() should expect their code to be + // re-entered, so we call the error handler synchronously. + HandleError(rv != MOJO_RESULT_FAILED_PRECONDITION /* force_pipe_reset */, + false /* force_async_handler */); return false; - - if (deadline == MOJO_DEADLINE_INDEFINITE) { - rv = Wait(message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE); - if (rv != MOJO_RESULT_OK) { - // Users that call WaitForIncomingMessage() should expect their code to be - // re-entered, so we call the error handler synchronously. - HandleError(rv != MOJO_RESULT_FAILED_PRECONDITION /* force_pipe_reset */, - false /* force_async_handler */); - return false; - } } Message message; @@ -505,9 +495,9 @@ bool Connector::DispatchMessage(Message message) { incoming_serialization_mode_); } - TRACE_EVENT_WITH_FLOW0( - TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), "mojo::Message Receive", - MANGLE_MESSAGE_ID(message.header()->trace_id), TRACE_EVENT_FLAG_FLOW_IN); + TRACE_EVENT_WITH_FLOW0("toplevel.flow", "mojo::Message Receive", + MANGLE_MESSAGE_ID(message.header()->trace_id), + TRACE_EVENT_FLAG_FLOW_IN); #if !BUILDFLAG(MOJO_TRACE_ENABLED) // This emits just full class name, and is inferior to mojo tracing. TRACE_EVENT0("mojom", heap_profiler_tag_); diff --git a/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.cc b/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.cc index 348c63d7c16..bd363911483 100644 --- a/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.cc +++ b/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.cc @@ -92,7 +92,7 @@ bool InterfacePtrStateBase::InitializeEndpointClient( DCHECK(runner_->RunsTasksInCurrentSequence()); router_ = new MultiplexRouter(std::move(handle_), config, true, runner_); endpoint_client_.reset(new InterfaceEndpointClient( - router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, + router_->CreateLocalEndpointHandle(kPrimaryInterfaceId), nullptr, std::move(payload_validator), false, std::move(runner_), // The version is only queried from the client so the value passed here // will not be used. diff --git a/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.h b/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.h index 0d259f37a2f..d1e37115f90 100644 --- a/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.h +++ b/chromium/mojo/public/cpp/bindings/lib/interface_ptr_state.h @@ -14,9 +14,9 @@ #include "base/bind.h" #include "base/callback_forward.h" +#include "base/check_op.h" #include "base/component_export.h" #include "base/location.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" @@ -260,7 +260,7 @@ class InterfacePtrState : public InterfacePtrStateBase { Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_, std::make_unique<typename Interface::ResponseValidator_>(), Interface::Name_)) { - router()->SetMasterInterfaceName(Interface::Name_); + router()->SetPrimaryInterfaceName(Interface::Name_); proxy_ = std::make_unique<Proxy>(endpoint_client()); } } diff --git a/chromium/mojo/public/cpp/bindings/lib/message.cc b/chromium/mojo/public/cpp/bindings/lib/message.cc index 7b8e92ecbf7..893ec949fbc 100644 --- a/chromium/mojo/public/cpp/bindings/lib/message.cc +++ b/chromium/mojo/public/cpp/bindings/lib/message.cc @@ -102,8 +102,8 @@ void CreateSerializedMessageObject(uint32_t name, std::vector<ScopedHandle>* handles, ScopedMessageHandle* out_handle, internal::Buffer* out_buffer) { - TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "mojo::Message Send", MANGLE_MESSAGE_ID(trace_id), + TRACE_EVENT_WITH_FLOW0("toplevel.flow", "mojo::Message Send", + MANGLE_MESSAGE_ID(trace_id), TRACE_EVENT_FLAG_FLOW_OUT); ScopedMessageHandle handle; @@ -148,8 +148,8 @@ void SerializeUnserializedContext(MojoMessageHandle message, reinterpret_cast<internal::UnserializedMessageContext*>(context_value); uint32_t trace_id = GetTraceId(context); - TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), - "mojo::Message Send", MANGLE_MESSAGE_ID(trace_id), + TRACE_EVENT_WITH_FLOW0("toplevel.flow", "mojo::Message Send", + MANGLE_MESSAGE_ID(trace_id), TRACE_EVENT_FLAG_FLOW_OUT); void* buffer; diff --git a/chromium/mojo/public/cpp/bindings/lib/message_header_validator.cc b/chromium/mojo/public/cpp/bindings/lib/message_header_validator.cc index 25a651e4b45..e4f8a4905cd 100644 --- a/chromium/mojo/public/cpp/bindings/lib/message_header_validator.cc +++ b/chromium/mojo/public/cpp/bindings/lib/message_header_validator.cc @@ -90,7 +90,7 @@ bool IsValidMessageHeader(const internal::MessageHeader* header, size_t num_ids = header_v2->payload_interface_ids.Get()->size(); const uint32_t* ids = header_v2->payload_interface_ids.Get()->storage(); for (size_t i = 0; i < num_ids; ++i) { - if (!IsValidInterfaceId(ids[i]) || IsMasterInterfaceId(ids[i])) { + if (!IsValidInterfaceId(ids[i]) || IsPrimaryInterfaceId(ids[i])) { internal::ReportValidationError( validation_context, internal::VALIDATION_ERROR_ILLEGAL_INTERFACE_ID); diff --git a/chromium/mojo/public/cpp/bindings/lib/message_quota_checker.h b/chromium/mojo/public/cpp/bindings/lib/message_quota_checker.h index 071853640a6..37955350905 100644 --- a/chromium/mojo/public/cpp/bindings/lib/message_quota_checker.h +++ b/chromium/mojo/public/cpp/bindings/lib/message_quota_checker.h @@ -31,10 +31,10 @@ namespace internal { // outgoing queue. Additionally, |BeforeWrite()| should be called immediately // before writing each message to the corresponding message pipe. // -// Also note that messages posted to a different sequence with -// |base::PostTask()| and the like, need to be treated as locally queued. Task -// queues can grow arbitrarily long, and it's ideal to perform unread quota -// checks before posting. +// Also note that messages posted to a different sequence with base::ThreadPool +// and the like, need to be treated as locally queued. Task queues can grow +// arbitrarily long, and it's ideal to perform unread quota checks before +// posting. // // Either |BeforeMessagesEnqueued()| or |BeforeWrite()| may cause the quota // to be exceeded, thus invoking the |maybe_crash_function| set in this diff --git a/chromium/mojo/public/cpp/bindings/lib/multiplex_router.cc b/chromium/mojo/public/cpp/bindings/lib/multiplex_router.cc index 4a825fd6a71..08da6c26ded 100644 --- a/chromium/mojo/public/cpp/bindings/lib/multiplex_router.cc +++ b/chromium/mojo/public/cpp/bindings/lib/multiplex_router.cc @@ -369,12 +369,12 @@ void MultiplexRouter::SetIncomingMessageFilter( dispatcher_.SetFilter(std::move(filter)); } -void MultiplexRouter::SetMasterInterfaceName(const char* name) { +void MultiplexRouter::SetPrimaryInterfaceName(const char* name) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); header_validator_->SetDescription(std::string(name) + - " [master] MessageHeaderValidator"); + " [primary] MessageHeaderValidator"); control_message_handler_.SetDescription( - std::string(name) + " [master] PipeControlMessageHandler"); + std::string(name) + " [primary] PipeControlMessageHandler"); connector_.SetWatcherHeapProfilerTag(name); } @@ -454,7 +454,7 @@ void MultiplexRouter::CloseEndpointHandle( DCHECK(!endpoint->closed()); UpdateEndpointStateMayRemove(endpoint, ENDPOINT_CLOSED); - if (!IsMasterInterfaceId(id) || reason) { + if (!IsPrimaryInterfaceId(id) || reason) { MayAutoUnlock unlocker(&lock_); control_message_proxy_.NotifyPeerEndpointClosed(id, reason); } @@ -575,7 +575,7 @@ bool MultiplexRouter::HasAssociatedEndpoints() const { if (endpoints_.size() == 0) return false; - return !base::Contains(endpoints_, kMasterInterfaceId); + return !base::Contains(endpoints_, kPrimaryInterfaceId); } void MultiplexRouter::EnableBatchDispatch() { @@ -674,7 +674,7 @@ bool MultiplexRouter::OnPeerAssociatedEndpointClosed( bool MultiplexRouter::WaitForFlushToComplete(ScopedMessagePipeHandle pipe) { // If this MultiplexRouter has an associated interface on some task runner - // other than the master interface's task runner, it is possible to process + // other than the primary interface's task runner, it is possible to process // incoming control messages on that task runner. We don't support this // control message on anything but the main interface though. if (!task_runner_->RunsTasksInCurrentSequence()) @@ -1048,7 +1048,7 @@ bool MultiplexRouter::InsertEndpointsForMessage(const Message& message) { MayAutoLock locker(&lock_); for (uint32_t i = 0; i < num_ids; ++i) { // Message header validation already ensures that the IDs are valid and not - // the master ID. + // the primary ID. // The IDs are from the remote side and therefore their namespace bit is // supposed to be different than the value that this router would use. if (set_interface_id_namespace_bit_ == diff --git a/chromium/mojo/public/cpp/bindings/lib/multiplex_router.h b/chromium/mojo/public/cpp/bindings/lib/multiplex_router.h index 3063ec49703..16128e880b0 100644 --- a/chromium/mojo/public/cpp/bindings/lib/multiplex_router.h +++ b/chromium/mojo/public/cpp/bindings/lib/multiplex_router.h @@ -11,11 +11,11 @@ #include <memory> #include <string> +#include "base/check_op.h" #include "base/compiler_specific.h" #include "base/component_export.h" #include "base/containers/queue.h" #include "base/containers/small_map.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -47,7 +47,7 @@ namespace internal { // MultiplexRouter supports routing messages for multiple interfaces over a // single message pipe. // -// It is created on the sequence where the master interface of the message pipe +// It is created on the sequence where the primary interface of the message pipe // lives. // Some public methods are only allowed to be called on the creating sequence; // while the others are safe to call from any sequence. Please see the method @@ -61,14 +61,14 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) MultiplexRouter public PipeControlMessageHandlerDelegate { public: enum Config { - // There is only the master interface running on this router. Please note + // There is only the primary interface running on this router. Please note // that because of interface versioning, the other side of the message pipe - // may use a newer master interface definition which passes associated + // may use a newer primary interface definition which passes associated // interfaces. In that case, this router may still receive pipe control // messages or messages targetting associated interfaces. SINGLE_INTERFACE, - // Similar to the mode above, there is only the master interface running on - // this router. Besides, the master interface has sync methods. + // Similar to the mode above, there is only the primary interface running on + // this router. Besides, the primary interface has sync methods. SINGLE_INTERFACE_WITH_SYNC_METHODS, // There may be associated interfaces running on this router. MULTI_INTERFACE @@ -85,10 +85,10 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) MultiplexRouter // before dispatch. void SetIncomingMessageFilter(std::unique_ptr<MessageFilter> filter); - // Sets the master interface name for this router. Only used when reporting + // Sets the primary interface name for this router. Only used when reporting // message header or control message validation errors. // |name| must be a string literal. - void SetMasterInterfaceName(const char* name); + void SetPrimaryInterfaceName(const char* name); // Adds this object to a ConnectionGroup identified by |ref|. All receiving // pipe endpoints decoded from inbound messages on this MultiplexRouter will @@ -130,11 +130,10 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) MultiplexRouter return connector_.PassMessagePipe(); } - // Blocks the current sequence until the first incoming message, or - // |deadline|. - bool WaitForIncomingMessage(MojoDeadline deadline) { + // Blocks the current sequence until the first incoming message. + bool WaitForIncomingMessage() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return connector_.WaitForIncomingMessage(deadline); + return connector_.WaitForIncomingMessage(); } // See Binding for details of pause/resume. diff --git a/chromium/mojo/public/cpp/bindings/lib/native_enum_serialization.h b/chromium/mojo/public/cpp/bindings/lib/native_enum_serialization.h index 4faf957c58e..6cd8c7f90fb 100644 --- a/chromium/mojo/public/cpp/bindings/lib/native_enum_serialization.h +++ b/chromium/mojo/public/cpp/bindings/lib/native_enum_serialization.h @@ -10,7 +10,7 @@ #include <type_traits> -#include "base/logging.h" +#include "base/check_op.h" #include "base/pickle.h" #include "ipc/ipc_param_traits.h" #include "mojo/public/cpp/bindings/lib/serialization_forward.h" diff --git a/chromium/mojo/public/cpp/bindings/lib/native_struct_serialization.h b/chromium/mojo/public/cpp/bindings/lib/native_struct_serialization.h index 5e2be21c981..41abb228c4f 100644 --- a/chromium/mojo/public/cpp/bindings/lib/native_struct_serialization.h +++ b/chromium/mojo/public/cpp/bindings/lib/native_struct_serialization.h @@ -10,8 +10,8 @@ #include <limits> +#include "base/check_op.h" #include "base/component_export.h" -#include "base/logging.h" #include "base/pickle.h" #include "ipc/ipc_message.h" #include "ipc/ipc_param_traits.h" diff --git a/chromium/mojo/public/cpp/bindings/lib/sequence_local_sync_event_watcher.cc b/chromium/mojo/public/cpp/bindings/lib/sequence_local_sync_event_watcher.cc index c443c65cf55..1d9178799df 100644 --- a/chromium/mojo/public/cpp/bindings/lib/sequence_local_sync_event_watcher.cc +++ b/chromium/mojo/public/cpp/bindings/lib/sequence_local_sync_event_watcher.cc @@ -99,6 +99,8 @@ class SequenceLocalSyncEventWatcher::SequenceLocalState { { base::AutoLock lock(ready_watchers_lock_); ready_watchers_.erase(iter->first); + if (ready_watchers_.empty()) + event_.Reset(); } registered_watchers_.erase(iter); @@ -206,8 +208,10 @@ void SequenceLocalSyncEventWatcher::SequenceLocalState::OnEventSignaled() { base::AutoLock lock(ready_watchers_lock_); std::swap(ready_watchers_, ready_watchers); } - if (ready_watchers.empty()) + if (ready_watchers.empty()) { + event_.Reset(); return; + } auto weak_self = weak_ptr_factory_.GetWeakPtr(); for (auto* watcher : ready_watchers) { |