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

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

Issue 2847523002: Android: Remove GetApplicationContext part 4 (Closed)
Patch Set: Rebase and fix build 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
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"
10 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
11 #include "base/bind.h" 10 #include "base/bind.h"
12 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
13 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
15 #include "jni/DeviceSensors_jni.h" 14 #include "jni/DeviceSensors_jni.h"
16 15
17 using base::android::AttachCurrentThread; 16 using base::android::AttachCurrentThread;
18 using base::android::JavaParamRef; 17 using base::android::JavaParamRef;
19 18
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 54
56 SensorManagerAndroid::SensorManagerAndroid() 55 SensorManagerAndroid::SensorManagerAndroid()
57 : number_active_device_motion_sensors_(0), 56 : number_active_device_motion_sensors_(0),
58 device_motion_buffer_(nullptr), 57 device_motion_buffer_(nullptr),
59 device_orientation_buffer_(nullptr), 58 device_orientation_buffer_(nullptr),
60 motion_buffer_initialized_(false), 59 motion_buffer_initialized_(false),
61 orientation_buffer_initialized_(false), 60 orientation_buffer_initialized_(false),
62 is_shutdown_(false) { 61 is_shutdown_(false) {
63 DCHECK(thread_checker_.CalledOnValidThread()); 62 DCHECK(thread_checker_.CalledOnValidThread());
64 memset(received_motion_data_, 0, sizeof(received_motion_data_)); 63 memset(received_motion_data_, 0, sizeof(received_motion_data_));
65 device_sensors_.Reset(Java_DeviceSensors_create( 64 device_sensors_.Reset(Java_DeviceSensors_create(AttachCurrentThread()));
66 AttachCurrentThread(), base::android::GetApplicationContext()));
67 } 65 }
68 66
69 SensorManagerAndroid::~SensorManagerAndroid() {} 67 SensorManagerAndroid::~SensorManagerAndroid() {}
70 68
71 bool SensorManagerAndroid::Register(JNIEnv* env) { 69 bool SensorManagerAndroid::Register(JNIEnv* env) {
72 return RegisterNativesImpl(env); 70 return RegisterNativesImpl(env);
73 } 71 }
74 72
75 SensorManagerAndroid* SensorManagerAndroid::GetInstance() { 73 SensorManagerAndroid* SensorManagerAndroid::GetInstance() {
76 DCHECK(base::MessageLoopForUI::IsCurrent()); 74 DCHECK(base::MessageLoopForUI::IsCurrent());
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 388 }
391 } 389 }
392 } 390 }
393 391
394 void SensorManagerAndroid::Shutdown() { 392 void SensorManagerAndroid::Shutdown() {
395 DCHECK(thread_checker_.CalledOnValidThread()); 393 DCHECK(thread_checker_.CalledOnValidThread());
396 is_shutdown_ = true; 394 is_shutdown_ = true;
397 } 395 }
398 396
399 } // namespace device 397 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698