| Index: base/android/java/src/org/chromium/base/SystemMessageHandler.java
|
| diff --git a/base/android/java/src/org/chromium/base/SystemMessageHandler.java b/base/android/java/src/org/chromium/base/SystemMessageHandler.java
|
| index f7bb19f19e4e322c8dec3f281263368a2ece3983..fc25ff8457ec144ec6a596bcb4a3b1d400d34709 100644
|
| --- a/base/android/java/src/org/chromium/base/SystemMessageHandler.java
|
| +++ b/base/android/java/src/org/chromium/base/SystemMessageHandler.java
|
| @@ -18,70 +18,32 @@ class SystemMessageHandler extends Handler {
|
| // Native class pointer set by the constructor of the SharedClient native class.
|
| private int mMessagePumpDelegateNative = 0;
|
|
|
| - // Used to ensure we have at most one TIMER_MESSAGE pending at once.
|
| - private AtomicBoolean mTimerFired = new AtomicBoolean(true);
|
| -
|
| - // Used to insert TIMER_MESSAGE on the front of the system message queue during startup only.
|
| - // This is a wee hack, to give a priority boost to native tasks during startup as they tend to
|
| - // be on the critical path. (After startup, handling the UI with minimum latency is more
|
| - // important).
|
| - private boolean mStartupComplete = false;
|
| - private final long mStartupCompleteTime = System.currentTimeMillis() + 2000;
|
| - private final boolean startupComplete() {
|
| - if (!mStartupComplete && System.currentTimeMillis() > mStartupCompleteTime) {
|
| - mStartupComplete = true;
|
| - }
|
| - return mStartupComplete;
|
| - }
|
| -
|
| private SystemMessageHandler(int messagePumpDelegateNative) {
|
| mMessagePumpDelegateNative = messagePumpDelegateNative;
|
| }
|
|
|
| @Override
|
| public void handleMessage(Message msg) {
|
| - if (msg.what == TIMER_MESSAGE) {
|
| - mTimerFired.set(true);
|
| - }
|
| - while (nativeDoRunLoopOnce(mMessagePumpDelegateNative)) {
|
| - if (startupComplete()) {
|
| - setTimer();
|
| - break;
|
| - }
|
| - }
|
| + nativeDoRunLoopOnce(mMessagePumpDelegateNative);
|
| }
|
|
|
| + @SuppressWarnings("unused")
|
| @CalledByNative
|
| private void setTimer() {
|
| - if (!mTimerFired.getAndSet(false)) {
|
| - // mTimerFired was already false.
|
| - return;
|
| - }
|
| - if (startupComplete()) {
|
| - sendEmptyMessage(TIMER_MESSAGE);
|
| - } else {
|
| - sendMessageAtFrontOfQueue(obtainMessage(TIMER_MESSAGE));
|
| - }
|
| + sendEmptyMessage(TIMER_MESSAGE);
|
| }
|
|
|
| - // If millis <=0, it'll send a TIMER_MESSAGE instead of
|
| - // a DELAYED_TIMER_MESSAGE.
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| private void setDelayedTimer(long millis) {
|
| - if (millis <= 0) {
|
| - setTimer();
|
| - } else {
|
| - removeMessages(DELAYED_TIMER_MESSAGE);
|
| - sendEmptyMessageDelayed(DELAYED_TIMER_MESSAGE, millis);
|
| - }
|
| + removeMessages(DELAYED_TIMER_MESSAGE);
|
| + sendEmptyMessageDelayed(DELAYED_TIMER_MESSAGE, millis);
|
| }
|
|
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| private void removeTimer() {
|
| removeMessages(TIMER_MESSAGE);
|
| - removeMessages(DELAYED_TIMER_MESSAGE);
|
| }
|
|
|
| @CalledByNative
|
| @@ -89,5 +51,5 @@ class SystemMessageHandler extends Handler {
|
| return new SystemMessageHandler(messagePumpDelegateNative);
|
| }
|
|
|
| - private native boolean nativeDoRunLoopOnce(int messagePumpDelegateNative);
|
| + private native void nativeDoRunLoopOnce(int messagePumpDelegateNative);
|
| }
|
|
|