Commit b49135f1 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

Don't create RenderFrameHostImpl unnecessarily

If nothing ever called GetJavaObject, then don't bother creating the
java object from the destructor. In practice though this should never
happen, but just to be safe.

Change-Id: I396569e5a7df380a6cbf49417972442710ea4e9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2327188Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792995}
parent cf95be02
......@@ -67,6 +67,10 @@ RenderFrameHostAndroid::RenderFrameHostAndroid(
interface_provider_remote_(std::move(interface_provider_remote)) {}
RenderFrameHostAndroid::~RenderFrameHostAndroid() {
// Avoid unnecessarily creating the java object from the destructor.
if (obj_.is_uninitialized())
return;
ScopedJavaLocalRef<jobject> jobj = GetJavaObject();
if (!jobj.is_null()) {
Java_RenderFrameHostImpl_clearNativePtr(AttachCurrentThread(), jobj);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment