| 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 "device/sensors/sensor_manager_android.h" | 5 #include "device/sensors/sensor_manager_android.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 SensorManagerAndroid::SensorManagerAndroid() | 56 SensorManagerAndroid::SensorManagerAndroid() |
| 57 : number_active_device_motion_sensors_(0), | 57 : number_active_device_motion_sensors_(0), |
| 58 device_motion_buffer_(nullptr), | 58 device_motion_buffer_(nullptr), |
| 59 device_orientation_buffer_(nullptr), | 59 device_orientation_buffer_(nullptr), |
| 60 motion_buffer_initialized_(false), | 60 motion_buffer_initialized_(false), |
| 61 orientation_buffer_initialized_(false), | 61 orientation_buffer_initialized_(false), |
| 62 is_shutdown_(false) { | 62 is_shutdown_(false) { |
| 63 DCHECK(thread_checker_.CalledOnValidThread()); | 63 DCHECK(thread_checker_.CalledOnValidThread()); |
| 64 memset(received_motion_data_, 0, sizeof(received_motion_data_)); | 64 memset(received_motion_data_, 0, sizeof(received_motion_data_)); |
| 65 device_sensors_.Reset(Java_DeviceSensors_getInstance( | 65 device_sensors_.Reset(Java_DeviceSensors_create( |
| 66 AttachCurrentThread(), base::android::GetApplicationContext())); | 66 AttachCurrentThread(), base::android::GetApplicationContext())); |
| 67 } | 67 } |
| 68 | 68 |
| 69 SensorManagerAndroid::~SensorManagerAndroid() {} | 69 SensorManagerAndroid::~SensorManagerAndroid() {} |
| 70 | 70 |
| 71 bool SensorManagerAndroid::Register(JNIEnv* env) { | 71 bool SensorManagerAndroid::Register(JNIEnv* env) { |
| 72 return RegisterNativesImpl(env); | 72 return RegisterNativesImpl(env); |
| 73 } | 73 } |
| 74 | 74 |
| 75 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { | 75 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 void SensorManagerAndroid::Shutdown() { | 394 void SensorManagerAndroid::Shutdown() { |
| 395 DCHECK(thread_checker_.CalledOnValidThread()); | 395 DCHECK(thread_checker_.CalledOnValidThread()); |
| 396 is_shutdown_ = true; | 396 is_shutdown_ = true; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace device | 399 } // namespace device |
| OLD | NEW |