Bug 127304
Summary: | Add a convenience method to unregister remote object. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Yongjun Zhang <yongjun_zhang> |
Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | andersca, mitz, sam |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Yongjun Zhang
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
mitz
What if the same object is registered for multiple interfaces?
mitz
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
(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
(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
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?