Explicitly hold onto objects that are required for migration
commite19d78d99f09015e53cc797cbb2131d806efa4d3
authordfalcantara <dfalcantara@chromium.org>
Wed, 5 Aug 2015 20:53:09 +0000 (5 13:53 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 5 Aug 2015 20:54:19 +0000 (5 20:54 +0000)
treec3f0839477c4a1efa7a780aec8127a17df649d64
parentdec70f66db4941ce6e8d37ff33a5750a8f55af2c
Explicitly hold onto objects that are required for migration

The TabContentManager was being garbage collected before migration
finished, resulting in native background threads attempting to
execute JNI on the dead TabContentManager.

More explicitly hold the TabContentManager inside of the FaviconImageCallback
(even though it was already doing so) as a member field instead, which seems
to prevent the GC from nuking it.

Possible reasoning on why the GC was being irrationally exuberant:
http://stackoverflow.com/questions/26642153/finalize-called-on-strongly-reachable-object-in-java-8

BUG=513130

Review URL: https://codereview.chromium.org/1260043007

Cr-Commit-Position: refs/heads/master@{#341971}
chrome/android/java/src/org/chromium/chrome/browser/document/DocumentMigrationHelper.java