| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 addController(controller); | 57 addController(controller); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void DeviceMotionDispatcher::removeDeviceMotionController(DeviceMotionController
* controller) | 60 void DeviceMotionDispatcher::removeDeviceMotionController(DeviceMotionController
* controller) |
| 61 { | 61 { |
| 62 removeController(controller); | 62 removeController(controller); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DeviceMotionDispatcher::startListening() | 65 void DeviceMotionDispatcher::startListening() |
| 66 { | 66 { |
| 67 WebKit::Platform::current()->setDeviceMotionListener(this); | 67 blink::Platform::current()->setDeviceMotionListener(this); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void DeviceMotionDispatcher::stopListening() | 70 void DeviceMotionDispatcher::stopListening() |
| 71 { | 71 { |
| 72 WebKit::Platform::current()->setDeviceMotionListener(0); | 72 blink::Platform::current()->setDeviceMotionListener(0); |
| 73 m_lastDeviceMotionData.clear(); | 73 m_lastDeviceMotionData.clear(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void DeviceMotionDispatcher::didChangeDeviceMotion(const WebKit::WebDeviceMotion
Data& motion) | 76 void DeviceMotionDispatcher::didChangeDeviceMotion(const blink::WebDeviceMotionD
ata& motion) |
| 77 { | 77 { |
| 78 m_lastDeviceMotionData = DeviceMotionData::create(motion); | 78 m_lastDeviceMotionData = DeviceMotionData::create(motion); |
| 79 | 79 |
| 80 { | 80 { |
| 81 TemporaryChange<bool> changeIsDispatching(m_isDispatching, true); | 81 TemporaryChange<bool> changeIsDispatching(m_isDispatching, true); |
| 82 // Don't fire controllers removed or added during event dispatch. | 82 // Don't fire controllers removed or added during event dispatch. |
| 83 size_t size = m_controllers.size(); | 83 size_t size = m_controllers.size(); |
| 84 for (size_t i = 0; i < size; ++i) { | 84 for (size_t i = 0; i < size; ++i) { |
| 85 if (m_controllers[i]) | 85 if (m_controllers[i]) |
| 86 static_cast<DeviceMotionController*>(m_controllers[i])->didChang
eDeviceMotion(m_lastDeviceMotionData.get()); | 86 static_cast<DeviceMotionController*>(m_controllers[i])->didChang
eDeviceMotion(m_lastDeviceMotionData.get()); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 if (m_needsPurge) | 90 if (m_needsPurge) |
| 91 purgeControllers(); | 91 purgeControllers(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 DeviceMotionData* DeviceMotionDispatcher::latestDeviceMotionData() | 94 DeviceMotionData* DeviceMotionDispatcher::latestDeviceMotionData() |
| 95 { | 95 { |
| 96 return m_lastDeviceMotionData.get(); | 96 return m_lastDeviceMotionData.get(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace WebCore | 99 } // namespace WebCore |
| OLD | NEW |