| 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/sensor_manager_android.h" | 5 #include "content/browser/device_sensors/sensor_manager_android.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 SensorManagerAndroid::~SensorManagerAndroid() { | 55 SensorManagerAndroid::~SensorManagerAndroid() { |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool SensorManagerAndroid::Register(JNIEnv* env) { | 58 bool SensorManagerAndroid::Register(JNIEnv* env) { |
| 59 return RegisterNativesImpl(env); | 59 return RegisterNativesImpl(env); |
| 60 } | 60 } |
| 61 | 61 |
| 62 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { | 62 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { |
| 63 return Singleton<SensorManagerAndroid, | 63 return base::Singleton< |
| 64 LeakySingletonTraits<SensorManagerAndroid> >::get(); | 64 SensorManagerAndroid, |
| 65 base::LeakySingletonTraits<SensorManagerAndroid>>::get(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void SensorManagerAndroid::GotOrientation( | 68 void SensorManagerAndroid::GotOrientation( |
| 68 JNIEnv*, jobject, double alpha, double beta, double gamma) { | 69 JNIEnv*, jobject, double alpha, double beta, double gamma) { |
| 69 base::AutoLock autolock(orientation_buffer_lock_); | 70 base::AutoLock autolock(orientation_buffer_lock_); |
| 70 | 71 |
| 71 if (!device_orientation_buffer_) | 72 if (!device_orientation_buffer_) |
| 72 return; | 73 return; |
| 73 | 74 |
| 74 device_orientation_buffer_->seqlock.WriteBegin(); | 75 device_orientation_buffer_->seqlock.WriteBegin(); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 445 } |
| 445 } | 446 } |
| 446 } | 447 } |
| 447 | 448 |
| 448 void SensorManagerAndroid::Shutdown() { | 449 void SensorManagerAndroid::Shutdown() { |
| 449 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 450 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 450 is_shutdown_ = true; | 451 is_shutdown_ = true; |
| 451 } | 452 } |
| 452 | 453 |
| 453 } // namespace content | 454 } // namespace content |
| OLD | NEW |