Commit 3a065495 authored by glider's avatar glider Committed by Commit bot

Remove TSan annotations from base/

, because ThreadSanitizer v2 doesn't need base::subtle to be annotated.
We can't drop the dependency on libdynamic_annotations yet, because some code calls RunningOnValgrind().
Also remove the unused dynamic_annotations.h headers from base/ and add one to content/test/, which uses RunningOnValgrind().

BUG=349861
R=ajwong@chromium.org,phajdan.jr@chromium.org

Review URL: https://codereview.chromium.org/580813002

Cr-Commit-Position: refs/heads/master@{#296265}
parent f3721975
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#define BASE_ATOMIC_REF_COUNT_H_ #define BASE_ATOMIC_REF_COUNT_H_
#include "base/atomicops.h" #include "base/atomicops.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
namespace base { namespace base {
...@@ -30,11 +29,7 @@ inline void AtomicRefCountIncN(volatile AtomicRefCount *ptr, ...@@ -30,11 +29,7 @@ inline void AtomicRefCountIncN(volatile AtomicRefCount *ptr,
// became zero will be visible to a thread that has just made the count zero. // became zero will be visible to a thread that has just made the count zero.
inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr, inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr,
AtomicRefCount decrement) { AtomicRefCount decrement) {
ANNOTATE_HAPPENS_BEFORE(ptr);
bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0); bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0);
if (!res) {
ANNOTATE_HAPPENS_AFTER(ptr);
}
return res; return res;
} }
...@@ -58,9 +53,6 @@ inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) { ...@@ -58,9 +53,6 @@ inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) {
// exclusive access to the object. // exclusive access to the object.
inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) { inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
bool res = (subtle::Acquire_Load(ptr) == 1); bool res = (subtle::Acquire_Load(ptr) == 1);
if (res) {
ANNOTATE_HAPPENS_AFTER(ptr);
}
return res; return res;
} }
...@@ -69,9 +61,6 @@ inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) { ...@@ -69,9 +61,6 @@ inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
// should never be zero. Hence this is generally used for a debug check. // should never be zero. Hence this is generally used for a debug check.
inline bool AtomicRefCountIsZero(volatile AtomicRefCount *ptr) { inline bool AtomicRefCountIsZero(volatile AtomicRefCount *ptr) {
bool res = (subtle::Acquire_Load(ptr) == 0); bool res = (subtle::Acquire_Load(ptr) == 0);
if (res) {
ANNOTATE_HAPPENS_AFTER(ptr);
}
return res; return res;
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/atomicops.h" #include "base/atomicops.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
namespace base { namespace base {
namespace internal { namespace internal {
...@@ -42,9 +41,6 @@ void CompleteLazyInstance(subtle::AtomicWord* state, ...@@ -42,9 +41,6 @@ void CompleteLazyInstance(subtle::AtomicWord* state,
subtle::AtomicWord new_instance, subtle::AtomicWord new_instance,
void* lazy_instance, void* lazy_instance,
void (*dtor)(void*)) { void (*dtor)(void*)) {
// See the comment to the corresponding HAPPENS_AFTER in Pointer().
ANNOTATE_HAPPENS_BEFORE(state);
// Instance is created, go from CREATING to CREATED. // Instance is created, go from CREATING to CREATED.
// Releases visibility over private_buf_ to readers. Pairing Acquire_Load's // Releases visibility over private_buf_ to readers. Pairing Acquire_Load's
// are in NeedsInstance() and Pointer(). // are in NeedsInstance() and Pointer().
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "base/debug/leak_annotations.h" #include "base/debug/leak_annotations.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/aligned_memory.h" #include "base/memory/aligned_memory.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
// LazyInstance uses its own struct initializer-list style static // LazyInstance uses its own struct initializer-list style static
...@@ -166,13 +165,6 @@ class LazyInstance { ...@@ -166,13 +165,6 @@ class LazyInstance {
internal::CompleteLazyInstance(&private_instance_, value, this, internal::CompleteLazyInstance(&private_instance_, value, this,
Traits::kRegisterOnExit ? OnExit : NULL); Traits::kRegisterOnExit ? OnExit : NULL);
} }
// This annotation helps race detectors recognize correct lock-less
// synchronization between different threads calling Pointer().
// We suggest dynamic race detection tool that "Traits::New" above
// and CompleteLazyInstance(...) happens before "return instance()" below.
// See the corresponding HAPPENS_BEFORE in CompleteLazyInstance(...).
ANNOTATE_HAPPENS_AFTER(&private_instance_);
return instance(); return instance();
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_tokenizer.h" #include "base/strings/string_tokenizer.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/user_agent.h" #include "content/public/common/user_agent.h"
#include "content/public/test/test_content_client_initializer.h" #include "content/public/test/test_content_client_initializer.h"
......
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