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

Side by Side Diff: base/android/java/src/org/chromium/base/SystemMessageHandler.java

Issue 2169553002: Properly throw java exceptions from shouldOverrideUrlLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot compilation failure. 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/BUILD.gn ('k') | base/android/java_handler_thread.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.os.Build; 8 import android.os.Build;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.os.Message; 10 import android.os.Message;
11 11
12 import org.chromium.base.annotations.CalledByNative; 12 import org.chromium.base.annotations.CalledByNative;
13 import org.chromium.base.annotations.MainDex; 13 import org.chromium.base.annotations.MainDex;
14 14
15 import java.lang.reflect.InvocationTargetException; 15 import java.lang.reflect.InvocationTargetException;
16 import java.lang.reflect.Method; 16 import java.lang.reflect.Method;
17 17
18 @MainDex 18 @MainDex
19 class SystemMessageHandler extends Handler { 19 class SystemMessageHandler extends Handler {
20 20
21 private static final String TAG = "cr.SysMessageHandler"; 21 private static final String TAG = "cr.SysMessageHandler";
22 22
23 private static final int SCHEDULED_WORK = 1; 23 private static final int SCHEDULED_WORK = 1;
24 private static final int DELAYED_SCHEDULED_WORK = 2; 24 private static final int DELAYED_SCHEDULED_WORK = 2;
25 25
26 // Native class pointer set by the constructor of the SharedClient native cl ass. 26 // Native class pointer set by the constructor of the SharedClient native cl ass.
27 private long mMessagePumpDelegateNative = 0; 27 private long mMessagePumpDelegateNative = 0;
28 private long mMessagePumpNative = 0;
28 private long mDelayedScheduledTimeTicks = 0; 29 private long mDelayedScheduledTimeTicks = 0;
29 30
30 private SystemMessageHandler(long messagePumpDelegateNative) { 31 protected SystemMessageHandler(long messagePumpDelegateNative, long messageP umpNative) {
31 mMessagePumpDelegateNative = messagePumpDelegateNative; 32 mMessagePumpDelegateNative = messagePumpDelegateNative;
33 mMessagePumpNative = messagePumpNative;
32 } 34 }
33 35
34 @Override 36 @Override
35 public void handleMessage(Message msg) { 37 public void handleMessage(Message msg) {
36 if (msg.what == DELAYED_SCHEDULED_WORK) { 38 if (msg.what == DELAYED_SCHEDULED_WORK) {
37 mDelayedScheduledTimeTicks = 0; 39 mDelayedScheduledTimeTicks = 0;
38 } 40 }
39 nativeDoRunLoopOnce(mMessagePumpDelegateNative, mDelayedScheduledTimeTic ks); 41 nativeDoRunLoopOnce(
42 mMessagePumpDelegateNative, mMessagePumpNative, mDelayedSchedule dTimeTicks);
40 } 43 }
41 44
42 @SuppressWarnings("unused") 45 @SuppressWarnings("unused")
43 @CalledByNative 46 @CalledByNative
44 private void scheduleWork() { 47 private void scheduleWork() {
45 sendMessage(obtainAsyncMessage(SCHEDULED_WORK)); 48 sendMessage(obtainAsyncMessage(SCHEDULED_WORK));
46 } 49 }
47 50
48 @SuppressWarnings("unused") 51 @SuppressWarnings("unused")
49 @CalledByNative 52 @CalledByNative
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 mMessageMethodSetAsynchronous = null; 149 mMessageMethodSetAsynchronous = null;
147 } catch (RuntimeException e) { 150 } catch (RuntimeException e) {
148 Log.e(TAG, "Runtime exception during async message creation, disabling."); 151 Log.e(TAG, "Runtime exception during async message creation, disabling.");
149 mMessageMethodSetAsynchronous = null; 152 mMessageMethodSetAsynchronous = null;
150 } 153 }
151 } 154 }
152 } 155 }
153 } 156 }
154 157
155 @CalledByNative 158 @CalledByNative
156 private static SystemMessageHandler create(long messagePumpDelegateNative) { 159 private static SystemMessageHandler create(
157 return new SystemMessageHandler(messagePumpDelegateNative); 160 long messagePumpDelegateNative, long messagePumpNative) {
161 return new SystemMessageHandler(messagePumpDelegateNative, messagePumpNa tive);
158 } 162 }
159 163
160 private native void nativeDoRunLoopOnce( 164 private native void nativeDoRunLoopOnce(
161 long messagePumpDelegateNative, long delayedScheduledTimeTicks); 165 long messagePumpDelegateNative, long messagePumpNative, long delayed ScheduledTimeTicks);
162 } 166 }
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/android/java_handler_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698