Cherry-pick "[Android] Cache function templates in GinJavaBridgeObject to avoid memory leak"
Original description (https://codereview.chromium.org/969353004/)
[Android] Cache function templates in GinJavaBridgeObject to avoid memory leak
V8 caches all function templates internally for the lifetime of a web page in an
unbounded cache. Thus, creating a new function template for each call to a
method of injected object caused JS heap memory to grow linearly.
This is similar to a fix for Pepper Plugin objects (https://codereview.chromium.org/785213002/)
BUG=462664
Bug: 19578263
Change-Id: Ie259ceab8625e9e80670b9084aa3cd5813330648
2 files changed