| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_orientation/accelerometer_mac.h" | 5 #include "content/browser/device_orientation/accelerometer_mac.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/device_orientation/orientation.h" | 10 #include "content/browser/device_orientation/orientation.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 static double just_less_than_90 = nextafter(90, 0); | 86 static double just_less_than_90 = nextafter(90, 0); |
| 87 orientation->set_gamma(just_less_than_90); | 87 orientation->set_gamma(just_less_than_90); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // At this point, DCHECKing is paranoia. Never hurts. | 90 // At this point, DCHECKing is paranoia. Never hurts. |
| 91 DCHECK_GE(orientation->beta(), -180.0); | 91 DCHECK_GE(orientation->beta(), -180.0); |
| 92 DCHECK_LT(orientation->beta(), 180.0); | 92 DCHECK_LT(orientation->beta(), 180.0); |
| 93 DCHECK_GE(orientation->gamma(), -90.0); | 93 DCHECK_GE(orientation->gamma(), -90.0); |
| 94 DCHECK_LT(orientation->gamma(), 90.0); | 94 DCHECK_LT(orientation->gamma(), 90.0); |
| 95 | 95 |
| 96 return orientation.release(); | 96 orientation->AddRef(); |
| 97 return orientation.get(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 bool AccelerometerMac::Init() { | 100 bool AccelerometerMac::Init() { |
| 100 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); | 101 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); |
| 101 return sudden_motion_sensor_.get() != NULL; | 102 return sudden_motion_sensor_.get() != NULL; |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace content | 105 } // namespace content |
| OLD | NEW |