Index: ipc/ipc_channel_proxy.h |
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h |
index 774df26fb475b201f7ee3bd88c4b9d516ceafd25..03098c43e057ade692a769e6ec416ccb051826db 100644 |
--- a/ipc/ipc_channel_proxy.h |
+++ b/ipc/ipc_channel_proxy.h |
@@ -189,7 +189,8 @@ |
} |
// Gets the AssociatedGroup used to create new associated endpoints on this |
- // ChannelProxy. |
+ // ChannelProxy. This must only be called after the listener's |
+ // OnChannelConnected is called. |
mojo::AssociatedGroup* GetAssociatedGroup(); |
// Requests an associated interface from the remote endpoint. |
@@ -198,6 +199,7 @@ |
mojo::ScopedInterfaceEndpointHandle handle); |
// Template helper to request associated interfaces from the remote endpoint. |
+ // Must only be called after the listener's OnChannelConnected is called. |
template <typename Interface> |
void GetRemoteAssociatedInterface( |
mojo::AssociatedInterfacePtr<Interface>* proxy) { |
@@ -229,7 +231,7 @@ |
class Context; |
// A subclass uses this constructor if it needs to add more information |
// to the internal state. |
- explicit ChannelProxy(Context* context); |
+ ChannelProxy(Context* context); |
// Used internally to hold state that is referenced on the IPC thread. |
@@ -310,15 +312,6 @@ |
void SendFromThisThread(Message* message); |
void ClearChannel(); |
- mojo::AssociatedGroup* associated_group() { return &associated_group_; } |
- |
- void AddGenericAssociatedInterface( |
- const std::string& name, |
- const GenericAssociatedInterfaceFactory& factory); |
- void AddGenericAssociatedInterfaceForIOThread( |
- const std::string& name, |
- const GenericAssociatedInterfaceFactory& factory); |
- |
scoped_refptr<base::SingleThreadTaskRunner> listener_task_runner_; |
Listener* listener_; |
@@ -360,13 +353,15 @@ |
// brokerable attachment messages to/from the broker process. |
bool attachment_broker_endpoint_; |
- mojo::AssociatedGroup associated_group_; |
- |
- // Holds associated interface binders added by AddGenericAssociatedInterface |
- // or AddGenericAssociatedInterfaceForIOThread until the underlying channel |
- // has been initialized. This is only accessed from the listener thread. |
- std::vector<std::pair<std::string, GenericAssociatedInterfaceFactory>> |
- pending_interfaces_; |
+ // Modified only on the listener's thread before Init() is called. |
+ std::map<std::string, GenericAssociatedInterfaceFactory> |
+ io_thread_interfaces_; |
+ std::map<std::string, GenericAssociatedInterfaceFactory> |
+ proxy_thread_interfaces_; |
+ |
+ // Valid and constant any time after the ChannelProxy's Listener receives |
+ // OnChannelConnected on its own thread. |
+ std::unique_ptr<mojo::AssociatedGroup> channel_associated_group_; |
}; |
Context* context() { return context_.get(); } |