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/data_fetcher_impl_android.h" | 5 #include "content/browser/device_orientation/data_fetcher_impl_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/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (!is_motion_buffer_ready_) { | 121 if (!is_motion_buffer_ready_) { |
122 received_motion_data_[RECEIVED_MOTION_DATA_ROTATION_RATE] = 1; | 122 received_motion_data_[RECEIVED_MOTION_DATA_ROTATION_RATE] = 1; |
123 CheckMotionBufferReadyToRead(); | 123 CheckMotionBufferReadyToRead(); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 bool DataFetcherImplAndroid::Start(DeviceData::Type event_type) { | 127 bool DataFetcherImplAndroid::Start(DeviceData::Type event_type) { |
128 DCHECK(!device_orientation_.is_null()); | 128 DCHECK(!device_orientation_.is_null()); |
129 return Java_DeviceMotionAndOrientation_start( | 129 return Java_DeviceMotionAndOrientation_start( |
130 AttachCurrentThread(), device_orientation_.obj(), | 130 AttachCurrentThread(), device_orientation_.obj(), |
131 reinterpret_cast<jint>(this), static_cast<jint>(event_type), | 131 reinterpret_cast<intptr_t>(this), static_cast<jint>(event_type), |
132 kInertialSensorIntervalMillis); | 132 kInertialSensorIntervalMillis); |
133 } | 133 } |
134 | 134 |
135 void DataFetcherImplAndroid::Stop(DeviceData::Type event_type) { | 135 void DataFetcherImplAndroid::Stop(DeviceData::Type event_type) { |
136 DCHECK(!device_orientation_.is_null()); | 136 DCHECK(!device_orientation_.is_null()); |
137 Java_DeviceMotionAndOrientation_stop( | 137 Java_DeviceMotionAndOrientation_stop( |
138 AttachCurrentThread(), device_orientation_.obj(), | 138 AttachCurrentThread(), device_orientation_.obj(), |
139 static_cast<jint>(event_type)); | 139 static_cast<jint>(event_type)); |
140 } | 140 } |
141 | 141 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 { | 241 { |
242 base::AutoLock autolock(orientation_buffer_lock_); | 242 base::AutoLock autolock(orientation_buffer_lock_); |
243 if (device_orientation_buffer_) { | 243 if (device_orientation_buffer_) { |
244 SetOrientationBufferReadyStatus(false); | 244 SetOrientationBufferReadyStatus(false); |
245 device_orientation_buffer_ = NULL; | 245 device_orientation_buffer_ = NULL; |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 } // namespace content | 250 } // namespace content |
OLD | NEW |