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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/SensorProxy.cpp

Issue 2839963004: [Sensors] Error handler in Senor class should stop the platform sensor (Closed)
Patch Set: fix test failures Created 3 years, 7 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 | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | no next file » | 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 "modules/sensor/SensorProxy.h" 5 #include "modules/sensor/SensorProxy.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "modules/sensor/SensorProviderProxy.h" 9 #include "modules/sensor/SensorProviderProxy.h"
10 #include "modules/sensor/SensorReadingUpdater.h" 10 #include "modules/sensor/SensorReadingUpdater.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 reading_ = device::SensorReading(); 171 reading_ = device::SensorReading();
172 172
173 // The m_sensor.reset() will release all callbacks and its bound parameters, 173 // The m_sensor.reset() will release all callbacks and its bound parameters,
174 // therefore, handleSensorError accepts messages by value. 174 // therefore, handleSensorError accepts messages by value.
175 sensor_.reset(); 175 sensor_.reset();
176 shared_buffer_.reset(); 176 shared_buffer_.reset();
177 shared_buffer_handle_.reset(); 177 shared_buffer_handle_.reset();
178 default_config_.reset(); 178 default_config_.reset();
179 client_binding_.Close(); 179 client_binding_.Close();
180 180
181 for (Observer* observer : observers_) { 181 auto copy = observers_;
182 for (Observer* observer : copy) {
182 observer->OnSensorError(kNotReadableError, "Could not connect to a sensor", 183 observer->OnSensorError(kNotReadableError, "Could not connect to a sensor",
183 String()); 184 String());
184 } 185 }
185 } 186 }
186 187
187 void SensorProxy::OnSensorCreated(SensorInitParamsPtr params, 188 void SensorProxy::OnSensorCreated(SensorInitParamsPtr params,
188 SensorClientRequest client_request) { 189 SensorClientRequest client_request) {
189 DCHECK_EQ(kInitializing, state_); 190 DCHECK_EQ(kInitializing, state_);
190 if (!params) { 191 if (!params) {
191 HandleSensorError(); 192 HandleSensorError();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value(); 272 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value();
272 auto version = seqlock.ReadBegin(); 273 auto version = seqlock.ReadBegin();
273 auto reading_data = buffer->reading; 274 auto reading_data = buffer->reading;
274 if (seqlock.ReadRetry(version)) 275 if (seqlock.ReadRetry(version))
275 return false; 276 return false;
276 result = reading_data; 277 result = reading_data;
277 return true; 278 return true;
278 } 279 }
279 280
280 } // namespace blink 281 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698