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

Unified Diff: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js

Issue 2395853003: [Sensors] Improvements in shared buffer managing (Closed)
Patch Set: Test compilation fix + comment from Ken Created 4 years, 2 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
Index: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
diff --git a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
index f9099600d5c9fe7b12d6b614d82d9cff3ef2d33b..4252de322b03d5a9cde97d13b5442a8196a44a5e 100644
--- a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
+++ b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
@@ -33,6 +33,7 @@ function sensor_mocks(mojo) {
assert_equals(rv.result, core.RESULT_OK, "Failed to map shared buffer");
this.buffer_array_ = rv.buffer;
this.buffer_ = new Float64Array(this.buffer_array_);
+ this.resetBuffer();
bindings.StubBindings(this.stub_).delegate = this;
bindings.StubBindings(this.stub_).connectionErrorHandler = () => {
reset();
@@ -120,6 +121,11 @@ function sensor_mocks(mojo) {
this.resume_called_ = null;
this.add_configuration_called_ = null;
this.remove_configuration_called_ = null;
+ this.resetBuffer();
+ }
+
+ // Zeroes shared buffer.
+ resetBuffer() {
for (let i = 0; i < this.buffer_.length; ++i) {
this.buffer_[i] = 0;
}
@@ -176,7 +182,7 @@ function sensor_mocks(mojo) {
class MockSensorProvider {
constructor() {
this.reading_size_in_bytes_ =
- sensor_provider.SensorInitParams.kReadBufferSize;
+ sensor_provider.SensorInitParams.kReadBufferSizeForTests;
this.shared_buffer_size_in_bytes_ = this.reading_size_in_bytes_ *
sensor.SensorType.LAST;
let rv =

Powered by Google App Engine
This is Rietveld 408576698