#include "third_party/blink/renderer/modules/sensor/sensor.h"
#include <utility>
#include "base/ranges/algorithm.h"
#include "services/device/public/cpp/generic_sensor/sensor_traits.h"
#include "services/device/public/mojom/sensor.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/timing/dom_window_performance.h"
#include "third_party/blink/renderer/core/timing/window_performance.h"
#include "third_party/blink/renderer/modules/sensor/sensor_error_event.h"
#include "third_party/blink/renderer/modules/sensor/sensor_provider_proxy.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
namespace blink {
namespace {
const double kWaitingIntervalThreshold = …;
bool AreFeaturesEnabled(
ExecutionContext* context,
const Vector<mojom::blink::PermissionsPolicyFeature>& features) { … }
}
Sensor::Sensor(ExecutionContext* execution_context,
const SensorOptions* sensor_options,
ExceptionState& exception_state,
device::mojom::blink::SensorType type,
const Vector<mojom::blink::PermissionsPolicyFeature>& features)
: … { … }
Sensor::Sensor(ExecutionContext* execution_context,
const SpatialSensorOptions* options,
ExceptionState& exception_state,
device::mojom::blink::SensorType sensor_type,
const Vector<mojom::blink::PermissionsPolicyFeature>& features)
: … { … }
Sensor::~Sensor() = default;
void Sensor::start() { … }
void Sensor::stop() { … }
bool Sensor::activated() const { … }
bool Sensor::hasReading() const { … }
std::optional<DOMHighResTimeStamp> Sensor::timestamp(
ScriptState* script_state) const { … }
void Sensor::Trace(Visitor* visitor) const { … }
bool Sensor::HasPendingActivity() const { … }
auto Sensor::CreateSensorConfig() -> SensorConfigurationPtr { … }
void Sensor::InitSensorProxyIfNeeded() { … }
void Sensor::ContextDestroyed() { … }
void Sensor::OnSensorInitialized() { … }
void Sensor::OnSensorReadingChanged() { … }
void Sensor::OnSensorError(DOMExceptionCode code,
const String& sanitized_message,
const String& unsanitized_message) { … }
void Sensor::OnAddConfigurationRequestCompleted(bool result) { … }
void Sensor::Activate() { … }
void Sensor::Deactivate() { … }
void Sensor::RequestAddConfiguration() { … }
void Sensor::HandleError(DOMExceptionCode code,
const String& sanitized_message,
const String& unsanitized_message) { … }
void Sensor::NotifyReading() { … }
void Sensor::NotifyActivated() { … }
void Sensor::NotifyError(DOMException* error) { … }
bool Sensor::IsIdleOrErrored() const { … }
const device::SensorReading& Sensor::GetReading() const { … }
}