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

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

Issue 2471103002: [sensors] Close mock sensor stubs after test is finished (Closed)
Patch Set: Fix for comment from Mikhail Created 4 years, 1 month 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/SensorProxy.h ('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/frame/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "modules/sensor/SensorProviderProxy.h" 8 #include "modules/sensor/SensorProviderProxy.h"
9 #include "platform/mojo/MojoHelper.h" 9 #include "platform/mojo/MojoHelper.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void SensorProxy::RaiseError() { 113 void SensorProxy::RaiseError() {
114 handleSensorError(); 114 handleSensorError();
115 } 115 }
116 116
117 void SensorProxy::SensorReadingChanged() { 117 void SensorProxy::SensorReadingChanged() {
118 for (Observer* observer : m_observers) 118 for (Observer* observer : m_observers)
119 observer->onSensorReadingChanged(); 119 observer->onSensorReadingChanged();
120 } 120 }
121 121
122 void SensorProxy::handleSensorError(ExceptionCode code, 122 void SensorProxy::handleSensorError(ExceptionCode code,
123 const String& sanitizedMessage, 123 String sanitizedMessage,
124 const String& unsanitizedMessage) { 124 String unsanitizedMessage) {
125 if (!Platform::current()) { 125 if (!Platform::current()) {
126 // TODO(rockot): Remove this hack once renderer shutdown sequence is fixed. 126 // TODO(rockot): Remove this hack once renderer shutdown sequence is fixed.
127 return; 127 return;
128 } 128 }
129
129 m_state = Uninitialized; 130 m_state = Uninitialized;
131 // The m_sensor.reset() will release all callbacks and its bound parameters,
132 // therefore, handleSensorError accepts messages by value.
130 m_sensor.reset(); 133 m_sensor.reset();
131 m_sharedBuffer.reset(); 134 m_sharedBuffer.reset();
132 m_sharedBufferHandle.reset(); 135 m_sharedBufferHandle.reset();
133 m_defaultConfig.reset(); 136 m_defaultConfig.reset();
134 m_clientBinding.Close(); 137 m_clientBinding.Close();
135 138
136 for (Observer* observer : m_observers) 139 for (Observer* observer : m_observers)
137 observer->onSensorError(code, sanitizedMessage, unsanitizedMessage); 140 observer->onSensorError(code, sanitizedMessage, unsanitizedMessage);
138 } 141 }
139 142
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value(); 189 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value();
187 auto version = seqlock.ReadBegin(); 190 auto version = seqlock.ReadBegin();
188 auto reading = buffer->reading; 191 auto reading = buffer->reading;
189 if (seqlock.ReadRetry(version)) 192 if (seqlock.ReadRetry(version))
190 return false; 193 return false;
191 m_reading = reading; 194 m_reading = reading;
192 return true; 195 return true;
193 } 196 }
194 197
195 } // namespace blink 198 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698