diff options
Diffstat (limited to 'chromium/mojo/public/cpp/bindings')
38 files changed, 103 insertions, 126 deletions
diff --git a/chromium/mojo/public/cpp/bindings/README.md b/chromium/mojo/public/cpp/bindings/README.md index 2c64ec743d8..db9b37d2a64 100644 --- a/chromium/mojo/public/cpp/bindings/README.md +++ b/chromium/mojo/public/cpp/bindings/README.md @@ -1139,23 +1139,23 @@ foo->SetBar(std::move(bar)); ### Performance considerations -When using associated interfaces on different sequences than the master sequence -(where the master interface lives): +When using associated interfaces on different sequences than the primary +sequence (where the primary interface lives): * Sending messages: send happens directly on the calling sequence. So there isn't sequence hopping. * Receiving messages: associated interfaces bound on a different sequence from - the master interface incur an extra sequence hop during dispatch. + the primary interface incur an extra sequence hop during dispatch. Therefore, performance-wise associated interfaces are better suited for -scenarios where message receiving happens on the master sequence. +scenarios where message receiving happens on the primary sequence. ### Testing -Associated interfaces need to be associated with a master interface before +Associated interfaces need to be associated with a primary interface before they can be used. This means one end of the associated interface must be sent -over one end of the master interface, or over one end of another associated -interface which itself already has a master interface. +over one end of the primary interface, or over one end of another associated +interface which itself already has a primary interface. If you want to test an associated interface endpoint without first associating it, you can use `AssociatedRemote::BindNewEndpointAndPassDedicatedReceiverForTesting`. diff --git a/chromium/mojo/public/cpp/bindings/associated_binding.h b/chromium/mojo/public/cpp/bindings/associated_binding.h index 2c7f8a3f9f7..a0b6eeadc21 100644 --- a/chromium/mojo/public/cpp/bindings/associated_binding.h +++ b/chromium/mojo/public/cpp/bindings/associated_binding.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" diff --git a/chromium/mojo/public/cpp/bindings/associated_group_controller.h b/chromium/mojo/public/cpp/bindings/associated_group_controller.h index 386ebdf8609..6de041783f5 100644 --- a/chromium/mojo/public/cpp/bindings/associated_group_controller.h +++ b/chromium/mojo/public/cpp/bindings/associated_group_controller.h @@ -38,7 +38,7 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS_BASE) AssociatedGroupController // Creates an interface endpoint handle from a given interface ID. The handle // joins this associated group. // Typically, this method is used to (1) create an endpoint handle for the - // master interface; or (2) create an endpoint handle on receiving an + // primary interface; or (2) create an endpoint handle on receiving an // interface ID from the message pipe. // // On failure, the method returns an invalid handle. Usually that is because diff --git a/chromium/mojo/public/cpp/bindings/associated_interface_ptr.h b/chromium/mojo/public/cpp/bindings/associated_interface_ptr.h index f027f9ea2b1..956138c4277 100644 --- a/chromium/mojo/public/cpp/bindings/associated_interface_ptr.h +++ b/chromium/mojo/public/cpp/bindings/associated_interface_ptr.h @@ -12,8 +12,8 @@ #include <utility> #include "base/callback.h" +#include "base/check.h" #include "base/component_export.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" diff --git a/chromium/mojo/public/cpp/bindings/associated_receiver.h b/chromium/mojo/public/cpp/bindings/associated_receiver.h index 2087f4e4cde..f2857dcaa44 100644 --- a/chromium/mojo/public/cpp/bindings/associated_receiver.h +++ b/chromium/mojo/public/cpp/bindings/associated_receiver.h @@ -8,8 +8,8 @@ #include <memory> #include <utility> +#include "base/check.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/scoped_refptr.h" #include "base/sequenced_task_runner.h" diff --git a/chromium/mojo/public/cpp/bindings/associated_remote.h b/chromium/mojo/public/cpp/bindings/associated_remote.h index 9aa834c11fd..32b010c61c9 100644 --- a/chromium/mojo/public/cpp/bindings/associated_remote.h +++ b/chromium/mojo/public/cpp/bindings/associated_remote.h @@ -9,8 +9,8 @@ #include <utility> #include "base/callback_forward.h" +#include "base/check.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/scoped_refptr.h" #include "base/sequenced_task_runner.h" diff --git a/chromium/mojo/public/cpp/bindings/binding.h b/chromium/mojo/public/cpp/bindings/binding.h index bd650c79a40..4993de731f6 100644 --- a/chromium/mojo/public/cpp/bindings/binding.h +++ b/chromium/mojo/public/cpp/bindings/binding.h @@ -138,11 +138,10 @@ class Binding { // true if a method was successfully read and dispatched. // // This method may only be called if the object has been bound to a message - // pipe. This returns once a message is received either on the master + // pipe. This returns once a message is received either on the primary // interface or any associated interfaces. - bool WaitForIncomingMethodCall( - MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE) { - return internal_state_.WaitForIncomingMethodCall(deadline); + bool WaitForIncomingMethodCall() { + return internal_state_.WaitForIncomingMethodCall(); } // Closes the message pipe that was previously bound. Put this object into a diff --git a/chromium/mojo/public/cpp/bindings/connector.h b/chromium/mojo/public/cpp/bindings/connector.h index 91dd4655b6a..16e478c9ebd 100644 --- a/chromium/mojo/public/cpp/bindings/connector.h +++ b/chromium/mojo/public/cpp/bindings/connector.h @@ -161,10 +161,10 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) Connector : public MessageReceiver { // be added to the same group. void SetConnectionGroup(ConnectionGroup::Ref ref); - // Waits for the next message on the pipe, blocking until one arrives, - // |deadline| elapses, or an error happens. Returns |true| if a message has - // been delivered, |false| otherwise. - bool WaitForIncomingMessage(MojoDeadline deadline); + // Waits for the next message on the pipe, blocking until one arrives or an + // error happens. Returns |true| if a message has been delivered, |false| + // otherwise. + bool WaitForIncomingMessage(); // See Binding for details of pause/resume. void PauseIncomingMethodCallProcessing(); diff --git a/chromium/mojo/public/cpp/bindings/interface_endpoint_client.h b/chromium/mojo/public/cpp/bindings/interface_endpoint_client.h index d2e1d0574f5..c8065924b2e 100644 --- a/chromium/mojo/public/cpp/bindings/interface_endpoint_client.h +++ b/chromium/mojo/public/cpp/bindings/interface_endpoint_client.h @@ -12,10 +12,10 @@ #include <utility> #include "base/callback.h" +#include "base/check_op.h" #include "base/compiler_specific.h" #include "base/component_export.h" #include "base/location.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" diff --git a/chromium/mojo/public/cpp/bindings/interface_id.h b/chromium/mojo/public/cpp/bindings/interface_id.h index d6128537d20..8760fea068f 100644 --- a/chromium/mojo/public/cpp/bindings/interface_id.h +++ b/chromium/mojo/public/cpp/bindings/interface_id.h @@ -14,16 +14,16 @@ using InterfaceId = uint32_t; // IDs of associated interface can be generated at both sides of the message // pipe. In order to avoid collision, the highest bit is used as namespace bit: -// at the side where the client-side of the master interface lives, IDs are +// at the side where the client-side of the primary interface lives, IDs are // generated with the namespace bit set to 1; at the opposite side IDs are // generated with the namespace bit set to 0. const uint32_t kInterfaceIdNamespaceMask = 0x80000000; -const InterfaceId kMasterInterfaceId = 0x00000000; +const InterfaceId kPrimaryInterfaceId = 0x00000000; const InterfaceId kInvalidInterfaceId = 0xFFFFFFFF; -inline bool IsMasterInterfaceId(InterfaceId id) { - return id == kMasterInterfaceId; +inline bool IsPrimaryInterfaceId(InterfaceId id) { + return id == kPrimaryInterfaceId; } inline bool IsValidInterfaceId(InterfaceId id) { diff --git a/chromium/mojo/public/cpp/bindings/interface_ptr.h b/chromium/mojo/public/cpp/bindings/interface_ptr.h index 4f10be5acc5..6745a32b530 100644 --- a/chromium/mojo/public/cpp/bindings/interface_ptr.h +++ b/chromium/mojo/public/cpp/bindings/interface_ptr.h @@ -12,7 +12,7 @@ #include <utility> #include "base/callback_forward.h" -#include "base/logging.h" +#include "base/check.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" diff --git a/chromium/mojo/public/cpp/bindings/interface_request.h b/chromium/mojo/public/cpp/bindings/interface_request.h index 0b9fd64b193..3e44bfba2a7 100644 --- a/chromium/mojo/public/cpp/bindings/interface_request.h +++ b/chromium/mojo/public/cpp/bindings/interface_request.h @@ -80,7 +80,7 @@ class InterfaceRequest { Message message = PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( - kMasterInterfaceId, DisconnectReason(custom_reason, description)); + kPrimaryInterfaceId, DisconnectReason(custom_reason, description)); MojoResult result = WriteMessageNew(state_.pipe.get(), message.TakeMojoMessage(), MOJO_WRITE_MESSAGE_FLAG_NONE); 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) { diff --git a/chromium/mojo/public/cpp/bindings/map_data_view.h b/chromium/mojo/public/cpp/bindings/map_data_view.h index a65bb9eca14..5743829eeec 100644 --- a/chromium/mojo/public/cpp/bindings/map_data_view.h +++ b/chromium/mojo/public/cpp/bindings/map_data_view.h @@ -5,7 +5,7 @@ #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_DATA_VIEW_H_ #define MOJO_PUBLIC_CPP_BINDINGS_MAP_DATA_VIEW_H_ -#include "base/logging.h" +#include "base/check_op.h" #include "mojo/public/cpp/bindings/array_data_view.h" #include "mojo/public/cpp/bindings/lib/bindings_internal.h" #include "mojo/public/cpp/bindings/lib/map_data_internal.h" diff --git a/chromium/mojo/public/cpp/bindings/message.h b/chromium/mojo/public/cpp/bindings/message.h index 8dbb3df8875..8099cd4305b 100644 --- a/chromium/mojo/public/cpp/bindings/message.h +++ b/chromium/mojo/public/cpp/bindings/message.h @@ -14,10 +14,10 @@ #include <vector> #include "base/callback.h" +#include "base/check_op.h" #include "base/compiler_specific.h" #include "base/component_export.h" #include "base/containers/span.h" -#include "base/logging.h" #include "base/memory/ptr_util.h" #include "mojo/public/cpp/bindings/connection_group.h" #include "mojo/public/cpp/bindings/lib/buffer.h" diff --git a/chromium/mojo/public/cpp/bindings/pending_remote.h b/chromium/mojo/public/cpp/bindings/pending_remote.h index e67dd1a6691..64c9ab90653 100644 --- a/chromium/mojo/public/cpp/bindings/pending_remote.h +++ b/chromium/mojo/public/cpp/bindings/pending_remote.h @@ -9,8 +9,8 @@ #include <type_traits> #include <utility> +#include "base/check.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "base/macros.h" #include "build/build_config.h" #include "mojo/public/cpp/bindings/interface_ptr_info.h" diff --git a/chromium/mojo/public/cpp/bindings/receiver.h b/chromium/mojo/public/cpp/bindings/receiver.h index 045bd3e5dbc..6f8b9976581 100644 --- a/chromium/mojo/public/cpp/bindings/receiver.h +++ b/chromium/mojo/public/cpp/bindings/receiver.h @@ -8,8 +8,8 @@ #include <memory> #include <utility> +#include "base/check.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/scoped_refptr.h" #include "base/sequenced_task_runner.h" @@ -204,7 +204,7 @@ class Receiver { // Blocks the calling thread until a new message arrives and is dispatched // to the bound implementation. bool WaitForIncomingCall() { - return internal_state_.WaitForIncomingMethodCall(MOJO_DEADLINE_INDEFINITE); + return internal_state_.WaitForIncomingMethodCall(); } // Pauses the Remote endpoint, stopping dispatch of callbacks on that end. Any diff --git a/chromium/mojo/public/cpp/bindings/remote.h b/chromium/mojo/public/cpp/bindings/remote.h index 45615bfb930..d71d2037141 100644 --- a/chromium/mojo/public/cpp/bindings/remote.h +++ b/chromium/mojo/public/cpp/bindings/remote.h @@ -9,8 +9,8 @@ #include <utility> #include "base/callback_forward.h" +#include "base/check.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/scoped_refptr.h" #include "base/sequenced_task_runner.h" diff --git a/chromium/mojo/public/cpp/bindings/strong_associated_binding.h b/chromium/mojo/public/cpp/bindings/strong_associated_binding.h index 0bb340c7d11..7425e87f2e4 100644 --- a/chromium/mojo/public/cpp/bindings/strong_associated_binding.h +++ b/chromium/mojo/public/cpp/bindings/strong_associated_binding.h @@ -11,7 +11,7 @@ #include "base/bind.h" #include "base/callback.h" -#include "base/logging.h" +#include "base/check.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/associated_binding.h" diff --git a/chromium/mojo/public/cpp/bindings/strong_associated_binding_set.h b/chromium/mojo/public/cpp/bindings/strong_associated_binding_set.h deleted file mode 100644 index 8c769698ba3..00000000000 --- a/chromium/mojo/public/cpp/bindings/strong_associated_binding_set.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_SET_H_ -#define MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_SET_H_ - -#include "mojo/public/cpp/bindings/associated_binding.h" -#include "mojo/public/cpp/bindings/associated_binding_set.h" -#include "mojo/public/cpp/bindings/associated_interface_ptr.h" -#include "mojo/public/cpp/bindings/associated_interface_request.h" -#include "mojo/public/cpp/bindings/binding_set.h" -#include "mojo/public/cpp/bindings/unique_ptr_impl_ref_traits.h" - -namespace mojo { - -template <typename Interface, typename ContextType = void> -using StrongAssociatedBindingSet = BindingSetBase< - Interface, - AssociatedBinding<Interface, UniquePtrImplRefTraits<Interface>>, - ContextType>; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_ASSOCIATED_BINDING_SET_H_ diff --git a/chromium/mojo/public/cpp/bindings/strong_binding.h b/chromium/mojo/public/cpp/bindings/strong_binding.h index b1160453a96..e3940fba4b5 100644 --- a/chromium/mojo/public/cpp/bindings/strong_binding.h +++ b/chromium/mojo/public/cpp/bindings/strong_binding.h @@ -11,7 +11,7 @@ #include "base/bind.h" #include "base/callback.h" -#include "base/logging.h" +#include "base/check.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/binding.h" diff --git a/chromium/mojo/public/cpp/bindings/struct_ptr.h b/chromium/mojo/public/cpp/bindings/struct_ptr.h index 93431740434..ea2f52ea878 100644 --- a/chromium/mojo/public/cpp/bindings/struct_ptr.h +++ b/chromium/mojo/public/cpp/bindings/struct_ptr.h @@ -10,7 +10,7 @@ #include <memory> #include <new> -#include "base/logging.h" +#include "base/check.h" #include "base/macros.h" #include "base/optional.h" #include "mojo/public/cpp/bindings/lib/hash_util.h" diff --git a/chromium/mojo/public/cpp/bindings/sync_call_restrictions.h b/chromium/mojo/public/cpp/bindings/sync_call_restrictions.h index 60e11492057..599d24e260a 100644 --- a/chromium/mojo/public/cpp/bindings/sync_call_restrictions.h +++ b/chromium/mojo/public/cpp/bindings/sync_call_restrictions.h @@ -15,6 +15,10 @@ #define ENABLE_SYNC_CALL_RESTRICTIONS 0 #endif +namespace chromecast { +class CastCdmOriginProvider; +} // namespace chromecast + namespace sync_preferences { class PrefServiceSyncable; } @@ -82,6 +86,11 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) SyncCallRestrictions { // For preventing frame swaps of wrong size during resize on Windows. // (https://crbug.com/811945) friend class ui::Compositor; + // For calling sync mojo API to get cdm origin. The service and the client are + // running in the same process, so it won't block anything. + // TODO(159346933) Remove once the origin isolation logic is moved outside of + // cast media service. + friend class chromecast::CastCdmOriginProvider; // END ALLOWED USAGE. #if ENABLE_SYNC_CALL_RESTRICTIONS diff --git a/chromium/mojo/public/cpp/bindings/sync_handle_watcher.h b/chromium/mojo/public/cpp/bindings/sync_handle_watcher.h index f75e1e232af..5ed7e7b827e 100644 --- a/chromium/mojo/public/cpp/bindings/sync_handle_watcher.h +++ b/chromium/mojo/public/cpp/bindings/sync_handle_watcher.h @@ -22,7 +22,7 @@ namespace mojo { // SyncHandleWatcher is used for sync methods. While a sync call is waiting for // response, we would like to block the sequence. On the other hand, we need // incoming sync method requests on the same sequence to be able to reenter. We -// also need master interface endpoints to continue dispatching messages for +// also need primary interface endpoints to continue dispatching messages for // associated endpoints on different sequence. // // This class is not thread safe. diff --git a/chromium/mojo/public/cpp/bindings/tests/BUILD.gn b/chromium/mojo/public/cpp/bindings/tests/BUILD.gn index 6fb6542728a..16674cc3366 100644 --- a/chromium/mojo/public/cpp/bindings/tests/BUILD.gn +++ b/chromium/mojo/public/cpp/bindings/tests/BUILD.gn @@ -67,7 +67,6 @@ source_set("tests") { ":test_extra_cpp_template_mojom", ":test_mojom", "//base/test:test_support", - "//mojo/core/embedder", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", @@ -197,7 +196,10 @@ source_set("mojo_public_bindings_test_utils") { "validation_test_input_parser.h", ] - deps = [ "//mojo/public/c/system" ] + deps = [ + "//base", + "//mojo/public/c/system", + ] } action("generate_test_mojom") { |