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

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorProxy.cpp

Issue 2699673002: [Sensors] Fix error type and message used (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorProxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
index 53c7e9f3597fae81ededb1a03cacf3b82841a112..fcd98ff757cd662ff18edcace9746fd44faae38a 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
@@ -162,9 +162,7 @@ void SensorProxy::pageVisibilityChanged() {
}
}
-void SensorProxy::handleSensorError(ExceptionCode code,
- String sanitizedMessage,
- String unsanitizedMessage) {
+void SensorProxy::handleSensorError() {
m_state = Uninitialized;
m_frequenciesUsed.clear();
m_reading = device::SensorReading();
@@ -177,16 +175,17 @@ void SensorProxy::handleSensorError(ExceptionCode code,
m_defaultConfig.reset();
m_clientBinding.Close();
- for (Observer* observer : m_observers)
- observer->onSensorError(code, sanitizedMessage, unsanitizedMessage);
+ for (Observer* observer : m_observers) {
+ observer->onSensorError(NotReadableError, "Could not connect to a sensor",
+ String());
+ }
}
void SensorProxy::onSensorCreated(SensorInitParamsPtr params,
SensorClientRequest clientRequest) {
DCHECK_EQ(Initializing, m_state);
if (!params) {
- handleSensorError(NotReadableError,
- "Sensor is not present on the platform.");
+ handleSensorError();
return;
}
const size_t kReadBufferSize = sizeof(ReadingBuffer);
@@ -217,8 +216,7 @@ void SensorProxy::onSensorCreated(SensorInitParamsPtr params,
DCHECK(m_maximumFrequency <= SensorConfiguration::kMaxAllowedFrequency);
auto errorCallback =
- WTF::bind(&SensorProxy::handleSensorError, wrapWeakPersistent(this),
- UnknownError, String("Internal error"), String());
+ WTF::bind(&SensorProxy::handleSensorError, wrapWeakPersistent(this));
m_sensor.set_connection_error_handler(
convertToBaseCallback(std::move(errorCallback)));
« 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