Lines Matching full:endpoint

171       Endpoint* sender_endpoint = new Endpoint(this, sender_id);  in CreateChannelEndpoints()
172 Endpoint* receiver_endpoint = new Endpoint(this, receiver_id); in CreateChannelEndpoints()
216 Endpoint* endpoint = new Endpoint(this, id); in AssociateInterface() local
218 endpoint->set_peer_closed(); in AssociateInterface()
219 endpoint->set_handle_created(); in AssociateInterface()
220 endpoints_.insert({id, endpoint}); in AssociateInterface()
228 Endpoint* endpoint = FindEndpoint(id); in AssociateInterface() local
229 if (endpoint) in AssociateInterface()
230 MarkClosedAndMaybeRemove(endpoint); in AssociateInterface()
255 Endpoint* endpoint = FindOrInsertEndpoint(id, &inserted); in CreateLocalEndpointHandle() local
257 DCHECK(!endpoint->handle_created()); in CreateLocalEndpointHandle()
259 endpoint->set_peer_closed(); in CreateLocalEndpointHandle()
261 if (endpoint->handle_created()) in CreateLocalEndpointHandle()
265 endpoint->set_handle_created(); in CreateLocalEndpointHandle()
277 Endpoint* endpoint = endpoints_[id].get(); in CloseEndpointHandle() local
278 DCHECK(!endpoint->client()); in CloseEndpointHandle()
279 DCHECK(!endpoint->closed()); in CloseEndpointHandle()
280 MarkClosedAndMaybeRemove(endpoint); in CloseEndpointHandle()
299 Endpoint* endpoint = endpoints_[id].get(); in AttachEndpointClient() local
300 endpoint->AttachClient(client, std::move(runner)); in AttachEndpointClient()
302 if (endpoint->peer_closed()) in AttachEndpointClient()
303 NotifyEndpointOfError(endpoint, true /* force_async */); in AttachEndpointClient()
305 return endpoint; in AttachEndpointClient()
317 Endpoint* endpoint = endpoints_[id].get(); in DetachEndpointClient() local
318 endpoint->DetachClient(); in DetachEndpointClient()
325 // * We should never close a channel endpoint in either process as long as in RaiseError()
326 // the child process is still alive. The child's endpoint should only be in RaiseError()
327 // closed implicitly by process death, and the browser's endpoint should in RaiseError()
334 // local endpoint drops a response callback without calling it. in RaiseError()
350 class Endpoint;
352 friend class Endpoint;
396 class Endpoint : public base::RefCountedThreadSafe<Endpoint>, class in IPC::__anon8d57b7970111::ChannelAssociatedGroupController
399 Endpoint(ChannelAssociatedGroupController* controller, mojo::InterfaceId id) in Endpoint() function in IPC::__anon8d57b7970111::ChannelAssociatedGroupController::Endpoint
515 // It's not legal to make sync calls from the master endpoint's thread, in SyncWatch()
525 friend class base::RefCountedThreadSafe<Endpoint>;
527 ~Endpoint() override { in ~Endpoint()
538 scoped_refptr<Endpoint> keepalive(this); in OnSyncMessageEventReady()
568 // SyncWatch() calls are on the stack for this endpoint, resetting the in OnSyncMessageEventReady()
581 base::BindRepeating(&Endpoint::OnSyncMessageEventReady, in EnsureSyncWatcherExists()
607 DISALLOW_COPY_AND_ASSIGN(Endpoint);
632 Endpoint* endpoint = iter->second.get(); in ~ChannelAssociatedGroupController() local
635 if (!endpoint->closed()) { in ~ChannelAssociatedGroupController()
637 // but the interface ID hasn't been used to create local endpoint in ~ChannelAssociatedGroupController()
639 DCHECK(!endpoint->client()); in ~ChannelAssociatedGroupController()
640 DCHECK(endpoint->peer_closed()); in ~ChannelAssociatedGroupController()
641 MarkClosedAndMaybeRemove(endpoint); in ~ChannelAssociatedGroupController()
643 MarkPeerClosedAndMaybeRemove(endpoint); in ~ChannelAssociatedGroupController()
668 // We always post tasks to the master endpoint thread when called from in SendMessage()
695 std::vector<scoped_refptr<Endpoint>> endpoints_to_notify; in OnPipeError()
697 Endpoint* endpoint = iter->second.get(); in OnPipeError() local
700 if (endpoint->client()) in OnPipeError()
701 endpoints_to_notify.push_back(endpoint); in OnPipeError()
703 MarkPeerClosedAndMaybeRemove(endpoint); in OnPipeError()
706 for (auto& endpoint : endpoints_to_notify) { in OnPipeError() local
707 // Because a notification may in turn detach any endpoint, we have to in OnPipeError()
709 if (endpoint->client()) in OnPipeError()
710 NotifyEndpointOfError(endpoint.get(), false /* force_async */); in OnPipeError()
714 void NotifyEndpointOfError(Endpoint* endpoint, bool force_async) { in NotifyEndpointOfError() argument
716 DCHECK(endpoint->task_runner() && endpoint->client()); in NotifyEndpointOfError()
717 if (endpoint->task_runner()->RunsTasksInCurrentSequence() && !force_async) { in NotifyEndpointOfError()
718 mojo::InterfaceEndpointClient* client = endpoint->client(); in NotifyEndpointOfError()
720 endpoint->disconnect_reason()); in NotifyEndpointOfError()
725 endpoint->task_runner()->PostTask( in NotifyEndpointOfError()
729 this, endpoint->id(), base::Unretained(endpoint))); in NotifyEndpointOfError()
734 Endpoint* endpoint) { in NotifyEndpointOfErrorOnEndpointThread() argument
737 if (iter == endpoints_.end() || iter->second.get() != endpoint) in NotifyEndpointOfErrorOnEndpointThread()
739 if (!endpoint->client()) in NotifyEndpointOfErrorOnEndpointThread()
742 DCHECK(endpoint->task_runner()->RunsTasksInCurrentSequence()); in NotifyEndpointOfErrorOnEndpointThread()
743 NotifyEndpointOfError(endpoint, false /* force_async */); in NotifyEndpointOfErrorOnEndpointThread()
746 void MarkClosedAndMaybeRemove(Endpoint* endpoint) { in MarkClosedAndMaybeRemove() argument
748 endpoint->set_closed(); in MarkClosedAndMaybeRemove()
749 if (endpoint->closed() && endpoint->peer_closed()) in MarkClosedAndMaybeRemove()
750 endpoints_.erase(endpoint->id()); in MarkClosedAndMaybeRemove()
753 void MarkPeerClosedAndMaybeRemove(Endpoint* endpoint) { in MarkPeerClosedAndMaybeRemove() argument
755 endpoint->set_peer_closed(); in MarkPeerClosedAndMaybeRemove()
756 endpoint->SignalSyncMessageEvent(); in MarkPeerClosedAndMaybeRemove()
757 if (endpoint->closed() && endpoint->peer_closed()) in MarkPeerClosedAndMaybeRemove()
758 endpoints_.erase(endpoint->id()); in MarkPeerClosedAndMaybeRemove()
761 Endpoint* FindOrInsertEndpoint(mojo::InterfaceId id, bool* inserted) { in FindOrInsertEndpoint()
765 Endpoint* endpoint = FindEndpoint(id); in FindOrInsertEndpoint() local
766 if (!endpoint) { in FindOrInsertEndpoint()
767 endpoint = new Endpoint(this, id); in FindOrInsertEndpoint()
768 endpoints_.insert({id, endpoint}); in FindOrInsertEndpoint()
772 return endpoint; in FindOrInsertEndpoint()
775 Endpoint* FindEndpoint(mojo::InterfaceId id) { in FindEndpoint()
795 Endpoint* endpoint = FindEndpoint(id); in Accept() local
796 if (!endpoint) in Accept()
799 mojo::InterfaceEndpointClient* client = endpoint->client(); in Accept()
800 if (!client || !endpoint->task_runner()->RunsTasksInCurrentSequence()) { in Accept()
811 // Sync messages may need to be handled by the endpoint if it's blocking in Accept()
812 // on a sync reply. We pass ownership of the message to the endpoint's in Accept()
813 // sync message queue. If the endpoint was blocking, it will dequeue the in Accept()
817 endpoint->EnqueueSyncMessage(std::move(message_wrapper)); in Accept()
832 // We do not expect to receive sync responses on the master endpoint thread. in Accept()
848 Endpoint* endpoint = FindEndpoint(id); in AcceptOnProxyThread() local
849 if (!endpoint) in AcceptOnProxyThread()
852 mojo::InterfaceEndpointClient* client = endpoint->client(); in AcceptOnProxyThread()
856 DCHECK(endpoint->task_runner()->RunsTasksInCurrentSequence()); in AcceptOnProxyThread()
875 Endpoint* endpoint = FindEndpoint(interface_id); in AcceptSyncMessage() local
876 if (!endpoint) in AcceptSyncMessage()
879 // Careful, if the endpoint is detached its members are cleared. Check for in AcceptSyncMessage()
881 mojo::InterfaceEndpointClient* client = endpoint->client(); in AcceptSyncMessage()
885 DCHECK(endpoint->task_runner()->RunsTasksInCurrentSequence()); in AcceptSyncMessage()
886 MessageWrapper message_wrapper = endpoint->PopSyncMessage(message_id); in AcceptSyncMessage()
888 // The message must have already been dequeued by the endpoint waking up in AcceptSyncMessage()
911 scoped_refptr<Endpoint> endpoint = FindOrInsertEndpoint(id, nullptr); in OnPeerAssociatedEndpointClosed() local
913 endpoint->set_disconnect_reason(reason); in OnPeerAssociatedEndpointClosed()
914 if (!endpoint->peer_closed()) { in OnPeerAssociatedEndpointClosed()
915 if (endpoint->client()) in OnPeerAssociatedEndpointClosed()
916 NotifyEndpointOfError(endpoint.get(), false /* force_async */); in OnPeerAssociatedEndpointClosed()
917 MarkPeerClosedAndMaybeRemove(endpoint.get()); in OnPeerAssociatedEndpointClosed()
923 // Checked in places which must be run on the master endpoint's thread.
956 std::map<uint32_t, scoped_refptr<Endpoint>> endpoints_;