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

Side by Side Diff: device/generic_sensor/platform_sensor_reader_win.h

Issue 2495073002: [sensors] [win] Fix ambient light not working properly Windows 10. (Closed)
Patch Set: Fix typo Created 4 years 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 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_WIN_H_ 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_WIN_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_WIN_H_ 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_WIN_H_
7 7
8 #include <SensorsApi.h> 8 #include <SensorsApi.h>
9 9
10 #include "base/win/scoped_comptr.h" 10 #include "base/win/scoped_comptr.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 private: 48 private:
49 PlatformSensorReaderWin(base::win::ScopedComPtr<ISensor> sensor, 49 PlatformSensorReaderWin(base::win::ScopedComPtr<ISensor> sensor,
50 std::unique_ptr<ReaderInitParams> params); 50 std::unique_ptr<ReaderInitParams> params);
51 51
52 static base::win::ScopedComPtr<ISensor> GetSensorForType( 52 static base::win::ScopedComPtr<ISensor> GetSensorForType(
53 REFSENSOR_TYPE_ID sensor_type, 53 REFSENSOR_TYPE_ID sensor_type,
54 base::win::ScopedComPtr<ISensorManager> sensor_manager); 54 base::win::ScopedComPtr<ISensorManager> sensor_manager);
55 55
56 bool SetReportingInterval(const PlatformSensorConfiguration& configuration); 56 bool SetReportingInterval(const PlatformSensorConfiguration& configuration);
57 void ListenSensorEvent();
57 HRESULT SensorReadingChanged(ISensorDataReport& report, 58 HRESULT SensorReadingChanged(ISensorDataReport& report,
58 SensorReading& reading) const; 59 SensorReading& reading) const;
59 void SensorError(); 60 void SensorError();
60 61
61 private: 62 private:
62 friend class EventListener; 63 friend class EventListener;
63 64
64 const std::unique_ptr<ReaderInitParams> init_params_; 65 const std::unique_ptr<ReaderInitParams> init_params_;
65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 66 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
66 // Following class members are protected by lock, because SetClient, 67 // Following class members are protected by lock, because SetClient,
67 // StartSensor and StopSensor are called from another thread by 68 // StartSensor and StopSensor are called from another thread by
68 // PlatformSensorWin that can modify internal state of the object. 69 // PlatformSensorWin that can modify internal state of the object.
69 base::Lock lock_; 70 base::Lock lock_;
70 bool sensor_active_; 71 bool sensor_active_;
71 Client* client_; 72 Client* client_;
72 base::win::ScopedComPtr<ISensor> sensor_; 73 base::win::ScopedComPtr<ISensor> sensor_;
73 scoped_refptr<EventListener> event_listener_; 74 scoped_refptr<EventListener> event_listener_;
75 base::WeakPtrFactory<PlatformSensorReaderWin> weak_factory_;
74 76
75 DISALLOW_COPY_AND_ASSIGN(PlatformSensorReaderWin); 77 DISALLOW_COPY_AND_ASSIGN(PlatformSensorReaderWin);
76 }; 78 };
77 79
78 } // namespace device 80 } // namespace device
79 81
80 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_WIN_H_ 82 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698