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

Side by Side Diff: device/generic_sensor/sensor_provider_impl.cc

Issue 2704123006: [Sensors] Clamp given sampling frequency to the minimum supported one (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 unified diff | Download patch
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 "device/generic_sensor/sensor_provider_impl.h" 5 #include "device/generic_sensor/sensor_provider_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 init_params->buffer_offset = SensorReadingSharedBuffer::GetOffset(type); 93 init_params->buffer_offset = SensorReadingSharedBuffer::GetOffset(type);
94 init_params->mode = sensor->GetReportingMode(); 94 init_params->mode = sensor->GetReportingMode();
95 init_params->default_configuration = sensor->GetDefaultConfiguration(); 95 init_params->default_configuration = sensor->GetDefaultConfiguration();
96 96
97 double maximum_frequency = sensor->GetMaximumSupportedFrequency(); 97 double maximum_frequency = sensor->GetMaximumSupportedFrequency();
98 DCHECK(maximum_frequency > 0); 98 DCHECK(maximum_frequency > 0);
99 if (maximum_frequency > mojom::SensorConfiguration::kMaxAllowedFrequency) 99 if (maximum_frequency > mojom::SensorConfiguration::kMaxAllowedFrequency)
100 maximum_frequency = mojom::SensorConfiguration::kMaxAllowedFrequency; 100 maximum_frequency = mojom::SensorConfiguration::kMaxAllowedFrequency;
101 101
102 init_params->maximum_frequency = maximum_frequency; 102 init_params->maximum_frequency = maximum_frequency;
103 init_params->minimum_frequency = sensor->GetMinimumSupportedFrequency();
104 DCHECK(init_params->minimum_frequency > 0);
Reilly Grant (use Gerrit) 2017/02/22 18:40:15 DCHECK_GT(init_params->minimum_frequency, 0); (Al
Mikhail 2017/02/23 12:42:34 Done.
103 105
104 NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(), 106 NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(),
105 callback); 107 callback);
106 108
107 mojo::MakeStrongBinding(std::move(sensor_impl), std::move(sensor_request)); 109 mojo::MakeStrongBinding(std::move(sensor_impl), std::move(sensor_request));
108 } 110 }
109 111
110 } // namespace device 112 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698