[cpu-profiler] Protect StringsStorage::GetCopy with a lock

Ensure that we don't concurrently modify the StringsStorage map when
getting a copy of a string.

Bug: v8:11054
Change-Id: I6ad61838d7c5e8a6e9ff21aac04da8d353e41ad5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2648821
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Andrew Comminos <acomminos@fb.com>
Cr-Commit-Position: refs/heads/master@{#72416}
This commit is contained in:
Andrew Comminos 2021-01-26 17:27:45 -08:00 committed by Commit Bot
parent dfcf1e86fa
commit 8432c46a10

View File

@ -27,6 +27,7 @@ StringsStorage::~StringsStorage() {
}
const char* StringsStorage::GetCopy(const char* src) {
base::MutexGuard guard(&mutex_);
int len = static_cast<int>(strlen(src));
base::HashMap::Entry* entry = GetEntry(src, len);
if (entry->value == nullptr) {