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) | |
| 42 | |
| 43 class WebDeviceMotionData { | |
| 44 public: | |
| 45 WebDeviceMotionData(); | |
| 46 ~WebDeviceMotionData() { } | |
| 47 | |
| 48 void setAccelerationX(double); | |
|
darin (slow to review)
2013/05/14 18:13:37
these methods need to be exported using the WEBKIT
timvolodine
2013/05/15 12:34:34
The presubmit check complains on this:
WEBKIT_EXPO
| |
| 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 double accelerationX() const { return m_accelerationX; } | |
| 63 double accelerationY() const { return m_accelerationY; } | |
| 64 double accelerationZ() const { return m_accelerationZ; } | |
| 65 | |
| 66 double accelerationIncludingGravityX() const { return m_accelerationIncludin gGravityX; } | |
| 67 double accelerationIncludingGravityY() const { return m_accelerationIncludin gGravityY; } | |
| 68 double accelerationIncludingGravityZ() const { return m_accelerationIncludin gGravityZ; } | |
| 69 | |
| 70 double rotationRateAlpha() const { return m_rotationRateAlpha; } | |
| 71 double rotationRateBeta() const { return m_rotationRateBeta; } | |
| 72 double rotationRateGamma() const { return m_rotationRateGamma; } | |
| 73 | |
| 74 double interval() const { return m_interval; } | |
| 75 | |
| 76 double hasAccelerationX() const { return m_hasAccelerationX; } | |
| 77 double hasAccelerationY() const { return m_hasAccelerationY; } | |
| 78 double hasAccelerationZ() const { return m_hasAccelerationZ; } | |
| 79 | |
| 80 double hasAccelerationIncludingGravityX() const { return m_hasAccelerationIn cludingGravityX; } | |
| 81 double hasAccelerationIncludingGravityY() const { return m_hasAccelerationIn cludingGravityY; } | |
| 82 double hasAccelerationIncludingGravityZ() const { return m_hasAccelerationIn cludingGravityZ; } | |
| 83 | |
| 84 double hasRotationRateAlpha() const { return m_hasRotationRateAlpha; } | |
| 85 double hasRotationRateBeta() const { return m_hasRotationRateBeta; } | |
| 86 double hasRotationRateGamma() const { return m_hasRotationRateGamma; } | |
| 87 | |
| 88 #if WEBKIT_IMPLEMENTATION | |
| 89 operator WTF::PassRefPtr<WebCore::DeviceMotionData>() const; | |
| 90 #endif | |
| 91 | |
| 92 private: | |
| 93 double m_accelerationX; | |
|
darin (slow to review)
2013/05/14 18:13:37
why isn't WebDeviceMotionData just a simple ref-co
timvolodine
2013/05/15 12:34:34
hmm, looks like a nice construction indeed, howeve
| |
| 94 double m_accelerationY; | |
| 95 double m_accelerationZ; | |
| 96 | |
| 97 double m_accelerationIncludingGravityX; | |
| 98 double m_accelerationIncludingGravityY; | |
| 99 double m_accelerationIncludingGravityZ; | |
| 100 | |
| 101 double m_rotationRateAlpha; | |
| 102 double m_rotationRateBeta; | |
| 103 double m_rotationRateGamma; | |
| 104 | |
| 105 double m_interval; | |
| 106 | |
| 107 bool m_hasAccelerationX : 1; | |
| 108 bool m_hasAccelerationY : 1; | |
| 109 bool m_hasAccelerationZ : 1; | |
| 110 | |
| 111 bool m_hasAccelerationIncludingGravityX : 1; | |
| 112 bool m_hasAccelerationIncludingGravityY : 1; | |
| 113 bool m_hasAccelerationIncludingGravityZ : 1; | |
| 114 | |
| 115 bool m_hasRotationRateAlpha : 1; | |
| 116 bool m_hasRotationRateBeta : 1; | |
| 117 bool m_hasRotationRateGamma : 1; | |
| 118 }; | |
| 119 | |
| 120 #if WEBKIT_IMPLEMENTATION | |
| 121 COMPILE_ASSERT(sizeof(WebDeviceMotionData) == (10 * sizeof(double) + 2 * sizeof( char)), WebDeviceMotionData_has_wrong_size); | |
| 122 #endif | |
| 123 | |
| 124 #pragma pack(pop) | |
| 125 | |
| 126 } // namespace WebKit | |
| 127 | |
| 128 #endif // WebDeviceMotionData_h | |
| OLD | NEW |