Skip to content

Commit

Permalink
Remove TSan annotations from base/
Browse files Browse the repository at this point in the history
, 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}
  • Loading branch information
glider authored and Commit bot committed Sep 23, 2014
1 parent f372197 commit 3a06549
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 24 deletions.
11 changes: 0 additions & 11 deletions base/atomic_ref_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#define BASE_ATOMIC_REF_COUNT_H_

#include "base/atomicops.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"

namespace base {

Expand All @@ -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.
inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr,
AtomicRefCount decrement) {
ANNOTATE_HAPPENS_BEFORE(ptr);
bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0);
if (!res) {
ANNOTATE_HAPPENS_AFTER(ptr);
}
return res;
}

Expand All @@ -58,9 +53,6 @@ inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) {
// exclusive access to the object.
inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
bool res = (subtle::Acquire_Load(ptr) == 1);
if (res) {
ANNOTATE_HAPPENS_AFTER(ptr);
}
return res;
}

Expand All @@ -69,9 +61,6 @@ inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
// should never be zero. Hence this is generally used for a debug check.
inline bool AtomicRefCountIsZero(volatile AtomicRefCount *ptr) {
bool res = (subtle::Acquire_Load(ptr) == 0);
if (res) {
ANNOTATE_HAPPENS_AFTER(ptr);
}
return res;
}

Expand Down
4 changes: 0 additions & 4 deletions base/lazy_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "base/atomicops.h"
#include "base/basictypes.h"
#include "base/threading/platform_thread.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"

namespace base {
namespace internal {
Expand Down Expand Up @@ -42,9 +41,6 @@ void CompleteLazyInstance(subtle::AtomicWord* state,
subtle::AtomicWord new_instance,
void* lazy_instance,
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.
// Releases visibility over private_buf_ to readers. Pairing Acquire_Load's
// are in NeedsInstance() and Pointer().
Expand Down
8 changes: 0 additions & 8 deletions base/lazy_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "base/debug/leak_annotations.h"
#include "base/logging.h"
#include "base/memory/aligned_memory.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_restrictions.h"

// LazyInstance uses its own struct initializer-list style static
Expand Down Expand Up @@ -166,13 +165,6 @@ class LazyInstance {
internal::CompleteLazyInstance(&private_instance_, value, this,
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();
}

Expand Down
1 change: 0 additions & 1 deletion base/vlog_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "base/basictypes.h"
#include "base/logging.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down
1 change: 1 addition & 0 deletions content/test/blink_test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.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/user_agent.h"
#include "content/public/test/test_content_client_initializer.h"
Expand Down

0 comments on commit 3a06549

Please sign in to comment.