<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>127304</bug_id>
          
          <creation_ts>2014-01-20 13:36:43 -0800</creation_ts>
          <short_desc>Add a convenience method to unregister remote object.</short_desc>
          <delta_ts>2014-01-20 17:38:37 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yongjun Zhang">yongjun_zhang</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andersca</cc>
    
    <cc>mitz</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>969986</commentid>
    <comment_count>0</comment_count>
    <who name="Yongjun Zhang">yongjun_zhang</who>
    <bug_when>2014-01-20 13:36:43 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969988</commentid>
    <comment_count>1</comment_count>
    <who name="">mitz</who>
    <bug_when>2014-01-20 13:40:31 -0800</bug_when>
    <thetext>What if the same object is registered for multiple interfaces?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969992</commentid>
    <comment_count>2</comment_count>
    <who name="">mitz</who>
    <bug_when>2014-01-20 13:43:09 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969993</commentid>
    <comment_count>3</comment_count>
    <who name="Anders Carlsson">andersca</who>
    <bug_when>2014-01-20 13:47:42 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; 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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969999</commentid>
    <comment_count>4</comment_count>
    <who name="Yongjun Zhang">yongjun_zhang</who>
    <bug_when>2014-01-20 13:50:59 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>970097</commentid>
    <comment_count>5</comment_count>
    <who name="Yongjun Zhang">yongjun_zhang</who>
    <bug_when>2014-01-20 17:38:37 -0800</bug_when>
    <thetext>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?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>