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

Side by Side Diff: content/public/test/nested_message_pump_android.cc

Issue 733533002: Do not start RunLoop of MessagePumpForUI in NestedMessagePumpAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use anonymous namespace for CallbackChecker Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/public/test/nested_message_pump_android.h" 5 #include "content/public/test/nested_message_pump_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"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 state_ = previous_state; 117 state_ = previous_state;
118 } 118 }
119 119
120 void NestedMessagePumpAndroid::Start( 120 void NestedMessagePumpAndroid::Start(
121 base::MessagePump::Delegate* delegate) { 121 base::MessagePump::Delegate* delegate) {
122 JNIEnv* env = base::android::AttachCurrentThread(); 122 JNIEnv* env = base::android::AttachCurrentThread();
123 DCHECK(env); 123 DCHECK(env);
124 g_message_handler_obj.Get().Reset( 124 g_message_handler_obj.Get().Reset(
125 Java_NestedSystemMessageHandler_create(env)); 125 Java_NestedSystemMessageHandler_create(env));
126
127 base::MessagePumpForUI::Start(delegate);
128 } 126 }
129 127
130 void NestedMessagePumpAndroid::Quit() { 128 void NestedMessagePumpAndroid::Quit() {
131 if (state_) { 129 if (state_) {
132 state_->should_quit = true; 130 state_->should_quit = true;
133 state_->waitable_event.Signal(); 131 state_->waitable_event.Signal();
134 return; 132 return;
135 } 133 }
136 base::MessagePumpForUI::Quit();
137 } 134 }
138 135
139 void NestedMessagePumpAndroid::ScheduleWork() { 136 void NestedMessagePumpAndroid::ScheduleWork() {
140 if (state_) { 137 if (state_) {
141 state_->waitable_event.Signal(); 138 state_->waitable_event.Signal();
142 return; 139 return;
143 } 140 }
144
145 base::MessagePumpForUI::ScheduleWork();
146 } 141 }
147 142
148 void NestedMessagePumpAndroid::ScheduleDelayedWork( 143 void NestedMessagePumpAndroid::ScheduleDelayedWork(
149 const base::TimeTicks& delayed_work_time) { 144 const base::TimeTicks& delayed_work_time) {
150 if (state_) { 145 if (state_) {
151 // We know that we can't be blocked on Wait right now since this method can 146 // We know that we can't be blocked on Wait right now since this method can
152 // only be called on the same thread as Run, so we only need to update our 147 // only be called on the same thread as Run, so we only need to update our
153 // record of how long to sleep when we do sleep. 148 // record of how long to sleep when we do sleep.
154 state_->delayed_work_time = delayed_work_time; 149 state_->delayed_work_time = delayed_work_time;
155 return; 150 return;
156 } 151 }
157
158 base::MessagePumpForUI::ScheduleDelayedWork(delayed_work_time);
159 } 152 }
160 153
161 // static 154 // static
162 bool NestedMessagePumpAndroid::RegisterJni(JNIEnv* env) { 155 bool NestedMessagePumpAndroid::RegisterJni(JNIEnv* env) {
163 return RegisterNativesImpl(env); 156 return RegisterNativesImpl(env);
164 } 157 }
165 158
166 } // namespace content 159 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/cdm/browser_cdm_manager.cc ('k') | content/test/content_browser_test_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698