NEW 127304
Add a convenience method to unregister remote object.
https://bugs.webkit.org/show_bug.cgi?id=127304
Summary Add a convenience method to unregister remote object.
Yongjun Zhang
Reported 2014-01-20 13:36:43 PST
Currently the API to unregister an remote object in WKRemoteObjectRegistry is: - (void)unregisterExportedObject:(id)object interface:(WKRemoteObjectInterface *)interface which means the caller has to prepare the WKRemoteObjectInterface object when unregistering object. It would be nice to have a convenience method only take object as argument.
Attachments
mitz
Comment 1 2014-01-20 13:40:31 PST
What if the same object is registered for multiple interfaces?
mitz
Comment 2 2014-01-20 13:43:09 PST
FWIW, I do think this API is cumbersome because it requires the caller to pass a WKRemoteObjectInterface, which it typically gets from +remoteObjectInterfaceWithProtocol:. I wonder if there can be methods that take a Protocol instead of a WKRemoteObjectInterface.
Anders Carlsson
Comment 3 2014-01-20 13:47:42 PST
(In reply to comment #2) > FWIW, I do think this API is cumbersome because it requires the caller to pass a WKRemoteObjectInterface, which it typically gets from +remoteObjectInterfaceWithProtocol:. I wonder if there can be methods that take a Protocol instead of a WKRemoteObjectInterface. What if the same protocol is registered for multiple interfaces?
Yongjun Zhang
Comment 4 2014-01-20 13:50:59 PST
(In reply to comment #2) > FWIW, I do think this API is cumbersome because it requires the caller to pass a WKRemoteObjectInterface, which it typically gets from +remoteObjectInterfaceWithProtocol:. I wonder if there can be methods that take a Protocol instead of a WKRemoteObjectInterface. +remoteObjectInterfaceWithProtocol:. I wonder if there can be methods that take a Protocol instead of a WKRemoteObjectInterface. The problem with +remoteObjectInterfaceWithProtocol: is that it creates a new WKRemoteObjectInterface* object every time for the same Protocol. That means we will hit assertion in - (void)unregisterExportedObject:(id)object interface:(WKRemoteObjectInterface *)interface since it is different than the interface argument used on registering. For now, the only way to get around this is to save interface on the caller and use that exact object on both registering and unregistering.
Yongjun Zhang
Comment 5 2014-01-20 17:38:37 PST
It is hard to predict the usage pattern now, but I think sometimes we probably just want to unregister the object before destroying the object, in that case, it would be helpful if we provide a method to remove an object (for all interfaces) from the registry. Some thing like: - (void)unregisterObjectForAllInterfaces:(id)object; what do you think?
Note You need to log in before you can comment on or make changes to this bug.