summaryrefslogtreecommitdiff
path: root/libs/androidfw/FileStream.cpp
diff options
context:
space:
mode:
author Zimuzo Ezeozue <zezeozue@google.com> 2025-02-06 01:12:56 +0000
committer Zimuzo Ezeozue <zezeozue@google.com> 2025-02-16 04:13:09 -0800
commit50adc08679d5b380dee7785111860cf3568b5a86 (patch)
tree9a8ba209dfaab54361243317c85611ef2fbe850f /libs/androidfw/FileStream.cpp
parent74b083adfbcaa7d5c8d2df6512e8cad550b65707 (diff)
Switch from GetUTFStringChars to GetStringRegion
Replaced GetUTFStringChars/ReleaseUTFStringChars with a more efficient direct string conversion using GetStringRegion. This eliminates unnecessary memory allocations and copies while decoding String from Java into JNI. Fast path - thread_local buffers that serve as temp string storage while building the tracing event. - Replaced ScopedUtfChars with string_views into these buffers, eliminating strdup calls Slow path - Still uses the GetStringRegion to get the utf16 from Java but simply allocate a new string to hold the ascii converted version instead of splicing string_views over the (already full) TLS buffer Fixed a potential crash where extra args that spill over the default pool sizes are not referenced and can be GC'd before they are emitted. Appended any pending PerfettoPointer objects to a list that's freed after emitting. Test: atest PerfettoTest Bug: 303199244 Flag: android.os.perfetto_sdk_tracing_v2 Change-Id: I34bc3dee062544de8194989e657ff658f76110b2
Diffstat (limited to 'libs/androidfw/FileStream.cpp')
0 files changed, 0 insertions, 0 deletions