Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebDeviceMotionData_h | |
| 32 #define WebDeviceMotionData_h | |
| 33 | |
| 34 #if WEBKIT_IMPLEMENTATION | |
| 35 namespace WTF { template <typename T> class PassRefPtr; } | |
| 36 namespace WebCore { class DeviceMotionData; } | |
| 37 #endif | |
| 38 | |
| 39 namespace WebKit { | |
| 40 | |
| 41 #pragma pack(push, 1) | |
|
Peter Beverloo
2013/04/29 17:38:03
Is this class really that important from a memory
timvolodine
2013/04/30 12:40:18
It's probably not very important, but this results
| |
| 42 | |
| 43 class WebDeviceMotionData { | |
| 44 public: | |
| 45 WebDeviceMotionData(); | |
| 46 ~WebDeviceMotionData() { } | |
| 47 | |
| 48 void setAccelerationX(double); | |
| 49 void setAccelerationY(double); | |
| 50 void setAccelerationZ(double); | |
| 51 | |
| 52 void setAccelerationIncludingGravityX(double); | |
| 53 void setAccelerationIncludingGravityY(double); | |
| 54 void setAccelerationIncludingGravityZ(double); | |
| 55 | |
| 56 void setRotationRateAlpha(double); | |
| 57 void setRotationRateBeta(double); | |
| 58 void setRotationRateGamma(double); | |
| 59 | |
| 60 void setInterval(double); | |
| 61 | |
| 62 #if WEBKIT_IMPLEMENTATION | |
| 63 operator WTF::PassRefPtr<WebCore::DeviceMotionData>() const; | |
| 64 #endif | |
| 65 | |
| 66 private: | |
| 67 double m_accelerationX; | |
| 68 double m_accelerationY; | |
| 69 double m_accelerationZ; | |
| 70 | |
| 71 double m_accelerationIncludingGravityX; | |
| 72 double m_accelerationIncludingGravityY; | |
| 73 double m_accelerationIncludingGravityZ; | |
| 74 | |
| 75 double m_rotationRateAlpha; | |
| 76 double m_rotationRateBeta; | |
| 77 double m_rotationRateGamma; | |
| 78 | |
| 79 double m_interval; | |
| 80 | |
| 81 char m_hasAccelerationX : 1; | |
| 82 char m_hasAccelerationY : 1; | |
| 83 char m_hasAccelerationZ : 1; | |
| 84 | |
| 85 char m_hasAccelerationIncludingGravityX : 1; | |
| 86 char m_hasAccelerationIncludingGravityY : 1; | |
| 87 char m_hasAccelerationIncludingGravityZ : 1; | |
| 88 | |
| 89 char m_hasRotationRateAlpha : 1; | |
| 90 char m_hasRotationRateBeta : 1; | |
| 91 char m_hasRotationRateGamma : 1; | |
| 92 }; | |
| 93 | |
| 94 #if WEBKIT_IMPLEMENTATION | |
| 95 COMPILE_ASSERT(sizeof(WebDeviceMotionData) == (10*8 + 2), WebDeviceMotionData_ha s_wrong_size); | |
| 96 #endif | |
| 97 | |
| 98 #pragma pack(pop) | |
| 99 | |
| 100 } // namespace WebKit | |
| 101 | |
| 102 #endif // WebDeviceMotionData_h | |
| OLD | NEW |