| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/device_sensors/device_inertial_sensor_service.h" | 5 #include "content/browser/device_sensors/device_inertial_sensor_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" | 10 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 base::SharedMemoryHandle | 81 base::SharedMemoryHandle |
| 82 DeviceInertialSensorService::GetSharedMemoryHandleForProcess( | 82 DeviceInertialSensorService::GetSharedMemoryHandleForProcess( |
| 83 ConsumerType consumer_type, base::ProcessHandle handle) { | 83 ConsumerType consumer_type, base::ProcessHandle handle) { |
| 84 DCHECK(thread_checker_.CalledOnValidThread()); | 84 DCHECK(thread_checker_.CalledOnValidThread()); |
| 85 return data_fetcher_->GetSharedMemoryHandleForProcess(consumer_type, handle); | 85 return data_fetcher_->GetSharedMemoryHandleForProcess(consumer_type, handle); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void DeviceInertialSensorService::Shutdown() { | 88 void DeviceInertialSensorService::Shutdown() { |
| 89 data_fetcher_.reset(); | 89 if (data_fetcher_) { |
| 90 data_fetcher_->StopFetchingAllDeviceData(); |
| 91 data_fetcher_.reset(); |
| 92 } |
| 90 is_shutdown_ = true; | 93 is_shutdown_ = true; |
| 91 } | 94 } |
| 92 | 95 |
| 93 void DeviceInertialSensorService::SetDataFetcherForTesting( | 96 void DeviceInertialSensorService::SetDataFetcherForTesting( |
| 94 DataFetcherSharedMemory* test_data_fetcher) { | 97 DataFetcherSharedMemory* test_data_fetcher) { |
| 98 if (data_fetcher_) |
| 99 data_fetcher_->StopFetchingAllDeviceData(); |
| 95 data_fetcher_.reset(test_data_fetcher); | 100 data_fetcher_.reset(test_data_fetcher); |
| 96 } | 101 } |
| 97 | 102 |
| 98 } // namespace content | 103 } // namespace content |
| OLD | NEW |