Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: device/sensors/sensor_manager_android.cc

Issue 2860633003: Remove redundant static singleton for DeviceSensors (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698