We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a671c46 commit cc89a20Copy full SHA for cc89a20
firestore/src/jni/env.cc
@@ -59,7 +59,13 @@ Env::Env(JNIEnv* env)
59
: env_(env), initial_pending_exceptions_(CurrentExceptionCount()) {}
60
61
Env::~Env() noexcept(false) {
62
- if (ok()) return;
+ // Avoid calling ok() if there is no registered exception handler. It is
63
+ // slightly more efficient in the common case that no exception handler is
64
+ // specified, and also avoids calling into the JVM in the rare case that the
65
+ // thread is already detached.
66
+ if (!exception_handler_ || ok()) {
67
+ return;
68
+ }
69
70
if (exception_handler_ &&
71
CurrentExceptionCount() == initial_pending_exceptions_) {
0 commit comments