| 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_light_message_filter.h" | 5 #include "content/browser/device_sensors/device_light_message_filter.h" |
| 6 | 6 |
| 7 #include "content/browser/device_sensors/device_inertial_sensor_service.h" | 7 #include "content/browser/device_sensors/device_inertial_sensor_service.h" |
| 8 #include "content/common/device_sensors/device_light_messages.h" | 8 #include "content/common/device_sensors/device_light_messages.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 DeviceLightMessageFilter::DeviceLightMessageFilter() | 12 DeviceLightMessageFilter::DeviceLightMessageFilter() |
| 13 : BrowserMessageFilter(DeviceLightMsgStart), is_started_(false) { | 13 : BrowserMessageFilter(DeviceLightMsgStart), is_started_(false) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 DeviceLightMessageFilter::~DeviceLightMessageFilter() { | 16 DeviceLightMessageFilter::~DeviceLightMessageFilter() { |
| 17 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 17 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 18 if (is_started_) { | 18 if (is_started_) { |
| 19 DeviceInertialSensorService::GetInstance()->RemoveConsumer( | 19 DeviceInertialSensorService::GetInstance()->RemoveConsumer( |
| 20 CONSUMER_TYPE_LIGHT); | 20 CONSUMER_TYPE_LIGHT); |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool DeviceLightMessageFilter::OnMessageReceived(const IPC::Message& message) { | 24 bool DeviceLightMessageFilter::OnMessageReceived(const IPC::Message& message) { |
| 25 bool handled = true; | 25 bool handled = true; |
| 26 IPC_BEGIN_MESSAGE_MAP(DeviceLightMessageFilter, message) | 26 IPC_BEGIN_MESSAGE_MAP(DeviceLightMessageFilter, message) |
| 27 IPC_MESSAGE_HANDLER(DeviceLightHostMsg_StartPolling, | 27 IPC_MESSAGE_HANDLER(DeviceLightHostMsg_StartPolling, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 void DeviceLightMessageFilter::DidStartDeviceLightPolling() { | 53 void DeviceLightMessageFilter::DidStartDeviceLightPolling() { |
| 54 Send(new DeviceLightMsg_DidStartPolling( | 54 Send(new DeviceLightMsg_DidStartPolling( |
| 55 DeviceInertialSensorService::GetInstance() | 55 DeviceInertialSensorService::GetInstance() |
| 56 ->GetSharedMemoryHandleForProcess(CONSUMER_TYPE_LIGHT, | 56 ->GetSharedMemoryHandleForProcess(CONSUMER_TYPE_LIGHT, |
| 57 PeerHandle()))); | 57 PeerHandle()))); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace content | 60 } // namespace content |
| OLD | NEW |