summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2019-10-06 15:49:09 +0100
committerTobias Thierer <tobiast@google.com>2019-10-06 18:37:07 +0000
commitf7f3742de9dd47896bf9de84fb3db4aecfb6eb9a (patch)
treee7f4316128617de32cf64c6a7f5b52bf9b979ce6 /annotations/generate_annotated_java_files.py
parente1c0c5ba055fab63091c0edf3977e33abcd98e51 (diff)
MimeMap: Construct libcore's default instance lazily, too.
Dashboards still suggest a 1-2msec regression vs. historic zygote pre-fork time. This appears likely to be because of the eager construction of libcore's default MimeMap instance during MimeMap.<clinit>. Since, in practice, this instance is never used because RuntimeInit.preForkInit() calls MimeMap.setDefaultProvider() before anything else calls MimeMap.getDefault(), this is useless work. This CL changes MimeMap.<clinit> to only construct a Supplier of that default instance. That Supplier is then (in practice) never invoked. To avoid introducing yet another (lambda) class, this CL also drops the helper method MimeMap.setDefault() and the tests that were specifically testing that method. Remaining tests are refactored to instead use MimeMap.setDefaultSupplier(). MimeMap.instanceSupplier's compile-time type is changed to MemoizingSupplier because it always has that type in practice and because that has the side effect of documenting this fact. Test: atest CtsMimeMapTestCases \ CtsLibcoreTestCases:libcore.libcore.content.type.MimeMapTest Bug: 142019040 Change-Id: I078b74a81f1cdafbdd0d168d1d698f4db58054c1
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions