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

Unified Diff: base/message_loop/message_pump_android.h

Issue 2169553002: Properly throw java exceptions from shouldOverrideUrlLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better separation of production and test code, and minor cleanups. 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 side-by-side diff with in-line comments
Download patch
Index: base/message_loop/message_pump_android.h
diff --git a/base/message_loop/message_pump_android.h b/base/message_loop/message_pump_android.h
index 795bd5e79ee69569347d3c0c57522c3717c892ee..7eaff37040d7bc60feb6680979a3467d03294f42 100644
--- a/base/message_loop/message_pump_android.h
+++ b/base/message_loop/message_pump_android.h
@@ -12,6 +12,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/message_loop/message_pump.h"
+#include "base/synchronization/waitable_event.h"
namespace base {
@@ -31,12 +32,26 @@ class BASE_EXPORT MessagePumpForUI : public MessagePump {
void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
virtual void Start(Delegate* delegate);
+ void StartForTesting(Delegate* delegate, WaitableEvent* test_done_event);
+
+ // We call Abort when there is a pending JNI exception, meaning that the
+ // current thread will crash when we return to Java.
+ // We can't call any jni-methods before returning to Java as we would then
+ // cause a native crash (instead of the original Java crash)
+ void Abort() { should_abort_ = true; }
+ bool ShouldAbort() const { return should_abort_; }
+
+ void NotifyTestDone();
static bool RegisterBindings(JNIEnv* env);
private:
RunLoop* run_loop_;
base::android::ScopedJavaGlobalRef<jobject> system_message_handler_obj_;
+ bool should_abort_;
+ // An event that is triggered when we catch a certain test exception in
+ // SystemMessageHandler, this event is only used in tests.
+ WaitableEvent* test_event_;
DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
};

Powered by Google App Engine
This is Rietveld 408576698