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

Unified Diff: base/message_loop/message_pump_android.cc

Issue 16926003: Updating message pump to store java ptr in class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing duplicate label Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop/message_pump_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_android.cc
diff --git a/base/message_loop/message_pump_android.cc b/base/message_loop/message_pump_android.cc
index dda873007310df0fc6d0c677ee66f663ad861515..70eb6ef089e7230455cf24a25b0d8ac8ed9cdfb1 100644
--- a/base/message_loop/message_pump_android.cc
+++ b/base/message_loop/message_pump_android.cc
@@ -16,13 +16,6 @@
using base::android::ScopedJavaLocalRef;
-namespace {
-
-base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> >
- g_system_message_handler_obj = LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
// ----------------------------------------------------------------------------
// Native JNI methods called by Java.
// ----------------------------------------------------------------------------
@@ -81,23 +74,23 @@ void MessagePumpForUI::Start(Delegate* delegate) {
if (!run_loop_->BeforeRun())
NOTREACHED();
- DCHECK(g_system_message_handler_obj.Get().is_null());
+ DCHECK(system_message_handler_obj_.is_null());
JNIEnv* env = base::android::AttachCurrentThread();
DCHECK(env);
- g_system_message_handler_obj.Get().Reset(
+ system_message_handler_obj_.Reset(
Java_SystemMessageHandler_create(env, reinterpret_cast<jint>(delegate)));
}
void MessagePumpForUI::Quit() {
- if (!g_system_message_handler_obj.Get().is_null()) {
+ if (!system_message_handler_obj_.is_null()) {
JNIEnv* env = base::android::AttachCurrentThread();
DCHECK(env);
Java_SystemMessageHandler_removeTimer(env,
- g_system_message_handler_obj.Get().obj());
- g_system_message_handler_obj.Get().Reset();
+ system_message_handler_obj_.obj());
+ system_message_handler_obj_.Reset();
}
if (run_loop_) {
@@ -108,17 +101,17 @@ void MessagePumpForUI::Quit() {
}
void MessagePumpForUI::ScheduleWork() {
- DCHECK(!g_system_message_handler_obj.Get().is_null());
+ DCHECK(!system_message_handler_obj_.is_null());
JNIEnv* env = base::android::AttachCurrentThread();
DCHECK(env);
Java_SystemMessageHandler_setTimer(env,
- g_system_message_handler_obj.Get().obj());
+ system_message_handler_obj_.obj());
}
void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
- DCHECK(!g_system_message_handler_obj.Get().is_null());
+ DCHECK(!system_message_handler_obj_.is_null());
JNIEnv* env = base::android::AttachCurrentThread();
DCHECK(env);
@@ -128,7 +121,7 @@ void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
// Note that we're truncating to milliseconds as required by the java side,
// even though delayed_work_time is microseconds resolution.
Java_SystemMessageHandler_setDelayedTimer(env,
- g_system_message_handler_obj.Get().obj(), millis);
+ system_message_handler_obj_.obj(), millis);
}
// static
« no previous file with comments | « base/message_loop/message_pump_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698