Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: blimp/client/core/geolocation/geolocation_feature.cc

Issue 2331513002: Checks to see if the position is valid before OnLocationUpdate call. (Closed)
Patch Set: Fixes up tests. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | blimp/client/core/geolocation/geolocation_feature_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | blimp/client/core/geolocation/geolocation_feature_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698