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 #include "third_party/abseil-cpp/absl/base/attributes.h" 8 9 namespace base { 10 namespace internal { 11 12 ABSL_CONST_INIT thread_local const ObserverListThreadSafeBase:: 13 NotificationDataBase* current_notification = nullptr; 14 15 // static 16 const ObserverListThreadSafeBase::NotificationDataBase*& GetCurrentNotification()17ObserverListThreadSafeBase::GetCurrentNotification() { 18 // Workaround false-positive MSAN use-of-uninitialized-value on 19 // thread_local storage for loaded libraries: 20 // https://github.com/google/sanitizers/issues/1265 21 MSAN_UNPOISON( 22 ¤t_notification, 23 sizeof(const ObserverListThreadSafeBase::NotificationDataBase*)); 24 25 return current_notification; 26 } 27 28 } // namespace internal 29 } // namespace base 30