• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/observer_list_threadsafe.h"
6 #include "base/compiler_specific.h"
7 
8 namespace base {
9 namespace internal {
10 
11 constinit thread_local const ObserverListThreadSafeBase::NotificationDataBase*
12     current_notification = nullptr;
13 
14 // static
15 const ObserverListThreadSafeBase::NotificationDataBase*&
GetCurrentNotification()16 ObserverListThreadSafeBase::GetCurrentNotification() {
17   // Workaround false-positive MSAN use-of-uninitialized-value on
18   // thread_local storage for loaded libraries:
19   // https://github.com/google/sanitizers/issues/1265
20   MSAN_UNPOISON(
21       &current_notification,
22       sizeof(const ObserverListThreadSafeBase::NotificationDataBase*));
23 
24   return current_notification;
25 }
26 
27 }  // namespace internal
28 }  // namespace base
29