Commit 0794bed5 authored by Ke He's avatar Ke He Committed by Commit Bot

Chrome: Crash Report - device::mojom::GeolocationProxy::QueryNextPosition

The crash reason is |geolocation| got std::move() first before it calls
the QueryNextPosition(). It is better to save the InterfacePtr of geolocation
and geolocation_context as class member.

BUG=791445

Change-Id: I694853a0bc37f53d879419e7b0ab2d8943e98509
Reviewed-on: https://chromium-review.googlesource.com/807759
Commit-Queue: Ke He <ke.he@intel.com>
Reviewed-by: default avatarColin Blundell (OOO Dec 7) <blundell@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522345}
parent 9f4945a7
......@@ -205,10 +205,7 @@ class FingerprintDataLoader : public content::GpuDataManagerObserver {
// Callbacks for asynchronously loaded data.
void OnGotFonts(std::unique_ptr<base::ListValue> fonts);
void OnGotPlugins(const std::vector<content::WebPluginInfo>& plugins);
void OnGotGeoposition(
device::mojom::GeolocationContextPtr geolocation_context,
device::mojom::GeolocationPtr geolocation,
device::mojom::GeopositionPtr geoposition);
void OnGotGeoposition(device::mojom::GeopositionPtr geoposition);
// If all of the asynchronous data has been loaded, calls |callback_| with
// the fingerprint data.
......@@ -243,6 +240,8 @@ class FingerprintDataLoader : public content::GpuDataManagerObserver {
std::vector<content::WebPluginInfo> plugins_;
bool waiting_on_plugins_;
device::mojom::Geoposition geoposition_;
device::mojom::GeolocationPtr geolocation_;
device::mojom::GeolocationContextPtr geolocation_context_;
// Timer to enforce a maximum timeout before the |callback_| is called, even
// if not all asynchronous data has been loaded.
......@@ -316,18 +315,13 @@ FingerprintDataLoader::FingerprintDataLoader(
// Load geolocation data.
DCHECK(connector);
device::mojom::GeolocationContextPtr geolocation_context;
device::mojom::GeolocationPtr geolocation;
connector->BindInterface(device::mojom::kServiceName,
mojo::MakeRequest(&geolocation_context));
geolocation_context->BindGeolocation(mojo::MakeRequest(&geolocation));
geolocation->SetHighAccuracy(false);
geolocation->QueryNextPosition(
// Pass the ownership of |geolocation_context| and |geolocation| to ensure
// the connections are kept alive until the callback is received.
mojo::MakeRequest(&geolocation_context_));
geolocation_context_->BindGeolocation(mojo::MakeRequest(&geolocation_));
geolocation_->SetHighAccuracy(false);
geolocation_->QueryNextPosition(
base::BindOnce(&FingerprintDataLoader::OnGotGeoposition,
weak_ptr_factory_.GetWeakPtr(),
std::move(geolocation_context), std::move(geolocation)));
weak_ptr_factory_.GetWeakPtr()));
}
void FingerprintDataLoader::OnGpuInfoUpdate() {
......@@ -353,8 +347,6 @@ void FingerprintDataLoader::OnGotPlugins(
}
void FingerprintDataLoader::OnGotGeoposition(
device::mojom::GeolocationContextPtr geolocation_context,
device::mojom::GeolocationPtr geolocation,
device::mojom::GeopositionPtr geoposition) {
DCHECK(!device::ValidateGeoposition(geoposition_));
......@@ -363,6 +355,9 @@ void FingerprintDataLoader::OnGotGeoposition(
geoposition_.error_code !=
device::mojom::Geoposition::ErrorCode::NONE);
geolocation_.reset();
geolocation_context_.reset();
MaybeFillFingerprint();
}
......
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