Lines Matching full:endpoint
281 Endpoint* sender_endpoint = new Endpoint(this, sender_id); in Bind()
282 Endpoint* receiver_endpoint = new Endpoint(this, receiver_id); in Bind()
340 Endpoint* endpoint = new Endpoint(this, id); in AssociateInterface() local
342 endpoint->set_peer_closed(); in AssociateInterface()
343 endpoint->set_handle_created(); in AssociateInterface()
344 endpoints_.insert({id, endpoint}); in AssociateInterface()
352 Endpoint* endpoint = FindEndpoint(id); in AssociateInterface() local
353 if (endpoint) in AssociateInterface()
354 MarkClosedAndMaybeRemove(endpoint); in AssociateInterface()
379 Endpoint* endpoint = FindOrInsertEndpoint(id, &inserted); in CreateLocalEndpointHandle() local
381 DCHECK(!endpoint->handle_created()); in CreateLocalEndpointHandle()
383 endpoint->set_peer_closed(); in CreateLocalEndpointHandle()
385 if (endpoint->handle_created()) in CreateLocalEndpointHandle()
389 endpoint->set_handle_created(); in CreateLocalEndpointHandle()
401 Endpoint* endpoint = endpoints_[id].get(); in CloseEndpointHandle() local
402 DCHECK(!endpoint->client()); in CloseEndpointHandle()
403 DCHECK(!endpoint->closed()); in CloseEndpointHandle()
404 MarkClosedAndMaybeRemove(endpoint); in CloseEndpointHandle()
439 Endpoint* endpoint = endpoints_[id].get(); in AttachEndpointClient() local
440 endpoint->AttachClient(client, std::move(runner)); in AttachEndpointClient()
442 if (endpoint->peer_closed()) in AttachEndpointClient()
443 NotifyEndpointOfError(endpoint, true /* force_async */); in AttachEndpointClient()
445 return endpoint; in AttachEndpointClient()
457 Endpoint* endpoint = endpoints_[id].get(); in DetachEndpointClient() local
458 endpoint->DetachClient(); in DetachEndpointClient()
465 // * We should never close a channel endpoint in either process as long as in RaiseError()
466 // the child process is still alive. The child's endpoint should only be in RaiseError()
467 // closed implicitly by process death, and the browser's endpoint should in RaiseError()
474 // local endpoint drops a response callback without calling it. in RaiseError()
497 class Endpoint;
499 friend class Endpoint;
549 class Endpoint : public base::RefCountedThreadSafe<Endpoint>, class in IPC::ChannelAssociatedGroupController
552 Endpoint(ChannelAssociatedGroupController* controller, mojo::InterfaceId id) in Endpoint() function in IPC::ChannelAssociatedGroupController::Endpoint
555 Endpoint(const Endpoint&) = delete;
556 Endpoint& operator=(const Endpoint&) = delete;
680 // It's not legal to make sync calls from the primary endpoint's thread, in SyncWatch()
732 friend class base::RefCountedThreadSafe<Endpoint>;
734 ~Endpoint() override { in ~Endpoint()
749 // `controller_keepalive` MUST outlive `keepalive` because the Endpoint in OnSyncMessageEventReady()
753 scoped_refptr<Endpoint> keepalive(this); in OnSyncMessageEventReady()
781 // SyncWatch() calls are on the stack for this endpoint, resetting the in OnSyncMessageEventReady()
794 base::BindRepeating(&Endpoint::OnSyncMessageEventReady, in EnsureSyncWatcherExists()
869 Endpoint* endpoint = iter->second.get(); in ~ChannelAssociatedGroupController() local
872 if (!endpoint->closed()) { in ~ChannelAssociatedGroupController()
874 // but the interface ID hasn't been used to create local endpoint in ~ChannelAssociatedGroupController()
876 DCHECK(!endpoint->client()); in ~ChannelAssociatedGroupController()
877 DCHECK(endpoint->peer_closed()); in ~ChannelAssociatedGroupController()
878 MarkClosed(endpoint); in ~ChannelAssociatedGroupController()
880 MarkPeerClosed(endpoint); in ~ChannelAssociatedGroupController()
941 std::vector<scoped_refptr<Endpoint>> endpoints_to_notify; in OnPipeError()
943 Endpoint* endpoint = iter->second.get(); in OnPipeError() local
946 if (endpoint->client()) { in OnPipeError()
947 endpoints_to_notify.push_back(endpoint); in OnPipeError()
950 if (MarkPeerClosed(endpoint)) { in OnPipeError()
951 endpoints_to_remove.push_back(endpoint->id()); in OnPipeError()
955 for (auto& endpoint : endpoints_to_notify) { in OnPipeError() local
956 // Because a notification may in turn detach any endpoint, we have to in OnPipeError()
958 if (endpoint->client()) in OnPipeError()
959 NotifyEndpointOfError(endpoint.get(), false /* force_async */); in OnPipeError()
967 void NotifyEndpointOfError(Endpoint* endpoint, bool force_async) in NotifyEndpointOfError() argument
969 DCHECK(endpoint->task_runner() && endpoint->client()); in NotifyEndpointOfError()
970 if (endpoint->task_runner()->RunsTasksInCurrentSequence() && !force_async) { in NotifyEndpointOfError()
971 mojo::InterfaceEndpointClient* client = endpoint->client(); in NotifyEndpointOfError()
973 endpoint->disconnect_reason()); in NotifyEndpointOfError()
978 endpoint->task_runner()->PostTask( in NotifyEndpointOfError()
982 this, endpoint->id(), in NotifyEndpointOfError()
983 // This is safe as `endpoint` is verified to be in in NotifyEndpointOfError()
985 base::UnsafeDangling(endpoint))); in NotifyEndpointOfError()
989 // `endpoint` might be a dangling ptr and must be checked before dereference.
991 MayBeDangling<Endpoint> endpoint) { in NotifyEndpointOfErrorOnEndpointThread() argument
994 if (iter == endpoints_.end() || iter->second.get() != endpoint) in NotifyEndpointOfErrorOnEndpointThread()
996 if (!endpoint->client()) in NotifyEndpointOfErrorOnEndpointThread()
999 DCHECK(endpoint->task_runner()->RunsTasksInCurrentSequence()); in NotifyEndpointOfErrorOnEndpointThread()
1000 NotifyEndpointOfError(endpoint, false /* force_async */); in NotifyEndpointOfErrorOnEndpointThread()
1003 // Marks `endpoint` as closed and returns true if and only if its peer was
1005 bool MarkClosed(Endpoint* endpoint) EXCLUSIVE_LOCKS_REQUIRED(lock_) { in MarkClosed() argument
1006 endpoint->set_closed(); in MarkClosed()
1007 return endpoint->peer_closed(); in MarkClosed()
1010 // Marks `endpoint` as having a closed peer and returns true if and only if
1011 // `endpoint` itself was also already closed.
1012 bool MarkPeerClosed(Endpoint* endpoint) EXCLUSIVE_LOCKS_REQUIRED(lock_) { in MarkPeerClosed() argument
1013 endpoint->set_peer_closed(); in MarkPeerClosed()
1014 endpoint->SignalSyncMessageEvent(); in MarkPeerClosed()
1015 return endpoint->closed(); in MarkPeerClosed()
1018 void MarkClosedAndMaybeRemove(Endpoint* endpoint) in MarkClosedAndMaybeRemove() argument
1020 if (MarkClosed(endpoint)) { in MarkClosedAndMaybeRemove()
1021 endpoints_.erase(endpoint->id()); in MarkClosedAndMaybeRemove()
1025 void MarkPeerClosedAndMaybeRemove(Endpoint* endpoint) in MarkPeerClosedAndMaybeRemove() argument
1027 if (MarkPeerClosed(endpoint)) { in MarkPeerClosedAndMaybeRemove()
1028 endpoints_.erase(endpoint->id()); in MarkPeerClosedAndMaybeRemove()
1032 Endpoint* FindOrInsertEndpoint(mojo::InterfaceId id, bool* inserted) in FindOrInsertEndpoint()
1036 Endpoint* endpoint = FindEndpoint(id); in FindOrInsertEndpoint() local
1037 if (!endpoint) { in FindOrInsertEndpoint()
1038 endpoint = new Endpoint(this, id); in FindOrInsertEndpoint()
1039 endpoints_.insert({id, endpoint}); in FindOrInsertEndpoint()
1043 return endpoint; in FindOrInsertEndpoint()
1046 Endpoint* FindEndpoint(mojo::InterfaceId id) EXCLUSIVE_LOCKS_REQUIRED(lock_) { in FindEndpoint()
1066 Endpoint* endpoint = FindEndpoint(id); in Accept() local
1067 if (!endpoint) in Accept()
1070 mojo::InterfaceEndpointClient* client = endpoint->client(); in Accept()
1071 if (!client || !endpoint->task_runner()->RunsTasksInCurrentSequence()) { in Accept()
1077 // endpoint to be bound. in Accept()
1079 // This allows us to assume that if an endpoint is not yet bound when we in Accept()
1087 // proxy task runner. So even if the endpoint is already bound, we in Accept()
1092 // Finally, it's also possible that an endpoint was bound to an in Accept()
1097 client && endpoint->was_bound_off_sequence() in Accept()
1098 ? endpoint->task_runner() in Accept()
1108 // Sync messages may need to be handled by the endpoint if it's blocking in Accept()
1109 // on a sync reply. We pass ownership of the message to the endpoint's in Accept()
1110 // sync message queue. If the endpoint was blocking, it will dequeue the in Accept()
1114 endpoint->EnqueueSyncMessage(std::move(message_wrapper)); in Accept()
1163 Endpoint* endpoint = FindEndpoint(id); in AcceptOnEndpointThread() local
1164 if (!endpoint) in AcceptOnEndpointThread()
1167 mojo::InterfaceEndpointClient* client = endpoint->client(); in AcceptOnEndpointThread()
1171 if (!endpoint->task_runner()->RunsTasksInCurrentSequence() && in AcceptOnEndpointThread()
1213 Endpoint* endpoint = FindEndpoint(interface_id); in AcceptSyncMessage() local
1214 if (!endpoint) in AcceptSyncMessage()
1217 // Careful, if the endpoint is detached its members are cleared. Check for in AcceptSyncMessage()
1219 mojo::InterfaceEndpointClient* client = endpoint->client(); in AcceptSyncMessage()
1223 if (!endpoint->task_runner()->RunsTasksInCurrentSequence() && in AcceptSyncMessage()
1231 MessageWrapper message_wrapper = endpoint->PopSyncMessage(message_id); in AcceptSyncMessage()
1233 // The message must have already been dequeued by the endpoint waking up in AcceptSyncMessage()
1256 scoped_refptr<Endpoint> endpoint = FindOrInsertEndpoint(id, nullptr); in OnPeerAssociatedEndpointClosed() local
1258 endpoint->set_disconnect_reason(reason); in OnPeerAssociatedEndpointClosed()
1259 if (!endpoint->peer_closed()) { in OnPeerAssociatedEndpointClosed()
1260 if (endpoint->client()) in OnPeerAssociatedEndpointClosed()
1261 NotifyEndpointOfError(endpoint.get(), false /* force_async */); in OnPeerAssociatedEndpointClosed()
1262 MarkPeerClosedAndMaybeRemove(endpoint.get()); in OnPeerAssociatedEndpointClosed()
1314 std::map<uint32_t, scoped_refptr<Endpoint>> endpoints_ GUARDED_BY(lock_);