Lines Matching full:endpoint
283 Endpoint* sender_endpoint = new Endpoint(this, sender_id); in Bind()
284 Endpoint* receiver_endpoint = new Endpoint(this, receiver_id); in Bind()
342 Endpoint* endpoint = new Endpoint(this, id); in AssociateInterface() local
344 endpoint->set_peer_closed(); in AssociateInterface()
345 endpoint->set_handle_created(); in AssociateInterface()
346 endpoints_.insert({id, endpoint}); in AssociateInterface()
354 Endpoint* endpoint = FindEndpoint(id); in AssociateInterface() local
355 if (endpoint) in AssociateInterface()
356 MarkClosedAndMaybeRemove(endpoint); in AssociateInterface()
381 Endpoint* endpoint = FindOrInsertEndpoint(id, &inserted); in CreateLocalEndpointHandle() local
383 DCHECK(!endpoint->handle_created()); in CreateLocalEndpointHandle()
385 endpoint->set_peer_closed(); in CreateLocalEndpointHandle()
387 if (endpoint->handle_created()) in CreateLocalEndpointHandle()
391 endpoint->set_handle_created(); in CreateLocalEndpointHandle()
403 Endpoint* endpoint = endpoints_[id].get(); in CloseEndpointHandle() local
404 DCHECK(!endpoint->client()); in CloseEndpointHandle()
405 DCHECK(!endpoint->closed()); in CloseEndpointHandle()
406 MarkClosedAndMaybeRemove(endpoint); in CloseEndpointHandle()
436 Endpoint* endpoint = endpoints_[id].get(); in AttachEndpointClient() local
437 endpoint->AttachClient(client, std::move(runner)); in AttachEndpointClient()
439 if (endpoint->peer_closed()) in AttachEndpointClient()
440 NotifyEndpointOfError(endpoint, true /* force_async */); in AttachEndpointClient()
442 return endpoint; in AttachEndpointClient()
454 Endpoint* endpoint = endpoints_[id].get(); in DetachEndpointClient() local
455 endpoint->DetachClient(); in DetachEndpointClient()
462 // * We should never close a channel endpoint in either process as long as in RaiseError()
463 // the child process is still alive. The child's endpoint should only be in RaiseError()
464 // closed implicitly by process death, and the browser's endpoint should in RaiseError()
471 // local endpoint drops a response callback without calling it. in RaiseError()
494 class Endpoint;
496 friend class Endpoint;
546 class Endpoint : public base::RefCountedThreadSafe<Endpoint>, class in IPC::ChannelAssociatedGroupController
549 Endpoint(ChannelAssociatedGroupController* controller, mojo::InterfaceId id) in Endpoint() function in IPC::ChannelAssociatedGroupController::Endpoint
552 Endpoint(const Endpoint&) = delete;
553 Endpoint& operator=(const Endpoint&) = delete;
677 // It's not legal to make sync calls from the primary endpoint's thread, in SyncWatch()
729 friend class base::RefCountedThreadSafe<Endpoint>;
731 ~Endpoint() override { in ~Endpoint()
746 // `controller_keepalive` MUST outlive `keepalive` because the Endpoint in OnSyncMessageEventReady()
750 scoped_refptr<Endpoint> keepalive(this); in OnSyncMessageEventReady()
778 // SyncWatch() calls are on the stack for this endpoint, resetting the in OnSyncMessageEventReady()
791 base::BindRepeating(&Endpoint::OnSyncMessageEventReady, in EnsureSyncWatcherExists()
866 Endpoint* endpoint = iter->second.get(); in ~ChannelAssociatedGroupController() local
869 if (!endpoint->closed()) { in ~ChannelAssociatedGroupController()
871 // but the interface ID hasn't been used to create local endpoint in ~ChannelAssociatedGroupController()
873 DCHECK(!endpoint->client()); in ~ChannelAssociatedGroupController()
874 DCHECK(endpoint->peer_closed()); in ~ChannelAssociatedGroupController()
875 MarkClosed(endpoint); in ~ChannelAssociatedGroupController()
877 MarkPeerClosed(endpoint); in ~ChannelAssociatedGroupController()
945 std::vector<scoped_refptr<Endpoint>> endpoints_to_notify; in OnPipeError()
947 Endpoint* endpoint = iter->second.get(); in OnPipeError() local
950 if (endpoint->client()) { in OnPipeError()
951 endpoints_to_notify.push_back(endpoint); in OnPipeError()
954 if (MarkPeerClosed(endpoint)) { in OnPipeError()
955 endpoints_to_remove.push_back(endpoint->id()); in OnPipeError()
959 for (auto& endpoint : endpoints_to_notify) { in OnPipeError() local
960 // Because a notification may in turn detach any endpoint, we have to in OnPipeError()
962 if (endpoint->client()) in OnPipeError()
963 NotifyEndpointOfError(endpoint.get(), false /* force_async */); in OnPipeError()
971 void NotifyEndpointOfError(Endpoint* endpoint, bool force_async) in NotifyEndpointOfError() argument
973 DCHECK(endpoint->task_runner() && endpoint->client()); in NotifyEndpointOfError()
974 if (endpoint->task_runner()->RunsTasksInCurrentSequence() && !force_async) { in NotifyEndpointOfError()
975 mojo::InterfaceEndpointClient* client = endpoint->client(); in NotifyEndpointOfError()
977 endpoint->disconnect_reason()); in NotifyEndpointOfError()
982 endpoint->task_runner()->PostTask( in NotifyEndpointOfError()
986 this, endpoint->id(), in NotifyEndpointOfError()
987 // This is safe as `endpoint` is verified to be in in NotifyEndpointOfError()
989 base::UnsafeDangling(endpoint))); in NotifyEndpointOfError()
993 // `endpoint` might be a dangling ptr and must be checked before dereference.
995 MayBeDangling<Endpoint> endpoint) { in NotifyEndpointOfErrorOnEndpointThread() argument
998 if (iter == endpoints_.end() || iter->second.get() != endpoint) in NotifyEndpointOfErrorOnEndpointThread()
1000 if (!endpoint->client()) in NotifyEndpointOfErrorOnEndpointThread()
1003 DCHECK(endpoint->task_runner()->RunsTasksInCurrentSequence()); in NotifyEndpointOfErrorOnEndpointThread()
1004 NotifyEndpointOfError(endpoint, false /* force_async */); in NotifyEndpointOfErrorOnEndpointThread()
1007 // Marks `endpoint` as closed and returns true if and only if its peer was
1009 bool MarkClosed(Endpoint* endpoint) EXCLUSIVE_LOCKS_REQUIRED(lock_) { in MarkClosed() argument
1010 endpoint->set_closed(); in MarkClosed()
1011 return endpoint->peer_closed(); in MarkClosed()
1014 // Marks `endpoint` as having a closed peer and returns true if and only if
1015 // `endpoint` itself was also already closed.
1016 bool MarkPeerClosed(Endpoint* endpoint) EXCLUSIVE_LOCKS_REQUIRED(lock_) { in MarkPeerClosed() argument
1017 endpoint->set_peer_closed(); in MarkPeerClosed()
1018 endpoint->SignalSyncMessageEvent(); in MarkPeerClosed()
1019 return endpoint->closed(); in MarkPeerClosed()
1022 void MarkClosedAndMaybeRemove(Endpoint* endpoint) in MarkClosedAndMaybeRemove() argument
1024 if (MarkClosed(endpoint)) { in MarkClosedAndMaybeRemove()
1025 endpoints_.erase(endpoint->id()); in MarkClosedAndMaybeRemove()
1029 void MarkPeerClosedAndMaybeRemove(Endpoint* endpoint) in MarkPeerClosedAndMaybeRemove() argument
1031 if (MarkPeerClosed(endpoint)) { in MarkPeerClosedAndMaybeRemove()
1032 endpoints_.erase(endpoint->id()); in MarkPeerClosedAndMaybeRemove()
1036 Endpoint* FindOrInsertEndpoint(mojo::InterfaceId id, bool* inserted) in FindOrInsertEndpoint()
1040 Endpoint* endpoint = FindEndpoint(id); in FindOrInsertEndpoint() local
1041 if (!endpoint) { in FindOrInsertEndpoint()
1042 endpoint = new Endpoint(this, id); in FindOrInsertEndpoint()
1043 endpoints_.insert({id, endpoint}); in FindOrInsertEndpoint()
1047 return endpoint; in FindOrInsertEndpoint()
1050 Endpoint* FindEndpoint(mojo::InterfaceId id) EXCLUSIVE_LOCKS_REQUIRED(lock_) { in FindEndpoint()
1070 Endpoint* endpoint = FindEndpoint(id); in Accept() local
1071 if (!endpoint) in Accept()
1074 mojo::InterfaceEndpointClient* client = endpoint->client(); in Accept()
1075 if (!client || !endpoint->task_runner()->RunsTasksInCurrentSequence()) { in Accept()
1081 // endpoint to be bound. in Accept()
1083 // This allows us to assume that if an endpoint is not yet bound when we in Accept()
1091 // proxy task runner. So even if the endpoint is already bound, we in Accept()
1096 // Finally, it's also possible that an endpoint was bound to an in Accept()
1101 client && endpoint->was_bound_off_sequence() in Accept()
1102 ? endpoint->task_runner() in Accept()
1112 // Sync messages may need to be handled by the endpoint if it's blocking in Accept()
1113 // on a sync reply. We pass ownership of the message to the endpoint's in Accept()
1114 // sync message queue. If the endpoint was blocking, it will dequeue the in Accept()
1118 endpoint->EnqueueSyncMessage(std::move(message_wrapper)); in Accept()
1167 Endpoint* endpoint = FindEndpoint(id); in AcceptOnEndpointThread() local
1168 if (!endpoint) in AcceptOnEndpointThread()
1171 mojo::InterfaceEndpointClient* client = endpoint->client(); in AcceptOnEndpointThread()
1175 if (!endpoint->task_runner()->RunsTasksInCurrentSequence() && in AcceptOnEndpointThread()
1217 Endpoint* endpoint = FindEndpoint(interface_id); in AcceptSyncMessage() local
1218 if (!endpoint) in AcceptSyncMessage()
1221 // Careful, if the endpoint is detached its members are cleared. Check for in AcceptSyncMessage()
1223 mojo::InterfaceEndpointClient* client = endpoint->client(); in AcceptSyncMessage()
1227 if (!endpoint->task_runner()->RunsTasksInCurrentSequence() && in AcceptSyncMessage()
1235 MessageWrapper message_wrapper = endpoint->PopSyncMessage(message_id); in AcceptSyncMessage()
1237 // The message must have already been dequeued by the endpoint waking up in AcceptSyncMessage()
1260 scoped_refptr<Endpoint> endpoint = FindOrInsertEndpoint(id, nullptr); in OnPeerAssociatedEndpointClosed() local
1262 endpoint->set_disconnect_reason(reason); in OnPeerAssociatedEndpointClosed()
1263 if (!endpoint->peer_closed()) { in OnPeerAssociatedEndpointClosed()
1264 if (endpoint->client()) in OnPeerAssociatedEndpointClosed()
1265 NotifyEndpointOfError(endpoint.get(), false /* force_async */); in OnPeerAssociatedEndpointClosed()
1266 MarkPeerClosedAndMaybeRemove(endpoint.get()); in OnPeerAssociatedEndpointClosed()
1318 std::map<uint32_t, scoped_refptr<Endpoint>> endpoints_ GUARDED_BY(lock_);