diff options
author | Scott Lobdell <slobdell@google.com> | 2021-02-23 11:55:26 -0800 |
---|---|---|
committer | Daniel Norman <danielnorman@google.com> | 2021-03-01 15:24:51 -0800 |
commit | 24818fca475a6726f5ef0cae42149615079af6e9 (patch) | |
tree | 1a3163ac7ce01c335d8d1c05cacddf47c0a30bfd /libs/hwui/ProfileDataContainer.cpp | |
parent | 8deb6bda58c7ecd95285f4dc934269e0c98c989a (diff) | |
parent | 0f50c486e59546c32acf3f2cdf6667897600de5c (diff) |
Merge SP1A.210222.001
Change-Id: If3509f3a660e820f4c8c0b29e007faa868e1f089
Diffstat (limited to 'libs/hwui/ProfileDataContainer.cpp')
-rw-r--r-- | libs/hwui/ProfileDataContainer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/hwui/ProfileDataContainer.cpp b/libs/hwui/ProfileDataContainer.cpp index 38e0f0aa8d83..41afc0e04c8b 100644 --- a/libs/hwui/ProfileDataContainer.cpp +++ b/libs/hwui/ProfileDataContainer.cpp @@ -38,6 +38,8 @@ void ProfileDataContainer::freeData() { } void ProfileDataContainer::rotateStorage() { + std::lock_guard lock(mJankDataMutex); + // If we are mapped we want to stop using the ashmem backend and switch to malloc // We are expecting a switchStorageToAshmem call to follow this, but it's not guaranteed // If we aren't sitting on top of ashmem then just do a reset() as it's functionally @@ -50,6 +52,7 @@ void ProfileDataContainer::rotateStorage() { } void ProfileDataContainer::switchStorageToAshmem(int ashmemfd) { + std::lock_guard lock(mJankDataMutex); int regionSize = ashmem_get_size_region(ashmemfd); if (regionSize < 0) { int err = errno; @@ -70,7 +73,9 @@ void ProfileDataContainer::switchStorageToAshmem(int ashmemfd) { return; } - newData->mergeWith(*mData); + if (mData != nullptr) { + newData->mergeWith(*mData); + } freeData(); mData = newData; mIsMapped = true; |