summaryrefslogtreecommitdiff
path: root/rs
diff options
context:
space:
mode:
authorYurii Zubrytskyi <zyy@google.com>2023-05-01 14:35:48 -0700
committerYurii Zubrytskyi <zyy@google.com>2023-07-11 15:14:19 -0700
commit1cf74939f4623609341f1dd9b69616da88482c58 (patch)
tree0c22a86a01a86be85a31b5071a61a0ab2adce80f /rs
parentb9ef411d0f480ee59d73601cce7fb40335a7d389 (diff)
downloadbase-1cf74939f4623609341f1dd9b69616da88482c58.tar.gz
Reland "Use reference counted pointers for ApkAssets"
This reverts commit cf6e79f809034386b04ae551db815ab087f76c0a Updates: Prepare the shared pointers for the whole operation at once instead of re-locking them on each iteration. Still a regression of about 5% for changing theme's AssetManager object, vs the original 40% + change the log message to a warning as it doesn't break the app Original comment: Use reference counted pointers for ApkAssets The primary reason for memory corruption is freed ApkAssets Java expected them to only be freed in the finalizers, but there are explicit close() calls now, destroying objects that are still in use in some AssetManager2 objects This CL makes sure those AssetManagers don't assume ApkAssets always exist, but instead tries to lock them in memory for any access It also adds logging in case of deleting an assets object with any weak pointers still existing. Those will get into the bugreports attached to related bugs to help with investigation. Benchmarks don't regress, and the device appears to be working. Given that the crashes used to be pretty rare, let's wait for any new reports or lack of those. + add a missing .clang-format file to the jni directory + enabled C++23 in the project that uses AssetManager headers Bug: 197260547 Bug: 276922628 Test: unit tests + boot + benchmarks Old change id: I495fd9e012fe370a1f725dbb0265b4ee1be8d805 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b3455190124b41e2deb1774d9c05b396b73b41a2) Merged-In: Id668fbcf07db17b09691a344c04e98df83006f97 Change-Id: Id668fbcf07db17b09691a344c04e98df83006f97
Diffstat (limited to 'rs')
-rw-r--r--rs/jni/Android.bp1
1 files changed, 1 insertions, 0 deletions
diff --git a/rs/jni/Android.bp b/rs/jni/Android.bp
index 8a6897c055c5..f732c216c250 100644
--- a/rs/jni/Android.bp
+++ b/rs/jni/Android.bp
@@ -22,6 +22,7 @@ package {
cc_library_shared {
name: "librs_jni",
+ cpp_std: "gnu++2b",
srcs: ["android_renderscript_RenderScript.cpp"],
shared_libs: [