Commit 37585591 authored by Austin Tankiang's avatar Austin Tankiang Committed by Commit Bot

Use WeakInterfacePtr for Geolocation

Make Geolocation use WeakInterfacePtr, which is the class to use
so that mojo interface handles do not need to be manually closed
on Execution context destruction.

WeakInterfacePtr are the new hotness, they do that automatically
on Execution context destruction.

No new tests, no change in behavior, covered by existing tests.

Bug: 800641
Change-Id: Icf5347c012c735b03676d2537cae4473f03fc568
Reviewed-on: https://chromium-review.googlesource.com/880246
Commit-Queue: Austin Tankiang <austinct@google.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532795}
parent f162649e
......@@ -140,7 +140,6 @@ LocalFrame* Geolocation::GetFrame() const {
}
void Geolocation::ContextDestroyed(ExecutionContext*) {
geolocation_service_.reset();
CancelAllRequests();
StopUpdating();
last_position_ = nullptr;
......@@ -484,10 +483,12 @@ void Geolocation::UpdateGeolocationConnection() {
if (geolocation_)
return;
InterfaceInvalidator* invalidator =
GetExecutionContext()->GetInterfaceInvalidator();
GetFrame()->GetInterfaceProvider().GetInterface(
mojo::MakeRequest(&geolocation_service_));
MakeRequest(&geolocation_service_, invalidator));
geolocation_service_->CreateGeolocation(
mojo::MakeRequest(&geolocation_),
MakeRequest(&geolocation_, invalidator),
Frame::HasTransientUserActivation(GetFrame()));
geolocation_.set_connection_error_handler(WTF::Bind(
......
......@@ -190,8 +190,8 @@ class MODULES_EXPORT Geolocation final
GeolocationWatchers watchers_being_invoked_;
Member<Geoposition> last_position_;
device::mojom::blink::GeolocationPtr geolocation_;
mojom::blink::GeolocationServicePtr geolocation_service_;
device::mojom::blink::WeakGeolocationPtr geolocation_;
mojom::blink::WeakGeolocationServicePtr geolocation_service_;
bool enable_high_accuracy_ = false;
// Whether a GeoNotifier is waiting for a position update.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment