Draft idea for discussion:
interface ServiceWorkerRegistrationHost {
// Replace old IPC ServiceWorkerHostMsg_UpdateServiceWorker
Update()
=> (blink.mojom.ServiceWorkerErrorType error,
mojo.common.mojom.String16? error_msg);
// Replace old IPC ServiceWorkerHostMsg_UnregisterServiceWorker
Unregister()
=> (blink.mojom.ServiceWorkerErrorType error,
mojo.common.mojom.String16? error_msg);
// Replace old IPC ServiceWorkerHostMsg_IncrementRegistrationRefCount
IncrementRefCount();
// Replace old IPC ServiceWorkerHostMsg_DecrementRegistrationRefCount
DecrementRefCount();
}
Browser-side behavior:
1.
Let ServiceWorkerRegistrationHandle impl the above interface
2.
Let ServiceWorkerRegistrationHandle maintain a binding set of mojo connections.
3.
ServiceWorkerRegistrationHandle holds a reference of corresponding ServiceWorkerRegistration instance, which can be leveraged to do actual work.
Renderer side behavior:
1.
Let ServiceWorkerRegistrationHandleReference hold the mojo interface ptr.
2.
Let ServiceWorkerRegistrationHandleReference use the mojo interface ptr to do the work of old IPCs DecreRefCount and IncreRefCount before.
3.
Let WebServiceWorkerRegistrationImpl use the mojo interface ptr to impl its functions Update() and Unregister(), instead of asking for ServiceWorkerDispatcher.
How to establish the mojo connection:
For both sw context and client context, just create&bind a new mojom::ServiceWorkerRegistrationHostPtr and pass it along the same path of passing ServiceWorkerRegistrationObjectInfo currently.
Comment 1 by leon....@intel.com
, Aug 23 2017Update: interface ServiceWorkerRegistrationHost { // Replace old IPC ServiceWorkerHostMsg_UpdateServiceWorker Update() => (blink.mojom.ServiceWorkerErrorType error, mojo.common.mojom.String16? error_msg); // Replace old IPC ServiceWorkerHostMsg_UnregisterServiceWorker Unregister() => (blink.mojom.ServiceWorkerErrorType error, mojo.common.mojom.String16? error_msg); // Replace old IPCs ServiceWorkerHostMsg_{Incre,Decre}mentRegistrationRefCount // Clone() establishes a new mojo connection. And ServiceWorkerRegistrationHost implementation class(ServiceWorkerRegistrationHandle) lifetime is bound with the number of connections, it destroys itself once all mojo connections gone away. Clone(associated ServiceWorkerRegistrationHost& request); }