Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/client/core/geolocation/geolocation_feature.h" | 5 #include "blimp/client/core/geolocation/geolocation_feature.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 error->set_error_message(error_message); | 136 error->set_error_message(error_message); |
| 137 | 137 |
| 138 am_sending_message_ = true; | 138 am_sending_message_ = true; |
| 139 outgoing_message_processor_->ProcessMessage( | 139 outgoing_message_processor_->ProcessMessage( |
| 140 std::move(blimp_message), | 140 std::move(blimp_message), |
| 141 base::Bind(&GeolocationFeature::OnSendComplete, base::Unretained(this))); | 141 base::Bind(&GeolocationFeature::OnSendComplete, base::Unretained(this))); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void GeolocationFeature::OnSendComplete(int result) { | 144 void GeolocationFeature::OnSendComplete(int result) { |
| 145 am_sending_message_ = false; | 145 am_sending_message_ = false; |
| 146 if (need_to_send_message_) { | 146 device::Geoposition new_position = location_provider_->GetPosition(); |
| 147 need_to_send_message_ = false; | 147 if (need_to_send_message_ && new_position.Validate()) { |
|
Wez
2016/09/13 20:26:08
Hmmm, actually isn't Validate() a proxy for whethe
CJ
2016/09/13 22:45:22
It has to be this way because even if the Location
Wez
2016/09/16 01:20:27
But will we see an OnSendComplete() in that case?
CJ
2016/09/16 18:27:12
There's that race case. A Stop message gets receiv
| |
| 148 OnLocationUpdate(location_provider_.get(), | 148 OnLocationUpdate(location_provider_.get(), new_position); |
| 149 location_provider_->GetPosition()); | |
| 150 } | 149 } |
| 150 need_to_send_message_ = false; | |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace client | 153 } // namespace client |
| 154 } // namespace blimp | 154 } // namespace blimp |
| OLD | NEW |