summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2015-12-21 08:41:38 -0800
committerChristopher Wiley <wiley@google.com>2015-12-22 11:16:06 -0800
commit69420b8b1f03c3a610b9d9291a3802799c18c99b (patch)
tree0d0d0b6f5a54634cd75a31f2cfa85c1540328522
parent0124f205017a3cec648ed742ffe075e8a030978a (diff)
downloadlibchrome-69420b8b1f03c3a610b9d9291a3802799c18c99b.tar.gz
Remove dynamic annotations
This is an outdated library that added support for thread/memory safety annotations before clang was extended to support the same. We don't run those tools on Chrome OS or Android, and it is easiest just to remove the library and includes. Bug: 26253162 Test: Compiles, libchrome unittests pass, brilloemulator_arm64 builds Change-Id: I72f3bdad82fa830c9c76922d98b16dfeebfb5389
-rw-r--r--Android.mk2
-rw-r--r--SConstruct1
-rw-r--r--base/debug/leak_annotations.h46
-rw-r--r--base/debug/proc_maps_linux_unittest.cc1
-rw-r--r--base/lazy_instance.h2
-rw-r--r--base/memory/weak_ptr_unittest.cc1
-rw-r--r--base/message_loop/message_loop.cc1
-rw-r--r--base/message_loop/message_loop_proxy_unittest.cc3
-rw-r--r--base/metrics/statistics_recorder.cc12
-rw-r--r--base/process/launch_posix.cc1
-rw-r--r--base/process/process_posix.cc7
-rw-r--r--base/process/process_util_unittest.cc1
-rw-r--r--base/test/launcher/unit_test_launcher.cc1
-rw-r--r--base/third_party/dynamic_annotations/BUILD.gn26
-rw-r--r--base/third_party/dynamic_annotations/LICENSE28
-rw-r--r--base/third_party/dynamic_annotations/README.chromium20
-rw-r--r--base/third_party/dynamic_annotations/dynamic_annotations.c269
-rw-r--r--base/third_party/dynamic_annotations/dynamic_annotations.gyp50
-rw-r--r--base/third_party/dynamic_annotations/dynamic_annotations.h595
-rw-r--r--base/threading/thread.cc2
-rw-r--r--base/threading/thread_unittest.cc5
-rw-r--r--base/threading/worker_pool.cc3
-rw-r--r--base/tools_sanity_unittest.cc342
-rw-r--r--base/trace_event/trace_event_impl.cc11
-rw-r--r--base/trace_event/trace_event_memory.cc1
-rw-r--r--base/trace_event/trace_event_synthetic_delay.cc4
-rw-r--r--base/trace_event/trace_event_system_stats_monitor.cc1
-rw-r--r--base/tracked_objects.cc2
-rw-r--r--crypto/rsa_private_key_nss.cc1
-rw-r--r--sandbox/linux/tests/unit_tests.cc1
30 files changed, 1 insertions, 1439 deletions
diff --git a/Android.mk b/Android.mk
index 484432c0ff..71e29f4768 100644
--- a/Android.mk
+++ b/Android.mk
@@ -140,7 +140,6 @@ libchromeCommonSrc := \
base/sys_info_posix.cc \
base/task/cancelable_task_tracker.cc \
base/task_runner.cc \
- base/third_party/dynamic_annotations/dynamic_annotations.c \
base/third_party/icu/icu_utf.cc \
base/third_party/nspr/prtime.cc \
base/threading/non_thread_safe_impl.cc \
@@ -337,7 +336,6 @@ libchromeCommonUnittestSrc := \
base/time/time_unittest.cc \
base/timer/hi_res_timer_manager_unittest.cc \
base/timer/timer_unittest.cc \
- base/tools_sanity_unittest.cc \
base/trace_event/memory_allocator_dump_unittest.cc \
base/trace_event/memory_dump_manager_unittest.cc \
base/trace_event/process_memory_dump_unittest.cc \
diff --git a/SConstruct b/SConstruct
index adf523773c..10e2b802e6 100644
--- a/SConstruct
+++ b/SConstruct
@@ -142,7 +142,6 @@ base_libs = [
sys_info_posix.cc
task_runner.cc
task/cancelable_task_tracker.cc
- third_party/dynamic_annotations/dynamic_annotations.c
third_party/icu/icu_utf.cc
third_party/nspr/prtime.cc
threading/non_thread_safe_impl.cc
diff --git a/base/debug/leak_annotations.h b/base/debug/leak_annotations.h
deleted file mode 100644
index ef37959aad..0000000000
--- a/base/debug/leak_annotations.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_DEBUG_LEAK_ANNOTATIONS_H_
-#define BASE_DEBUG_LEAK_ANNOTATIONS_H_
-
-#include "base/basictypes.h"
-#include "build/build_config.h"
-
-// This file defines macros which can be used to annotate intentional memory
-// leaks. Support for annotations is implemented in LeakSanitizer. Annotated
-// objects will be treated as a source of live pointers, i.e. any heap objects
-// reachable by following pointers from an annotated object will not be
-// reported as leaks.
-//
-// ANNOTATE_SCOPED_MEMORY_LEAK: all allocations made in the current scope
-// will be annotated as leaks.
-// ANNOTATE_LEAKING_OBJECT_PTR(X): the heap object referenced by pointer X will
-// be annotated as a leak.
-
-#if defined(LEAK_SANITIZER) && !defined(OS_NACL)
-
-#include <sanitizer/lsan_interface.h>
-
-class ScopedLeakSanitizerDisabler {
- public:
- ScopedLeakSanitizerDisabler() { __lsan_disable(); }
- ~ScopedLeakSanitizerDisabler() { __lsan_enable(); }
- private:
- DISALLOW_COPY_AND_ASSIGN(ScopedLeakSanitizerDisabler);
-};
-
-#define ANNOTATE_SCOPED_MEMORY_LEAK \
- ScopedLeakSanitizerDisabler leak_sanitizer_disabler; static_cast<void>(0)
-
-#define ANNOTATE_LEAKING_OBJECT_PTR(X) __lsan_ignore_object(X);
-
-#else
-
-#define ANNOTATE_SCOPED_MEMORY_LEAK ((void)0)
-#define ANNOTATE_LEAKING_OBJECT_PTR(X) ((void)0)
-
-#endif
-
-#endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_
diff --git a/base/debug/proc_maps_linux_unittest.cc b/base/debug/proc_maps_linux_unittest.cc
index cbc0dd036a..3f53ea456b 100644
--- a/base/debug/proc_maps_linux_unittest.cc
+++ b/base/debug/proc_maps_linux_unittest.cc
@@ -6,7 +6,6 @@
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index d52b5431c2..fb19379c8c 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -40,7 +40,6 @@
#include "base/atomicops.h"
#include "base/base_export.h"
#include "base/basictypes.h"
-#include "base/debug/leak_annotations.h"
#include "base/logging.h"
#include "base/memory/aligned_memory.h"
#include "base/threading/thread_restrictions.h"
@@ -95,7 +94,6 @@ struct LeakyLazyInstanceTraits {
#endif
static Type* New(void* instance) {
- ANNOTATE_SCOPED_MEMORY_LEAK;
return DefaultLazyInstanceTraits<Type>::New(instance);
}
static void Delete(Type* instance) {
diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc
index 20e5c7b05c..2c475f78b5 100644
--- a/base/memory/weak_ptr_unittest.cc
+++ b/base/memory/weak_ptr_unittest.cc
@@ -7,7 +7,6 @@
#include <string>
#include "base/bind.h"
-#include "base/debug/leak_annotations.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index 8ce7d89d1c..c0cc4f7552 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -15,7 +15,6 @@
#include "base/metrics/histogram.h"
#include "base/metrics/statistics_recorder.h"
#include "base/run_loop.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_local.h"
#include "base/time/time.h"
diff --git a/base/message_loop/message_loop_proxy_unittest.cc b/base/message_loop/message_loop_proxy_unittest.cc
index 0b0d9f8ad0..17699be038 100644
--- a/base/message_loop/message_loop_proxy_unittest.cc
+++ b/base/message_loop/message_loop_proxy_unittest.cc
@@ -6,7 +6,6 @@
#include "base/atomic_sequence_num.h"
#include "base/bind.h"
-#include "base/debug/leak_annotations.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -210,8 +209,6 @@ TEST_F(MessageLoopProxyTest, PostTaskAndReply_SameLoop) {
}
TEST_F(MessageLoopProxyTest, PostTaskAndReply_DeadReplyLoopDoesNotDelete) {
- // Annotate the scope as having memory leaks to suppress heapchecker reports.
- ANNOTATE_SCOPED_MEMORY_LEAK;
MessageLoop* task_run_on = NULL;
MessageLoop* task_deleted_on = NULL;
int task_delete_order = -1;
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index 85408e1fa4..a08730da55 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -5,7 +5,6 @@
#include "base/metrics/statistics_recorder.h"
#include "base/at_exit.h"
-#include "base/debug/leak_annotations.h"
#include "base/json/string_escape.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -39,13 +38,8 @@ bool StatisticsRecorder::IsActive() {
// static
HistogramBase* StatisticsRecorder::RegisterOrDeleteDuplicate(
HistogramBase* histogram) {
- // As per crbug.com/79322 the histograms are intentionally leaked, so we need
- // to annotate them. Because ANNOTATE_LEAKING_OBJECT_PTR may be used only once
- // for an object, the duplicates should not be annotated.
- // Callers are responsible for not calling RegisterOrDeleteDuplicate(ptr)
- // twice if (lock_ == NULL) || (!histograms_).
+ // As per crbug.com/79322 the histograms are intentionally leaked.
if (lock_ == NULL) {
- ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322
return histogram;
}
@@ -60,7 +54,6 @@ HistogramBase* StatisticsRecorder::RegisterOrDeleteDuplicate(
HistogramMap::iterator it = histograms_->find(name);
if (histograms_->end() == it) {
(*histograms_)[name] = histogram;
- ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322
histogram_to_return = histogram;
} else if (histogram == it->second) {
// The histogram was registered before.
@@ -83,13 +76,11 @@ const BucketRanges* StatisticsRecorder::RegisterOrDeleteDuplicateRanges(
scoped_ptr<const BucketRanges> ranges_deleter;
if (lock_ == NULL) {
- ANNOTATE_LEAKING_OBJECT_PTR(ranges);
return ranges;
}
base::AutoLock auto_lock(*lock_);
if (ranges_ == NULL) {
- ANNOTATE_LEAKING_OBJECT_PTR(ranges);
return ranges;
}
@@ -98,7 +89,6 @@ const BucketRanges* StatisticsRecorder::RegisterOrDeleteDuplicateRanges(
if (ranges_->end() == ranges_it) {
// Add a new matching list to map.
checksum_matching_list = new std::list<const BucketRanges*>();
- ANNOTATE_LEAKING_OBJECT_PTR(checksum_matching_list);
(*ranges_)[ranges->checksum()] = checksum_matching_list;
} else {
checksum_matching_list = ranges_it->second;
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 2209941b07..574772715b 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -37,7 +37,6 @@
#include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc
index 47b0d5b11f..43e27cd4b4 100644
--- a/base/process/process_posix.cc
+++ b/base/process/process_posix.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/process/kill.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#if defined(OS_MACOSX)
#include <sys/event.h>
@@ -302,12 +301,6 @@ bool Process::Terminate(int exit_code, bool wait) const {
if (result && wait) {
int tries = 60;
- if (RunningOnValgrind()) {
- // Wait for some extra time when running under Valgrind since the child
- // processes may take some time doing leak checking.
- tries *= 2;
- }
-
unsigned sleep_ms = 4;
// The process may not end immediately due to pending I/O
diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc
index 1f7f1b2c77..c39b783a09 100644
--- a/base/process/process_util_unittest.cc
+++ b/base/process/process_util_unittest.cc
@@ -26,7 +26,6 @@
#include "base/synchronization/waitable_event.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
diff --git a/base/test/launcher/unit_test_launcher.cc b/base/test/launcher/unit_test_launcher.cc
index ab6fa72204..3bb703fa94 100644
--- a/base/test/launcher/unit_test_launcher.cc
+++ b/base/test/launcher/unit_test_launcher.cc
@@ -23,7 +23,6 @@
#include "base/test/launcher/test_launcher.h"
#include "base/test/test_switches.h"
#include "base/test/test_timeouts.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_checker.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/third_party/dynamic_annotations/BUILD.gn b/base/third_party/dynamic_annotations/BUILD.gn
deleted file mode 100644
index bc324ae4a7..0000000000
--- a/base/third_party/dynamic_annotations/BUILD.gn
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-if (is_nacl) {
- # Native client doesn't need dynamic annotations, so we provide a
- # dummy target in order for clients to not have to special-case the
- # dependency.
- source_set("dynamic_annotations") {
- sources = [
- "dynamic_annotations.h",
- ]
- }
-} else {
- source_set("dynamic_annotations") {
- sources = [
- "../valgrind/valgrind.h",
- "dynamic_annotations.c",
- "dynamic_annotations.h",
- ]
- if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
- configs += [ "//build/config/compiler:optimize_max" ]
- }
- }
-}
diff --git a/base/third_party/dynamic_annotations/LICENSE b/base/third_party/dynamic_annotations/LICENSE
deleted file mode 100644
index 5c581a9391..0000000000
--- a/base/third_party/dynamic_annotations/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) 2008-2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ---
- * Author: Kostya Serebryany
- */
diff --git a/base/third_party/dynamic_annotations/README.chromium b/base/third_party/dynamic_annotations/README.chromium
deleted file mode 100644
index ff21b19e50..0000000000
--- a/base/third_party/dynamic_annotations/README.chromium
+++ /dev/null
@@ -1,20 +0,0 @@
-Name: dynamic annotations
-URL: http://code.google.com/p/data-race-test/wiki/DynamicAnnotations
-Version: 4384
-License: BSD
-
-ATTENTION: please avoid using these annotations in Chromium code.
-They were mainly intended to instruct the Valgrind-based version of
-ThreadSanitizer to handle atomic operations. The new version of ThreadSanitizer
-based on compiler instrumentation understands atomic operations out of the box,
-so normally you don't need the annotations.
-If you still think you do, please consider writing a comment at http://crbug.com/349861
-
-One header and one source file (dynamic_annotations.h and dynamic_annotations.c)
-in this directory define runtime macros useful for annotating synchronization
-utilities and benign data races so data race detectors can handle Chromium code
-with better precision.
-
-These files were taken from
-http://code.google.com/p/data-race-test/source/browse/?#svn/trunk/dynamic_annotations
-The files are covered under BSD license as described within the files.
diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.c b/base/third_party/dynamic_annotations/dynamic_annotations.c
deleted file mode 100644
index 886c7a13c8..0000000000
--- a/base/third_party/dynamic_annotations/dynamic_annotations.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Copyright (c) 2011, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef _MSC_VER
-# include <windows.h>
-#endif
-
-#ifdef __cplusplus
-# error "This file should be built as pure C to avoid name mangling"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-
-#ifdef __GNUC__
-/* valgrind.h uses gcc extensions so it won't build with other compilers */
-# include "third_party/valgrind/valgrind.h"
-#endif
-
-/* Compiler-based ThreadSanitizer defines
- DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL = 1
- and provides its own definitions of the functions. */
-
-#ifndef DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL
-# define DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL 0
-#endif
-
-/* Each function is empty and called (via a macro) only in debug mode.
- The arguments are captured by dynamic tools at runtime. */
-
-#if DYNAMIC_ANNOTATIONS_ENABLED == 1 \
- && DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0
-
-/* Identical code folding(-Wl,--icf=all) countermeasures.
- This makes all Annotate* functions different, which prevents the linker from
- folding them. */
-#ifdef __COUNTER__
-#define DYNAMIC_ANNOTATIONS_IMPL \
- volatile short lineno = (__LINE__ << 8) + __COUNTER__; (void)lineno;
-#else
-#define DYNAMIC_ANNOTATIONS_IMPL \
- volatile short lineno = (__LINE__ << 8); (void)lineno;
-#endif
-
-/* WARNING: always add new annotations to the end of the list.
- Otherwise, lineno (see above) numbers for different Annotate* functions may
- conflict. */
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(
- const char *file, int line, const volatile void *lock)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(
- const char *file, int line, const volatile void *lock)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)(
- const char *file, int line, const volatile void *lock, long is_w)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(
- const char *file, int line, const volatile void *lock, long is_w)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(
- const char *file, int line, const volatile void *barrier, long count,
- long reinitialization_allowed)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)(
- const char *file, int line, const volatile void *barrier)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)(
- const char *file, int line, const volatile void *barrier)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(
- const char *file, int line, const volatile void *barrier)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(
- const char *file, int line, const volatile void *cv,
- const volatile void *lock)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(
- const char *file, int line, const volatile void *cv)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(
- const char *file, int line, const volatile void *cv)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensBefore)(
- const char *file, int line, const volatile void *obj)
-{DYNAMIC_ANNOTATIONS_IMPL};
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensAfter)(
- const char *file, int line, const volatile void *obj)
-{DYNAMIC_ANNOTATIONS_IMPL};
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(
- const char *file, int line, const volatile void *address, long size)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(
- const char *file, int line, const volatile void *address, long size)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)(
- const char *file, int line, const volatile void *pcq)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)(
- const char *file, int line, const volatile void *pcq)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)(
- const char *file, int line, const volatile void *pcq)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(
- const char *file, int line, const volatile void *pcq)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(
- const char *file, int line, const volatile void *mem, long size)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(
- const char *file, int line, const volatile void *mem,
- const char *description)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRace)(
- const char *file, int line, const volatile void *mem,
- const char *description)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(
- const char *file, int line, const volatile void *mem, long size,
- const char *description)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(
- const char *file, int line, const volatile void *mu)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)(
- const char *file, int line, const volatile void *mu)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(
- const char *file, int line, const volatile void *arg)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(
- const char *file, int line, const char *name)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(
- const char *file, int line, int enable)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)(
- const char *file, int line, const volatile void *arg)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)(
- const char *file, int line)
-{DYNAMIC_ANNOTATIONS_IMPL}
-
-#endif /* DYNAMIC_ANNOTATIONS_ENABLED == 1
- && DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0 */
-
-#if DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1 \
- && DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0
-static int GetRunningOnValgrind(void) {
-#ifdef RUNNING_ON_VALGRIND
- if (RUNNING_ON_VALGRIND) return 1;
-#endif
-
-#ifndef _MSC_VER
- char *running_on_valgrind_str = getenv("RUNNING_ON_VALGRIND");
- if (running_on_valgrind_str) {
- return strcmp(running_on_valgrind_str, "0") != 0;
- }
-#else
- /* Visual Studio issues warnings if we use getenv,
- * so we use GetEnvironmentVariableA instead.
- */
- char value[100] = "1";
- int res = GetEnvironmentVariableA("RUNNING_ON_VALGRIND",
- value, sizeof(value));
- /* value will remain "1" if res == 0 or res >= sizeof(value). The latter
- * can happen only if the given value is long, in this case it can't be "0".
- */
- if (res > 0 && strcmp(value, "0") != 0)
- return 1;
-#endif
- return 0;
-}
-
-/* See the comments in dynamic_annotations.h */
-int RunningOnValgrind(void) {
- static volatile int running_on_valgrind = -1;
- /* C doesn't have thread-safe initialization of statics, and we
- don't want to depend on pthread_once here, so hack it. */
- int local_running_on_valgrind = running_on_valgrind;
- if (local_running_on_valgrind == -1)
- running_on_valgrind = local_running_on_valgrind = GetRunningOnValgrind();
- return local_running_on_valgrind;
-}
-
-#endif /* DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1
- && DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0 */
diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.gyp b/base/third_party/dynamic_annotations/dynamic_annotations.gyp
deleted file mode 100644
index 8d2e9ec96c..0000000000
--- a/base/third_party/dynamic_annotations/dynamic_annotations.gyp
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'targets': [
- {
- 'target_name': 'dynamic_annotations',
- 'type': 'static_library',
- 'toolsets': ['host', 'target'],
- 'include_dirs': [
- '../../../',
- ],
- 'sources': [
- '../valgrind/valgrind.h',
- 'dynamic_annotations.c',
- 'dynamic_annotations.h',
- ],
- 'includes': [
- '../../../build/android/increase_size_for_speed.gypi',
- ],
- },
- ],
- 'conditions': [
- ['OS == "win" and target_arch=="ia32"', {
- 'targets': [
- {
- 'target_name': 'dynamic_annotations_win64',
- 'type': 'static_library',
- # We can't use dynamic_annotations target for win64 build since it is
- # a 32-bit library.
- # TODO(gregoryd): merge with dynamic_annotations when
- # the win32/64 targets are merged.
- 'include_dirs': [
- '../../../',
- ],
- 'sources': [
- 'dynamic_annotations.c',
- 'dynamic_annotations.h',
- ],
- 'configurations': {
- 'Common_Base': {
- 'msvs_target_platform': 'x64',
- },
- },
- },
- ],
- }],
- ],
-}
diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.h b/base/third_party/dynamic_annotations/dynamic_annotations.h
deleted file mode 100644
index 8d7f05202b..0000000000
--- a/base/third_party/dynamic_annotations/dynamic_annotations.h
+++ /dev/null
@@ -1,595 +0,0 @@
-/* Copyright (c) 2011, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* This file defines dynamic annotations for use with dynamic analysis
- tool such as valgrind, PIN, etc.
-
- Dynamic annotation is a source code annotation that affects
- the generated code (that is, the annotation is not a comment).
- Each such annotation is attached to a particular
- instruction and/or to a particular object (address) in the program.
-
- The annotations that should be used by users are macros in all upper-case
- (e.g., ANNOTATE_NEW_MEMORY).
-
- Actual implementation of these macros may differ depending on the
- dynamic analysis tool being used.
-
- See http://code.google.com/p/data-race-test/ for more information.
-
- This file supports the following dynamic analysis tools:
- - None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero).
- Macros are defined empty.
- - ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1).
- Macros are defined as calls to non-inlinable empty functions
- that are intercepted by Valgrind. */
-
-#ifndef __DYNAMIC_ANNOTATIONS_H__
-#define __DYNAMIC_ANNOTATIONS_H__
-
-#ifndef DYNAMIC_ANNOTATIONS_PREFIX
-# define DYNAMIC_ANNOTATIONS_PREFIX
-#endif
-
-#ifndef DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND
-# define DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND 1
-#endif
-
-#ifdef DYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK
-# ifdef __GNUC__
-# define DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK __attribute__((weak))
-# else
-/* TODO(glider): for Windows support we may want to change this macro in order
- to prepend __declspec(selectany) to the annotations' declarations. */
-# error weak annotations are not supported for your compiler
-# endif
-#else
-# define DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK
-#endif
-
-/* The following preprocessor magic prepends the value of
- DYNAMIC_ANNOTATIONS_PREFIX to annotation function names. */
-#define DYNAMIC_ANNOTATIONS_GLUE0(A, B) A##B
-#define DYNAMIC_ANNOTATIONS_GLUE(A, B) DYNAMIC_ANNOTATIONS_GLUE0(A, B)
-#define DYNAMIC_ANNOTATIONS_NAME(name) \
- DYNAMIC_ANNOTATIONS_GLUE(DYNAMIC_ANNOTATIONS_PREFIX, name)
-
-#ifndef DYNAMIC_ANNOTATIONS_ENABLED
-# define DYNAMIC_ANNOTATIONS_ENABLED 0
-#endif
-
-#if DYNAMIC_ANNOTATIONS_ENABLED != 0
-
- /* -------------------------------------------------------------
- Annotations useful when implementing condition variables such as CondVar,
- using conditional critical sections (Await/LockWhen) and when constructing
- user-defined synchronization mechanisms.
-
- The annotations ANNOTATE_HAPPENS_BEFORE() and ANNOTATE_HAPPENS_AFTER() can
- be used to define happens-before arcs in user-defined synchronization
- mechanisms: the race detector will infer an arc from the former to the
- latter when they share the same argument pointer.
-
- Example 1 (reference counting):
-
- void Unref() {
- ANNOTATE_HAPPENS_BEFORE(&refcount_);
- if (AtomicDecrementByOne(&refcount_) == 0) {
- ANNOTATE_HAPPENS_AFTER(&refcount_);
- delete this;
- }
- }
-
- Example 2 (message queue):
-
- void MyQueue::Put(Type *e) {
- MutexLock lock(&mu_);
- ANNOTATE_HAPPENS_BEFORE(e);
- PutElementIntoMyQueue(e);
- }
-
- Type *MyQueue::Get() {
- MutexLock lock(&mu_);
- Type *e = GetElementFromMyQueue();
- ANNOTATE_HAPPENS_AFTER(e);
- return e;
- }
-
- Note: when possible, please use the existing reference counting and message
- queue implementations instead of inventing new ones. */
-
- /* Report that wait on the condition variable at address "cv" has succeeded
- and the lock at address "lock" is held. */
- #define ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(__FILE__, __LINE__, cv, lock)
-
- /* Report that wait on the condition variable at "cv" has succeeded. Variant
- w/o lock. */
- #define ANNOTATE_CONDVAR_WAIT(cv) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(__FILE__, __LINE__, cv, NULL)
-
- /* Report that we are about to signal on the condition variable at address
- "cv". */
- #define ANNOTATE_CONDVAR_SIGNAL(cv) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(__FILE__, __LINE__, cv)
-
- /* Report that we are about to signal_all on the condition variable at address
- "cv". */
- #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(__FILE__, __LINE__, cv)
-
- /* Annotations for user-defined synchronization mechanisms. */
- #define ANNOTATE_HAPPENS_BEFORE(obj) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensBefore)(__FILE__, __LINE__, obj)
- #define ANNOTATE_HAPPENS_AFTER(obj) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensAfter)(__FILE__, __LINE__, obj)
-
- /* DEPRECATED. Don't use it. */
- #define ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(__FILE__, __LINE__, \
- pointer, size)
-
- /* DEPRECATED. Don't use it. */
- #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(__FILE__, __LINE__, \
- pointer, size)
-
- /* DEPRECATED. Don't use it. */
- #define ANNOTATE_SWAP_MEMORY_RANGE(pointer, size) \
- do { \
- ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size); \
- ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size); \
- } while (0)
-
- /* Instruct the tool to create a happens-before arc between mu->Unlock() and
- mu->Lock(). This annotation may slow down the race detector and hide real
- races. Normally it is used only when it would be difficult to annotate each
- of the mutex's critical sections individually using the annotations above.
- This annotation makes sense only for hybrid race detectors. For pure
- happens-before detectors this is a no-op. For more details see
- http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */
- #define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(__FILE__, __LINE__, \
- mu)
-
- /* Opposite to ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX.
- Instruct the tool to NOT create h-b arcs between Unlock and Lock, even in
- pure happens-before mode. For a hybrid mode this is a no-op. */
- #define ANNOTATE_NOT_HAPPENS_BEFORE_MUTEX(mu) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)(__FILE__, __LINE__, mu)
-
- /* Deprecated. Use ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX. */
- #define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(__FILE__, __LINE__, \
- mu)
-
- /* -------------------------------------------------------------
- Annotations useful when defining memory allocators, or when memory that
- was protected in one way starts to be protected in another. */
-
- /* Report that a new memory at "address" of size "size" has been allocated.
- This might be used when the memory has been retrieved from a free list and
- is about to be reused, or when a the locking discipline for a variable
- changes. */
- #define ANNOTATE_NEW_MEMORY(address, size) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(__FILE__, __LINE__, address, \
- size)
-
- /* -------------------------------------------------------------
- Annotations useful when defining FIFO queues that transfer data between
- threads. */
-
- /* Report that the producer-consumer queue (such as ProducerConsumerQueue) at
- address "pcq" has been created. The ANNOTATE_PCQ_* annotations
- should be used only for FIFO queues. For non-FIFO queues use
- ANNOTATE_HAPPENS_BEFORE (for put) and ANNOTATE_HAPPENS_AFTER (for get). */
- #define ANNOTATE_PCQ_CREATE(pcq) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)(__FILE__, __LINE__, pcq)
-
- /* Report that the queue at address "pcq" is about to be destroyed. */
- #define ANNOTATE_PCQ_DESTROY(pcq) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)(__FILE__, __LINE__, pcq)
-
- /* Report that we are about to put an element into a FIFO queue at address
- "pcq". */
- #define ANNOTATE_PCQ_PUT(pcq) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)(__FILE__, __LINE__, pcq)
-
- /* Report that we've just got an element from a FIFO queue at address
- "pcq". */
- #define ANNOTATE_PCQ_GET(pcq) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(__FILE__, __LINE__, pcq)
-
- /* -------------------------------------------------------------
- Annotations that suppress errors. It is usually better to express the
- program's synchronization using the other annotations, but these can
- be used when all else fails. */
-
- /* Report that we may have a benign race at "pointer", with size
- "sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the
- point where "pointer" has been allocated, preferably close to the point
- where the race happens. See also ANNOTATE_BENIGN_RACE_STATIC. */
- #define ANNOTATE_BENIGN_RACE(pointer, description) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(__FILE__, __LINE__, \
- pointer, sizeof(*(pointer)), description)
-
- /* Same as ANNOTATE_BENIGN_RACE(address, description), but applies to
- the memory range [address, address+size). */
- #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(__FILE__, __LINE__, \
- address, size, description)
-
- /* Request the analysis tool to ignore all reads in the current thread
- until ANNOTATE_IGNORE_READS_END is called.
- Useful to ignore intentional racey reads, while still checking
- other reads and all writes.
- See also ANNOTATE_UNPROTECTED_READ. */
- #define ANNOTATE_IGNORE_READS_BEGIN() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)(__FILE__, __LINE__)
-
- /* Stop ignoring reads. */
- #define ANNOTATE_IGNORE_READS_END() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)(__FILE__, __LINE__)
-
- /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */
- #define ANNOTATE_IGNORE_WRITES_BEGIN() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)(__FILE__, __LINE__)
-
- /* Stop ignoring writes. */
- #define ANNOTATE_IGNORE_WRITES_END() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)(__FILE__, __LINE__)
-
- /* Start ignoring all memory accesses (reads and writes). */
- #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \
- do {\
- ANNOTATE_IGNORE_READS_BEGIN();\
- ANNOTATE_IGNORE_WRITES_BEGIN();\
- }while(0)\
-
- /* Stop ignoring all memory accesses. */
- #define ANNOTATE_IGNORE_READS_AND_WRITES_END() \
- do {\
- ANNOTATE_IGNORE_WRITES_END();\
- ANNOTATE_IGNORE_READS_END();\
- }while(0)\
-
- /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events:
- RWLOCK* and CONDVAR*. */
- #define ANNOTATE_IGNORE_SYNC_BEGIN() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)(__FILE__, __LINE__)
-
- /* Stop ignoring sync events. */
- #define ANNOTATE_IGNORE_SYNC_END() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(__FILE__, __LINE__)
-
-
- /* Enable (enable!=0) or disable (enable==0) race detection for all threads.
- This annotation could be useful if you want to skip expensive race analysis
- during some period of program execution, e.g. during initialization. */
- #define ANNOTATE_ENABLE_RACE_DETECTION(enable) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(__FILE__, __LINE__, \
- enable)
-
- /* -------------------------------------------------------------
- Annotations useful for debugging. */
-
- /* Request to trace every access to "address". */
- #define ANNOTATE_TRACE_MEMORY(address) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(__FILE__, __LINE__, address)
-
- /* Report the current thread name to a race detector. */
- #define ANNOTATE_THREAD_NAME(name) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(__FILE__, __LINE__, name)
-
- /* -------------------------------------------------------------
- Annotations useful when implementing locks. They are not
- normally needed by modules that merely use locks.
- The "lock" argument is a pointer to the lock object. */
-
- /* Report that a lock has been created at address "lock". */
- #define ANNOTATE_RWLOCK_CREATE(lock) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(__FILE__, __LINE__, lock)
-
- /* Report that the lock at address "lock" is about to be destroyed. */
- #define ANNOTATE_RWLOCK_DESTROY(lock) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(__FILE__, __LINE__, lock)
-
- /* Report that the lock at address "lock" has been acquired.
- is_w=1 for writer lock, is_w=0 for reader lock. */
- #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)(__FILE__, __LINE__, lock, \
- is_w)
-
- /* Report that the lock at address "lock" is about to be released. */
- #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(__FILE__, __LINE__, lock, \
- is_w)
-
- /* -------------------------------------------------------------
- Annotations useful when implementing barriers. They are not
- normally needed by modules that merely use barriers.
- The "barrier" argument is a pointer to the barrier object. */
-
- /* Report that the "barrier" has been initialized with initial "count".
- If 'reinitialization_allowed' is true, initialization is allowed to happen
- multiple times w/o calling barrier_destroy() */
- #define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(__FILE__, __LINE__, barrier, \
- count, reinitialization_allowed)
-
- /* Report that we are about to enter barrier_wait("barrier"). */
- #define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)(__FILE__, __LINE__, \
- barrier)
-
- /* Report that we just exited barrier_wait("barrier"). */
- #define ANNOTATE_BARRIER_WAIT_AFTER(barrier) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)(__FILE__, __LINE__, \
- barrier)
-
- /* Report that the "barrier" has been destroyed. */
- #define ANNOTATE_BARRIER_DESTROY(barrier) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(__FILE__, __LINE__, \
- barrier)
-
- /* -------------------------------------------------------------
- Annotations useful for testing race detectors. */
-
- /* Report that we expect a race on the variable at "address".
- Use only in unit tests for a race detector. */
- #define ANNOTATE_EXPECT_RACE(address, description) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(__FILE__, __LINE__, address, \
- description)
-
- #define ANNOTATE_FLUSH_EXPECTED_RACES() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)(__FILE__, __LINE__)
-
- /* A no-op. Insert where you like to test the interceptors. */
- #define ANNOTATE_NO_OP(arg) \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)(__FILE__, __LINE__, arg)
-
- /* Force the race detector to flush its state. The actual effect depends on
- * the implementation of the detector. */
- #define ANNOTATE_FLUSH_STATE() \
- DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)(__FILE__, __LINE__)
-
-
-#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
-
- #define ANNOTATE_RWLOCK_CREATE(lock) /* empty */
- #define ANNOTATE_RWLOCK_DESTROY(lock) /* empty */
- #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */
- #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */
- #define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) /* */
- #define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */
- #define ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */
- #define ANNOTATE_BARRIER_DESTROY(barrier) /* empty */
- #define ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */
- #define ANNOTATE_CONDVAR_WAIT(cv) /* empty */
- #define ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */
- #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */
- #define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
- #define ANNOTATE_HAPPENS_AFTER(obj) /* empty */
- #define ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */
- #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */
- #define ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */
- #define ANNOTATE_PCQ_CREATE(pcq) /* empty */
- #define ANNOTATE_PCQ_DESTROY(pcq) /* empty */
- #define ANNOTATE_PCQ_PUT(pcq) /* empty */
- #define ANNOTATE_PCQ_GET(pcq) /* empty */
- #define ANNOTATE_NEW_MEMORY(address, size) /* empty */
- #define ANNOTATE_EXPECT_RACE(address, description) /* empty */
- #define ANNOTATE_FLUSH_EXPECTED_RACES(address, description) /* empty */
- #define ANNOTATE_BENIGN_RACE(address, description) /* empty */
- #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */
- #define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */
- #define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */
- #define ANNOTATE_TRACE_MEMORY(arg) /* empty */
- #define ANNOTATE_THREAD_NAME(name) /* empty */
- #define ANNOTATE_IGNORE_READS_BEGIN() /* empty */
- #define ANNOTATE_IGNORE_READS_END() /* empty */
- #define ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */
- #define ANNOTATE_IGNORE_WRITES_END() /* empty */
- #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */
- #define ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */
- #define ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */
- #define ANNOTATE_IGNORE_SYNC_END() /* empty */
- #define ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */
- #define ANNOTATE_NO_OP(arg) /* empty */
- #define ANNOTATE_FLUSH_STATE() /* empty */
-
-#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
-
-/* Use the macros above rather than using these functions directly. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(
- const char *file, int line,
- const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(
- const char *file, int line,
- const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)(
- const char *file, int line,
- const volatile void *lock, long is_w) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(
- const char *file, int line,
- const volatile void *lock, long is_w) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(
- const char *file, int line, const volatile void *barrier, long count,
- long reinitialization_allowed) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)(
- const char *file, int line,
- const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)(
- const char *file, int line,
- const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(
- const char *file, int line,
- const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(
- const char *file, int line, const volatile void *cv,
- const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(
- const char *file, int line,
- const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(
- const char *file, int line,
- const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensBefore)(
- const char *file, int line,
- const volatile void *obj) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensAfter)(
- const char *file, int line,
- const volatile void *obj) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(
- const char *file, int line,
- const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(
- const char *file, int line,
- const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)(
- const char *file, int line,
- const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)(
- const char *file, int line,
- const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)(
- const char *file, int line,
- const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(
- const char *file, int line,
- const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(
- const char *file, int line,
- const volatile void *mem, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(
- const char *file, int line, const volatile void *mem,
- const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRace)(
- const char *file, int line, const volatile void *mem,
- const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(
- const char *file, int line, const volatile void *mem, long size,
- const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(
- const char *file, int line,
- const volatile void *mu) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)(
- const char *file, int line,
- const volatile void *mu) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(
- const char *file, int line,
- const volatile void *arg) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(
- const char *file, int line,
- const char *name) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(
- const char *file, int line, int enable) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)(
- const char *file, int line,
- const volatile void *arg) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)(
- const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-
-#if DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1
-/* Return non-zero value if running under valgrind.
-
- If "valgrind.h" is included into dynamic_annotations.c,
- the regular valgrind mechanism will be used.
- See http://valgrind.org/docs/manual/manual-core-adv.html about
- RUNNING_ON_VALGRIND and other valgrind "client requests".
- The file "valgrind.h" may be obtained by doing
- svn co svn://svn.valgrind.org/valgrind/trunk/include
-
- If for some reason you can't use "valgrind.h" or want to fake valgrind,
- there are two ways to make this function return non-zero:
- - Use environment variable: export RUNNING_ON_VALGRIND=1
- - Make your tool intercept the function RunningOnValgrind() and
- change its return value.
- */
-int RunningOnValgrind(void) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
-#endif /* DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus)
-
- /* ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads.
-
- Instead of doing
- ANNOTATE_IGNORE_READS_BEGIN();
- ... = x;
- ANNOTATE_IGNORE_READS_END();
- one can use
- ... = ANNOTATE_UNPROTECTED_READ(x); */
- template <class T>
- inline T ANNOTATE_UNPROTECTED_READ(const volatile T &x) {
- ANNOTATE_IGNORE_READS_BEGIN();
- T res = x;
- ANNOTATE_IGNORE_READS_END();
- return res;
- }
- /* Apply ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
- #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \
- namespace { \
- class static_var ## _annotator { \
- public: \
- static_var ## _annotator() { \
- ANNOTATE_BENIGN_RACE_SIZED(&static_var, \
- sizeof(static_var), \
- # static_var ": " description); \
- } \
- }; \
- static static_var ## _annotator the ## static_var ## _annotator;\
- }
-#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
-
- #define ANNOTATE_UNPROTECTED_READ(x) (x)
- #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */
-
-#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
-
-#endif /* __DYNAMIC_ANNOTATIONS_H__ */
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 63b07cbce6..b3e74e3d57 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -8,7 +8,6 @@
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/synchronization/waitable_event.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/threading/thread_local.h"
#include "base/threading/thread_restrictions.h"
@@ -216,7 +215,6 @@ bool Thread::GetThreadWasQuitProperly() {
void Thread::ThreadMain() {
// Complete the initialization of our Thread object.
PlatformThread::SetName(name_.c_str());
- ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector.
// Lazily initialize the message_loop so that it can run on this thread.
DCHECK(message_loop_);
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index 926d5ddf35..9993ca6825 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -20,8 +19,6 @@ typedef PlatformTest ThreadTest;
namespace {
void ToggleValue(bool* value) {
- ANNOTATE_BENIGN_RACE(value, "Test-only data race on boolean "
- "in base/thread_unittest");
*value = !*value;
}
@@ -29,8 +26,6 @@ class SleepInsideInitThread : public Thread {
public:
SleepInsideInitThread() : Thread("none") {
init_called_ = false;
- ANNOTATE_BENIGN_RACE(
- this, "Benign test-only data race on vptr - http://crbug.com/98219");
}
~SleepInsideInitThread() override { Stop(); }
diff --git a/base/threading/worker_pool.cc b/base/threading/worker_pool.cc
index 6615edcfd2..fa750f2290 100644
--- a/base/threading/worker_pool.cc
+++ b/base/threading/worker_pool.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/debug/leak_annotations.h"
#include "base/lazy_instance.h"
#include "base/task_runner.h"
#include "base/threading/post_task_and_reply_impl.h"
@@ -110,8 +109,6 @@ bool WorkerPool::PostTaskAndReply(const tracked_objects::Location& from_here,
// do about them because WorkerPool doesn't have a flushing API.
// http://crbug.com/248513
// http://crbug.com/290897
- // Note: this annotation does not cover tasks posted through a TaskRunner.
- ANNOTATE_SCOPED_MEMORY_LEAK;
return PostTaskAndReplyWorkerPool(task_is_slow).PostTaskAndReply(
from_here, task, reply);
}
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc
deleted file mode 100644
index c0541d139f..0000000000
--- a/base/tools_sanity_unittest.cc
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file contains intentional memory errors, some of which may lead to
-// crashes if the test is ran without special memory testing tools. We use these
-// errors to verify the sanity of the tools.
-
-#include "base/atomicops.h"
-#include "base/debug/asan_invalid_access.h"
-#include "base/debug/profiler.h"
-#include "base/message_loop/message_loop.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-#include "base/threading/thread.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-
-namespace {
-
-const base::subtle::Atomic32 kMagicValue = 42;
-
-// Helper for memory accesses that can potentially corrupt memory or cause a
-// crash during a native run.
-#if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
-#if defined(OS_IOS)
-// EXPECT_DEATH is not supported on IOS.
-#define HARMFUL_ACCESS(action,error_regexp) do { action; } while (0)
-#elif defined(SYZYASAN)
-// We won't get a meaningful error message because we're not running under the
-// SyzyASan logger, but we can at least make sure that the error has been
-// generated in the SyzyASan runtime.
-#define HARMFUL_ACCESS(action,unused) \
-if (debug::IsBinaryInstrumented()) { EXPECT_DEATH(action, \
- "AsanRuntime::OnError"); }
-#else
-#define HARMFUL_ACCESS(action,error_regexp) EXPECT_DEATH(action,error_regexp)
-#endif // !OS_IOS && !SYZYASAN
-#else
-#define HARMFUL_ACCESS(action,error_regexp) \
-do { if (RunningOnValgrind()) { action; } } while (0)
-#endif
-
-void DoReadUninitializedValue(char *ptr) {
- // Comparison with 64 is to prevent clang from optimizing away the
- // jump -- valgrind only catches jumps and conditional moves, but clang uses
- // the borrow flag if the condition is just `*ptr == '\0'`.
- if (*ptr == 64) {
- VLOG(1) << "Uninit condition is true";
- } else {
- VLOG(1) << "Uninit condition is false";
- }
-}
-
-void ReadUninitializedValue(char *ptr) {
-#if defined(MEMORY_SANITIZER)
- EXPECT_DEATH(DoReadUninitializedValue(ptr),
- "use-of-uninitialized-value");
-#else
- DoReadUninitializedValue(ptr);
-#endif
-}
-
-void ReadValueOutOfArrayBoundsLeft(char *ptr) {
- char c = ptr[-2];
- VLOG(1) << "Reading a byte out of bounds: " << c;
-}
-
-void ReadValueOutOfArrayBoundsRight(char *ptr, size_t size) {
- char c = ptr[size + 1];
- VLOG(1) << "Reading a byte out of bounds: " << c;
-}
-
-// This is harmless if you run it under Valgrind thanks to redzones.
-void WriteValueOutOfArrayBoundsLeft(char *ptr) {
- ptr[-1] = kMagicValue;
-}
-
-// This is harmless if you run it under Valgrind thanks to redzones.
-void WriteValueOutOfArrayBoundsRight(char *ptr, size_t size) {
- ptr[size] = kMagicValue;
-}
-
-void MakeSomeErrors(char *ptr, size_t size) {
- ReadUninitializedValue(ptr);
-
- HARMFUL_ACCESS(ReadValueOutOfArrayBoundsLeft(ptr),
- "2 bytes to the left");
- HARMFUL_ACCESS(ReadValueOutOfArrayBoundsRight(ptr, size),
- "1 bytes to the right");
- HARMFUL_ACCESS(WriteValueOutOfArrayBoundsLeft(ptr),
- "1 bytes to the left");
- HARMFUL_ACCESS(WriteValueOutOfArrayBoundsRight(ptr, size),
- "0 bytes to the right");
-}
-
-} // namespace
-
-// A memory leak detector should report an error in this test.
-TEST(ToolsSanityTest, MemoryLeak) {
- // Without the |volatile|, clang optimizes away the next two lines.
- int* volatile leak = new int[256]; // Leak some memory intentionally.
- leak[4] = 1; // Make sure the allocated memory is used.
-}
-
-#if (defined(ADDRESS_SANITIZER) && defined(OS_IOS)) || defined(SYZYASAN)
-// Because iOS doesn't support death tests, each of the following tests will
-// crash the whole program under Asan. On Windows Asan is based on SyzyAsan; the
-// error report mechanism is different than with Asan so these tests will fail.
-#define MAYBE_AccessesToNewMemory DISABLED_AccessesToNewMemory
-#define MAYBE_AccessesToMallocMemory DISABLED_AccessesToMallocMemory
-#else
-#define MAYBE_AccessesToNewMemory AccessesToNewMemory
-#define MAYBE_AccessesToMallocMemory AccessesToMallocMemory
-#endif // (defined(ADDRESS_SANITIZER) && defined(OS_IOS)) || defined(SYZYASAN)
-
-// The following tests pass with Clang r170392, but not r172454, which
-// makes AddressSanitizer detect errors in them. We disable these tests under
-// AddressSanitizer until we fully switch to Clang r172454. After that the
-// tests should be put back under the (defined(OS_IOS) || defined(OS_WIN))
-// clause above.
-// See also http://crbug.com/172614.
-#if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
-#define MAYBE_SingleElementDeletedWithBraces \
- DISABLED_SingleElementDeletedWithBraces
-#define MAYBE_ArrayDeletedWithoutBraces DISABLED_ArrayDeletedWithoutBraces
-#else
-#define MAYBE_ArrayDeletedWithoutBraces ArrayDeletedWithoutBraces
-#define MAYBE_SingleElementDeletedWithBraces SingleElementDeletedWithBraces
-#endif // defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
-
-TEST(ToolsSanityTest, MAYBE_AccessesToNewMemory) {
- char *foo = new char[10];
- MakeSomeErrors(foo, 10);
- delete [] foo;
- // Use after delete.
- HARMFUL_ACCESS(foo[5] = 0, "heap-use-after-free");
-}
-
-TEST(ToolsSanityTest, MAYBE_AccessesToMallocMemory) {
- char *foo = reinterpret_cast<char*>(malloc(10));
- MakeSomeErrors(foo, 10);
- free(foo);
- // Use after free.
- HARMFUL_ACCESS(foo[5] = 0, "heap-use-after-free");
-}
-
-static int* allocateArray() {
- // Clang warns about the mismatched new[]/delete if they occur in the same
- // function.
- return new int[10];
-}
-
-TEST(ToolsSanityTest, MAYBE_ArrayDeletedWithoutBraces) {
-#if !defined(ADDRESS_SANITIZER) && !defined(SYZYASAN)
- // This test may corrupt memory if not run under Valgrind or compiled with
- // AddressSanitizer.
- if (!RunningOnValgrind())
- return;
-#endif
-
- // Without the |volatile|, clang optimizes away the next two lines.
- int* volatile foo = allocateArray();
- delete foo;
-}
-
-static int* allocateScalar() {
- // Clang warns about the mismatched new/delete[] if they occur in the same
- // function.
- return new int;
-}
-
-TEST(ToolsSanityTest, MAYBE_SingleElementDeletedWithBraces) {
-#if !defined(ADDRESS_SANITIZER)
- // This test may corrupt memory if not run under Valgrind or compiled with
- // AddressSanitizer.
- if (!RunningOnValgrind())
- return;
-#endif
-
- // Without the |volatile|, clang optimizes away the next two lines.
- int* volatile foo = allocateScalar();
- (void) foo;
- delete [] foo;
-}
-
-#if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
-
-TEST(ToolsSanityTest, DISABLED_AddressSanitizerNullDerefCrashTest) {
- // Intentionally crash to make sure AddressSanitizer is running.
- // This test should not be ran on bots.
- int* volatile zero = NULL;
- *zero = 0;
-}
-
-TEST(ToolsSanityTest, DISABLED_AddressSanitizerLocalOOBCrashTest) {
- // Intentionally crash to make sure AddressSanitizer is instrumenting
- // the local variables.
- // This test should not be ran on bots.
- int array[5];
- // Work around the OOB warning reported by Clang.
- int* volatile access = &array[5];
- *access = 43;
-}
-
-namespace {
-int g_asan_test_global_array[10];
-} // namespace
-
-TEST(ToolsSanityTest, DISABLED_AddressSanitizerGlobalOOBCrashTest) {
- // Intentionally crash to make sure AddressSanitizer is instrumenting
- // the global variables.
- // This test should not be ran on bots.
-
- // Work around the OOB warning reported by Clang.
- int* volatile access = g_asan_test_global_array - 1;
- *access = 43;
-}
-
-TEST(ToolsSanityTest, AsanHeapOverflow) {
- HARMFUL_ACCESS(debug::AsanHeapOverflow() ,"to the right");
-}
-
-TEST(ToolsSanityTest, AsanHeapUnderflow) {
- HARMFUL_ACCESS(debug::AsanHeapUnderflow(), "to the left");
-}
-
-TEST(ToolsSanityTest, AsanHeapUseAfterFree) {
- HARMFUL_ACCESS(debug::AsanHeapUseAfterFree(), "heap-use-after-free");
-}
-
-#if defined(SYZYASAN)
-TEST(ToolsSanityTest, AsanCorruptHeapBlock) {
- HARMFUL_ACCESS(debug::AsanCorruptHeapBlock(), "");
-}
-
-TEST(ToolsSanityTest, AsanCorruptHeap) {
- // This test will kill the process by raising an exception, there's no
- // particular string to look for in the stack trace.
- EXPECT_DEATH(debug::AsanCorruptHeap(), "");
-}
-#endif // SYZYASAN
-
-#endif // ADDRESS_SANITIZER || SYZYASAN
-
-namespace {
-
-// We use caps here just to ensure that the method name doesn't interfere with
-// the wildcarded suppressions.
-class TOOLS_SANITY_TEST_CONCURRENT_THREAD : public PlatformThread::Delegate {
- public:
- explicit TOOLS_SANITY_TEST_CONCURRENT_THREAD(bool *value) : value_(value) {}
- ~TOOLS_SANITY_TEST_CONCURRENT_THREAD() override {}
- void ThreadMain() override {
- *value_ = true;
-
- // Sleep for a few milliseconds so the two threads are more likely to live
- // simultaneously. Otherwise we may miss the report due to mutex
- // lock/unlock's inside thread creation code in pure-happens-before mode...
- PlatformThread::Sleep(TimeDelta::FromMilliseconds(100));
- }
- private:
- bool *value_;
-};
-
-class ReleaseStoreThread : public PlatformThread::Delegate {
- public:
- explicit ReleaseStoreThread(base::subtle::Atomic32 *value) : value_(value) {}
- ~ReleaseStoreThread() override {}
- void ThreadMain() override {
- base::subtle::Release_Store(value_, kMagicValue);
-
- // Sleep for a few milliseconds so the two threads are more likely to live
- // simultaneously. Otherwise we may miss the report due to mutex
- // lock/unlock's inside thread creation code in pure-happens-before mode...
- PlatformThread::Sleep(TimeDelta::FromMilliseconds(100));
- }
- private:
- base::subtle::Atomic32 *value_;
-};
-
-class AcquireLoadThread : public PlatformThread::Delegate {
- public:
- explicit AcquireLoadThread(base::subtle::Atomic32 *value) : value_(value) {}
- ~AcquireLoadThread() override {}
- void ThreadMain() override {
- // Wait for the other thread to make Release_Store
- PlatformThread::Sleep(TimeDelta::FromMilliseconds(100));
- base::subtle::Acquire_Load(value_);
- }
- private:
- base::subtle::Atomic32 *value_;
-};
-
-void RunInParallel(PlatformThread::Delegate *d1, PlatformThread::Delegate *d2) {
- PlatformThreadHandle a;
- PlatformThreadHandle b;
- PlatformThread::Create(0, d1, &a);
- PlatformThread::Create(0, d2, &b);
- PlatformThread::Join(a);
- PlatformThread::Join(b);
-}
-
-#if defined(THREAD_SANITIZER)
-void DataRace() {
- bool *shared = new bool(false);
- TOOLS_SANITY_TEST_CONCURRENT_THREAD thread1(shared), thread2(shared);
- RunInParallel(&thread1, &thread2);
- EXPECT_TRUE(*shared);
- delete shared;
- // We're in a death test - crash.
- CHECK(0);
-}
-#endif
-
-} // namespace
-
-#if defined(THREAD_SANITIZER)
-// A data race detector should report an error in this test.
-TEST(ToolsSanityTest, DataRace) {
- // The suppression regexp must match that in base/debug/tsan_suppressions.cc.
- EXPECT_DEATH(DataRace(), "1 race:base/tools_sanity_unittest.cc");
-}
-#endif
-
-TEST(ToolsSanityTest, AnnotateBenignRace) {
- bool shared = false;
- ANNOTATE_BENIGN_RACE(&shared, "Intentional race - make sure doesn't show up");
- TOOLS_SANITY_TEST_CONCURRENT_THREAD thread1(&shared), thread2(&shared);
- RunInParallel(&thread1, &thread2);
- EXPECT_TRUE(shared);
-}
-
-TEST(ToolsSanityTest, AtomicsAreIgnored) {
- base::subtle::Atomic32 shared = 0;
- ReleaseStoreThread thread1(&shared);
- AcquireLoadThread thread2(&shared);
- RunInParallel(&thread1, &thread2);
- EXPECT_EQ(kMagicValue, shared);
-}
-
-} // namespace base
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc
index b5d4298e65..0babcc3508 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -10,7 +10,6 @@
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/debug/leak_annotations.h"
#include "base/format_macros.h"
#include "base/json/string_escape.h"
#include "base/lazy_instance.h"
@@ -27,7 +26,6 @@
#include "base/synchronization/cancellation_flag.h"
#include "base/synchronization/waitable_event.h"
#include "base/sys_info.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_id_name_manager.h"
@@ -1273,14 +1271,6 @@ TraceLog::TraceLog()
// accessing the enabled flag. We don't care whether edge-case events are
// traced or not, so we allow races on the enabled flag to keep the trace
// macros fast.
- // TODO(jbates): ANNOTATE_BENIGN_RACE_SIZED crashes windows TSAN bots:
- // ANNOTATE_BENIGN_RACE_SIZED(g_category_group_enabled,
- // sizeof(g_category_group_enabled),
- // "trace_event category enabled");
- for (int i = 0; i < MAX_CATEGORY_GROUPS; ++i) {
- ANNOTATE_BENIGN_RACE(&g_category_group_enabled[i],
- "trace_event category enabled");
- }
#if defined(OS_NACL) // NaCl shouldn't expose the process id.
SetProcessID(0);
#else
@@ -1438,7 +1428,6 @@ const unsigned char* TraceLog::GetCategoryGroupEnabledInternal(
// category groups with strings not known at compile time (this is
// required by SetWatchEvent).
const char* new_group = strdup(category_group);
- ANNOTATE_LEAKING_OBJECT_PTR(new_group);
g_category_groups[category_index] = new_group;
DCHECK(!g_category_group_enabled[category_index]);
// Note that if both included and excluded patterns in the
diff --git a/base/trace_event/trace_event_memory.cc b/base/trace_event/trace_event_memory.cc
index 89595890ae..40e1d4a663 100644
--- a/base/trace_event/trace_event_memory.cc
+++ b/base/trace_event/trace_event_memory.cc
@@ -4,7 +4,6 @@
#include "base/trace_event/trace_event_memory.h"
-#include "base/debug/leak_annotations.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/logging.h"
diff --git a/base/trace_event/trace_event_synthetic_delay.cc b/base/trace_event/trace_event_synthetic_delay.cc
index bad79ccbc8..3fb3684c23 100644
--- a/base/trace_event/trace_event_synthetic_delay.cc
+++ b/base/trace_event/trace_event_synthetic_delay.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/memory/singleton.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/trace_event/trace_event_synthetic_delay.h"
namespace {
@@ -81,7 +80,6 @@ void TraceEventSyntheticDelay::Begin() {
// calculation is done with a lock held, it will always be correct. The only
// downside of this is that we may fail to apply some delays when the target
// duration changes.
- ANNOTATE_BENIGN_RACE(&target_duration_, "Synthetic delay duration");
if (!target_duration_.ToInternalValue())
return;
@@ -96,7 +94,6 @@ void TraceEventSyntheticDelay::Begin() {
void TraceEventSyntheticDelay::BeginParallel(base::TimeTicks* out_end_time) {
// See note in Begin().
- ANNOTATE_BENIGN_RACE(&target_duration_, "Synthetic delay duration");
if (!target_duration_.ToInternalValue()) {
*out_end_time = base::TimeTicks();
return;
@@ -111,7 +108,6 @@ void TraceEventSyntheticDelay::BeginParallel(base::TimeTicks* out_end_time) {
void TraceEventSyntheticDelay::End() {
// See note in Begin().
- ANNOTATE_BENIGN_RACE(&target_duration_, "Synthetic delay duration");
if (!target_duration_.ToInternalValue())
return;
diff --git a/base/trace_event/trace_event_system_stats_monitor.cc b/base/trace_event/trace_event_system_stats_monitor.cc
index c08d9b9477..b96e2654e1 100644
--- a/base/trace_event/trace_event_system_stats_monitor.cc
+++ b/base/trace_event/trace_event_system_stats_monitor.cc
@@ -4,7 +4,6 @@
#include "base/trace_event/trace_event_system_stats_monitor.h"
-#include "base/debug/leak_annotations.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index 0a38487c4a..4534e6e58f 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -11,7 +11,6 @@
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
-#include "base/debug/leak_annotations.h"
#include "base/logging.h"
#include "base/process/process_handle.h"
#include "base/profiler/alternate_timer.h"
@@ -825,7 +824,6 @@ void ThreadData::ShutdownSingleThreadedCleanup(bool leak) {
if (leak) {
ThreadData* thread_data = thread_data_list;
while (thread_data) {
- ANNOTATE_LEAKING_OBJECT_PTR(thread_data);
thread_data = thread_data->next();
}
return;
diff --git a/crypto/rsa_private_key_nss.cc b/crypto/rsa_private_key_nss.cc
index 88e55fa576..374e6f9051 100644
--- a/crypto/rsa_private_key_nss.cc
+++ b/crypto/rsa_private_key_nss.cc
@@ -10,7 +10,6 @@
#include <list>
-#include "base/debug/leak_annotations.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
diff --git a/sandbox/linux/tests/unit_tests.cc b/sandbox/linux/tests/unit_tests.cc
index 0df9528d32..b78b5f8da4 100644
--- a/sandbox/linux/tests/unit_tests.cc
+++ b/sandbox/linux/tests/unit_tests.cc
@@ -13,7 +13,6 @@
#include <time.h>
#include <unistd.h>
-#include "base/debug/leak_annotations.h"
#include "base/files/file_util.h"
#include "base/posix/eintr_wrapper.h"
#include "build/build_config.h"