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

Unified Diff: device/sensors/device_sensor_service.h

Issue 2730333002: Make DeviceSensorService implement MainLoop::DestructionObserver (Closed)
Patch Set: code rebase Created 3 years, 9 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 | « content/browser/browser_main_loop.cc ('k') | device/sensors/device_sensor_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/sensors/device_sensor_service.h
diff --git a/device/sensors/device_sensor_service.h b/device/sensors/device_sensor_service.h
index 17ae9f82a00473fd800018b29ab2de1ab5e338ea..413d85880f6f75f3ea39b97da6b05ed871f52a17 100644
--- a/device/sensors/device_sensor_service.h
+++ b/device/sensors/device_sensor_service.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/memory/shared_memory.h"
#include "base/memory/singleton.h"
+#include "base/message_loop/message_loop.h"
#include "base/threading/thread_checker.h"
#include "device/sensors/device_sensor_export.h"
#include "device/sensors/device_sensors_consts.h"
@@ -23,7 +24,8 @@ class DataFetcherSharedMemory;
// Owns the data fetcher for Device Motion and Orientation and keeps track of
// the number of consumers currently using the data. The data fetcher is stopped
// when there are no consumers.
-class DEVICE_SENSOR_EXPORT DeviceSensorService {
+class DEVICE_SENSOR_EXPORT DeviceSensorService
+ : public base::MessageLoop::DestructionObserver {
public:
// Returns the DeviceSensorService singleton.
static DeviceSensorService* GetInstance();
@@ -41,6 +43,9 @@ class DEVICE_SENSOR_EXPORT DeviceSensorService {
mojo::ScopedSharedBufferHandle GetSharedMemoryHandle(
ConsumerType consumer_type);
+ // base::MessageLoop::DestructionObserver:
+ void WillDestroyCurrentMessageLoop() override;
+
// Stop/join with the background polling thread in |provider_|.
void Shutdown();
@@ -52,7 +57,7 @@ class DEVICE_SENSOR_EXPORT DeviceSensorService {
friend struct base::DefaultSingletonTraits<DeviceSensorService>;
DeviceSensorService();
- virtual ~DeviceSensorService();
+ ~DeviceSensorService() override;
bool ChangeNumberConsumers(ConsumerType consumer_type, int delta);
int GetNumberConsumers(ConsumerType consumer_type) const;
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | device/sensors/device_sensor_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698