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

Side by Side Diff: content/browser/device_orientation/data_fetcher_impl_android.cc

Issue 11038015: Android: lazy initialization for method id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "content/browser/device_orientation/orientation.h" 11 #include "content/browser/device_orientation/orientation.h"
12 #include "jni/DeviceOrientation_jni.h" 12 #include "jni/DeviceOrientation_jni.h"
13 13
14 using base::android::AttachCurrentThread; 14 using base::android::AttachCurrentThread;
15 using base::android::CheckException; 15 using base::android::CheckException;
16 using base::android::GetClass; 16 using base::android::GetClass;
17 using base::android::GetMethodID;
18 using base::android::ScopedJavaGlobalRef; 17 using base::android::ScopedJavaGlobalRef;
19 using base::android::ScopedJavaLocalRef; 18 using base::android::ScopedJavaLocalRef;
20 19
21 namespace content { 20 namespace content {
22 21
23 namespace { 22 namespace {
24 23
25 // This should match ProviderImpl::kDesiredSamplingIntervalMs. 24 // This should match ProviderImpl::kDesiredSamplingIntervalMs.
26 // TODO(husky): Make that constant public so we can use it directly. 25 // TODO(husky): Make that constant public so we can use it directly.
27 const int kPeriodInMilliseconds = 100; 26 const int kPeriodInMilliseconds = 100;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 reinterpret_cast<jint>(this), 92 reinterpret_cast<jint>(this),
94 rate_in_milliseconds); 93 rate_in_milliseconds);
95 } 94 }
96 95
97 void DataFetcherImplAndroid::Stop() { 96 void DataFetcherImplAndroid::Stop() {
98 DCHECK(!g_jni_obj.Get().is_null()); 97 DCHECK(!g_jni_obj.Get().is_null());
99 Java_DeviceOrientation_stop(AttachCurrentThread(), g_jni_obj.Get().obj()); 98 Java_DeviceOrientation_stop(AttachCurrentThread(), g_jni_obj.Get().obj());
100 } 99 }
101 100
102 } // namespace content 101 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698