Commit c0a6fbe7 authored by Bartek Nowierski's avatar Bartek Nowierski Committed by Commit Bot

[PartitionAlloc] Don't restore the last error around TLS access, if not needed

Amendment to crrev.com/c/2529150 to avoid a call to SetLastError in
a typical case.

Bug: 998048
Change-Id: Id39f072da22017e10882d57fa32c61882265478a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537741Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827795}
parent 63a8b30f
......@@ -61,7 +61,9 @@ ALWAYS_INLINE void* PartitionTlsGet(PartitionTlsKey key) {
// when it succeeds."
DWORD saved_error = GetLastError();
void* ret = TlsGetValue(key);
SetLastError(saved_error);
// Only non-zero errors need to be restored.
if (UNLIKELY(saved_error))
SetLastError(saved_error);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment