| OLD | NEW |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 did_work = state_->delegate->DoIdleWork(); | 85 did_work = state_->delegate->DoIdleWork(); |
| 86 if (state_->should_quit) | 86 if (state_->should_quit) |
| 87 break; | 87 break; |
| 88 | 88 |
| 89 if (did_work) | 89 if (did_work) |
| 90 continue; | 90 continue; |
| 91 | 91 |
| 92 // No native tasks to process right now. Process tasks from the Java | 92 // No native tasks to process right now. Process tasks from the Java |
| 93 // System message handler. This will return when the java message queue | 93 // System message handler. This will return when the java message queue |
| 94 // is idle. | 94 // is idle. |
| 95 bool ret = Java_NestedSystemMessageHandler_runNestedLoopTillIdle(env, | 95 bool ret = Java_NestedSystemMessageHandler_runNestedLoopTillIdle( |
| 96 g_message_handler_obj.Get().obj()); | 96 env, g_message_handler_obj.Get()); |
| 97 CHECK(ret) << "Error running java message loop, tests will likely fail."; | 97 CHECK(ret) << "Error running java message loop, tests will likely fail."; |
| 98 | 98 |
| 99 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 99 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 100 if (state_->delayed_work_time.is_null()) { | 100 if (state_->delayed_work_time.is_null()) { |
| 101 state_->waitable_event.TimedWait(max_delay); | 101 state_->waitable_event.TimedWait(max_delay); |
| 102 } else { | 102 } else { |
| 103 base::TimeDelta delay = | 103 base::TimeDelta delay = |
| 104 state_->delayed_work_time - base::TimeTicks::Now(); | 104 state_->delayed_work_time - base::TimeTicks::Now(); |
| 105 if (delay > max_delay) | 105 if (delay > max_delay) |
| 106 delay = max_delay; | 106 delay = max_delay; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (state_) { | 145 if (state_) { |
| 146 // 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 |
| 147 // 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 |
| 148 // record of how long to sleep when we do sleep. | 148 // record of how long to sleep when we do sleep. |
| 149 state_->delayed_work_time = delayed_work_time; | 149 state_->delayed_work_time = delayed_work_time; |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace content |
| OLD | NEW |