| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 SensorManagerAndroid::~SensorManagerAndroid() { | 53 SensorManagerAndroid::~SensorManagerAndroid() { |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool SensorManagerAndroid::Register(JNIEnv* env) { | 56 bool SensorManagerAndroid::Register(JNIEnv* env) { |
| 57 return RegisterNativesImpl(env); | 57 return RegisterNativesImpl(env); |
| 58 } | 58 } |
| 59 | 59 |
| 60 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { | 60 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { |
| 61 return Singleton<SensorManagerAndroid, | 61 return base::Singleton< |
| 62 LeakySingletonTraits<SensorManagerAndroid> >::get(); | 62 SensorManagerAndroid, |
| 63 base::LeakySingletonTraits<SensorManagerAndroid>>::get(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void SensorManagerAndroid::GotOrientation( | 66 void SensorManagerAndroid::GotOrientation( |
| 66 JNIEnv*, jobject, double alpha, double beta, double gamma) { | 67 JNIEnv*, jobject, double alpha, double beta, double gamma) { |
| 67 base::AutoLock autolock(orientation_buffer_lock_); | 68 base::AutoLock autolock(orientation_buffer_lock_); |
| 68 | 69 |
| 69 if (!device_orientation_buffer_) | 70 if (!device_orientation_buffer_) |
| 70 return; | 71 return; |
| 71 | 72 |
| 72 device_orientation_buffer_->seqlock.WriteBegin(); | 73 device_orientation_buffer_->seqlock.WriteBegin(); |
| (...skipping 371 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 |