Electrolysis/Geolocation

From MozillaWiki
Jump to: navigation, search

The only content-facing bits are in nsIDOMGeoGeolocation.idl, ie:

 void getCurrentPosition(nsIDOMGeoPositionCallback successCallback,
                         nsIDOMGeoPositionErrorCallback errorCallback,
                         nsIDOMGeoPositionOptions options);
 long watchPosition(nsIDOMGeoPositionCallback successCallback,
                    nsIDOMGeoPositionErrorCallback errorCallback,
                    nsIDOMGeoPositionOptions options);
 void clearWatch(long watchId);

The nsGeolocation class can be split into chrome and content objects, with all of the current functionality moving into chrome.

When content calls the above functions, the content process can create an actor that encapsulates and dispatches an asynchronous operation to the chrome process. The encapsulating actor on the chrome side runs the requested action, passing specially-implemented callbacks that send a serialized position update or error message to the child. The child actor stores the content callbacks and executes them accordingly.