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

Side by Side Diff: base/message_loop/message_pump_android.cc

Issue 2237943002: Remove now-unnecessary .obj() in Java method calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@switch-context
Patch Set: Rebase *again* :( Created 4 years, 4 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 | « base/android/jni_generator/sample_for_tests.cc ('k') | base/test/test_file_util_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/message_loop/message_pump_android.h" 5 #include "base/message_loop/message_pump_android.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 system_message_handler_obj_.Reset( 113 system_message_handler_obj_.Reset(
114 Java_SystemMessageHandler_create( 114 Java_SystemMessageHandler_create(
115 env, reinterpret_cast<intptr_t>(delegate))); 115 env, reinterpret_cast<intptr_t>(delegate)));
116 } 116 }
117 117
118 void MessagePumpForUI::Quit() { 118 void MessagePumpForUI::Quit() {
119 if (!system_message_handler_obj_.is_null()) { 119 if (!system_message_handler_obj_.is_null()) {
120 JNIEnv* env = base::android::AttachCurrentThread(); 120 JNIEnv* env = base::android::AttachCurrentThread();
121 DCHECK(env); 121 DCHECK(env);
122 122
123 Java_SystemMessageHandler_removeAllPendingMessages(env, 123 Java_SystemMessageHandler_removeAllPendingMessages(
124 system_message_handler_obj_.obj()); 124 env, system_message_handler_obj_);
125 system_message_handler_obj_.Reset(); 125 system_message_handler_obj_.Reset();
126 } 126 }
127 127
128 if (run_loop_) { 128 if (run_loop_) {
129 run_loop_->AfterRun(); 129 run_loop_->AfterRun();
130 delete run_loop_; 130 delete run_loop_;
131 run_loop_ = NULL; 131 run_loop_ = NULL;
132 } 132 }
133 } 133 }
134 134
135 void MessagePumpForUI::ScheduleWork() { 135 void MessagePumpForUI::ScheduleWork() {
136 DCHECK(!system_message_handler_obj_.is_null()); 136 DCHECK(!system_message_handler_obj_.is_null());
137 137
138 JNIEnv* env = base::android::AttachCurrentThread(); 138 JNIEnv* env = base::android::AttachCurrentThread();
139 DCHECK(env); 139 DCHECK(env);
140 140
141 Java_SystemMessageHandler_scheduleWork(env, 141 Java_SystemMessageHandler_scheduleWork(env, system_message_handler_obj_);
142 system_message_handler_obj_.obj());
143 } 142 }
144 143
145 void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) { 144 void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
146 DCHECK(!system_message_handler_obj_.is_null()); 145 DCHECK(!system_message_handler_obj_.is_null());
147 146
148 JNIEnv* env = base::android::AttachCurrentThread(); 147 JNIEnv* env = base::android::AttachCurrentThread();
149 DCHECK(env); 148 DCHECK(env);
150 149
151 jlong millis = 150 jlong millis =
152 (delayed_work_time - TimeTicks::Now()).InMillisecondsRoundedUp(); 151 (delayed_work_time - TimeTicks::Now()).InMillisecondsRoundedUp();
153 // Note that we're truncating to milliseconds as required by the java side, 152 // Note that we're truncating to milliseconds as required by the java side,
154 // even though delayed_work_time is microseconds resolution. 153 // even though delayed_work_time is microseconds resolution.
155 Java_SystemMessageHandler_scheduleDelayedWork(env, 154 Java_SystemMessageHandler_scheduleDelayedWork(
156 system_message_handler_obj_.obj(), 155 env, system_message_handler_obj_, delayed_work_time.ToInternalValue(),
157 delayed_work_time.ToInternalValue(), millis); 156 millis);
158 } 157 }
159 158
160 // static 159 // static
161 bool MessagePumpForUI::RegisterBindings(JNIEnv* env) { 160 bool MessagePumpForUI::RegisterBindings(JNIEnv* env) {
162 return RegisterNativesImpl(env); 161 return RegisterNativesImpl(env);
163 } 162 }
164 163
165 } // namespace base 164 } // namespace base
OLDNEW
« no previous file with comments | « base/android/jni_generator/sample_for_tests.cc ('k') | base/test/test_file_util_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698