Remove atomicops, and some unused bind helpers
Change-Id: I8a7ed3547011dd823286bdc056889ab7a9477443
Reviewed-on: https://gn-review.googlesource.com/1623
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/base/atomic_sequence_num.h b/base/atomic_sequence_num.h
deleted file mode 100644
index 717e37a..0000000
--- a/base/atomic_sequence_num.h
+++ /dev/null
@@ -1,33 +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.
-
-#ifndef BASE_ATOMIC_SEQUENCE_NUM_H_
-#define BASE_ATOMIC_SEQUENCE_NUM_H_
-
-#include <atomic>
-
-#include "base/macros.h"
-
-namespace base {
-
-// AtomicSequenceNumber is a thread safe increasing sequence number generator.
-// Its constructor doesn't emit a static initializer, so it's safe to use as a
-// global variable or static member.
-class AtomicSequenceNumber {
- public:
- constexpr AtomicSequenceNumber() = default;
-
- // Returns an increasing sequence number starts from 0 for each call.
- // This function can be called from any thread without data race.
- inline int GetNext() { return seq_.fetch_add(1, std::memory_order_relaxed); }
-
- private:
- std::atomic_int seq_{0};
-
- DISALLOW_COPY_AND_ASSIGN(AtomicSequenceNumber);
-};
-
-} // namespace base
-
-#endif // BASE_ATOMIC_SEQUENCE_NUM_H_
diff --git a/base/atomicops.h b/base/atomicops.h
deleted file mode 100644
index ccf05f9..0000000
--- a/base/atomicops.h
+++ /dev/null
@@ -1,161 +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.
-
-// For atomic operations on reference counts, see atomic_refcount.h.
-// For atomic operations on sequence numbers, see atomic_sequence_num.h.
-
-// The routines exported by this module are subtle. If you use them, even if
-// you get the code right, it will depend on careful reasoning about atomicity
-// and memory ordering; it will be less readable, and harder to maintain. If
-// you plan to use these routines, you should have a good reason, such as solid
-// evidence that performance would otherwise suffer, or there being no
-// alternative. You should assume only properties explicitly guaranteed by the
-// specifications in this file. You are almost certainly _not_ writing code
-// just for the x86; if you assume x86 semantics, x86 hardware bugs and
-// implementations on other archtectures will cause your code to break. If you
-// do not know what you are doing, avoid these routines, and use a Mutex.
-//
-// It is incorrect to make direct assignments to/from an atomic variable.
-// You should use one of the Load or Store routines. The NoBarrier
-// versions are provided when no barriers are needed:
-// NoBarrier_Store()
-// NoBarrier_Load()
-// Although there are currently no compiler enforcement, you are encouraged
-// to use these.
-//
-
-#ifndef BASE_ATOMICOPS_H_
-#define BASE_ATOMICOPS_H_
-
-#include <stdint.h>
-
-// Small C++ header which defines implementation specific macros used to
-// identify the STL implementation.
-// - libc++: captures __config for _LIBCPP_VERSION
-// - libstdc++: captures bits/c++config.h for __GLIBCXX__
-#include <cstddef>
-
-#include "base/base_export.h"
-#include "build_config.h"
-
-#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS)
-// windows.h #defines this (only on x64). This causes problems because the
-// public API also uses MemoryBarrier at the public name for this fence. So, on
-// X64, undef it, and call its documented
-// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx)
-// implementation directly.
-#undef MemoryBarrier
-#endif
-
-namespace base {
-namespace subtle {
-
-typedef int32_t Atomic32;
-#ifdef ARCH_CPU_64_BITS
-// We need to be able to go between Atomic64 and AtomicWord implicitly. This
-// means Atomic64 and AtomicWord should be the same type on 64-bit.
-#if defined(__ILP32__) || defined(OS_NACL)
-// NaCl's intptr_t is not actually 64-bits on 64-bit!
-// http://code.google.com/p/nativeclient/issues/detail?id=1162
-typedef int64_t Atomic64;
-#else
-typedef intptr_t Atomic64;
-#endif
-#endif
-
-// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
-// Atomic64 routines below, depending on your architecture.
-typedef intptr_t AtomicWord;
-
-// Atomically execute:
-// result = *ptr;
-// if (*ptr == old_value)
-// *ptr = new_value;
-// return result;
-//
-// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
-// Always return the old value of "*ptr"
-//
-// This routine implies no memory barriers.
-Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value);
-
-// Atomically store new_value into *ptr, returning the previous value held in
-// *ptr. This routine implies no memory barriers.
-Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value);
-
-// Atomically increment *ptr by "increment". Returns the new value of
-// *ptr with the increment applied. This routine implies no memory barriers.
-Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);
-
-Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
- Atomic32 increment);
-
-// These following lower-level operations are typically useful only to people
-// implementing higher-level synchronization operations like spinlocks,
-// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or
-// a store with appropriate memory-ordering instructions. "Acquire" operations
-// ensure that no later memory access can be reordered ahead of the operation.
-// "Release" operations ensure that no previous memory access can be reordered
-// after the operation. "Barrier" operations have both "Acquire" and "Release"
-// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
-// access.
-Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value);
-Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value);
-
-void MemoryBarrier();
-void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value);
-void Acquire_Store(volatile Atomic32* ptr, Atomic32 value);
-void Release_Store(volatile Atomic32* ptr, Atomic32 value);
-
-Atomic32 NoBarrier_Load(volatile const Atomic32* ptr);
-Atomic32 Acquire_Load(volatile const Atomic32* ptr);
-Atomic32 Release_Load(volatile const Atomic32* ptr);
-
-// 64-bit atomic operations (only available on 64-bit processors).
-#ifdef ARCH_CPU_64_BITS
-Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value);
-Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value);
-Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
-Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
-
-Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value);
-Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value);
-void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value);
-void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
-void Release_Store(volatile Atomic64* ptr, Atomic64 value);
-Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
-Atomic64 Acquire_Load(volatile const Atomic64* ptr);
-Atomic64 Release_Load(volatile const Atomic64* ptr);
-#endif // ARCH_CPU_64_BITS
-
-} // namespace subtle
-} // namespace base
-
-#if defined(OS_WIN)
-// TODO(jfb): Try to use base/atomicops_internals_portable.h everywhere.
-// https://crbug.com/559247.
-# include "base/atomicops_internals_x86_msvc.h"
-#else
-# include "base/atomicops_internals_portable.h"
-#endif
-
-// On some platforms we need additional declarations to make
-// AtomicWord compatible with our other Atomic* types.
-#if defined(OS_MACOSX) || defined(OS_OPENBSD)
-#include "base/atomicops_internals_atomicword_compat.h"
-#endif
-
-#endif // BASE_ATOMICOPS_H_
diff --git a/base/atomicops_internals_atomicword_compat.h b/base/atomicops_internals_atomicword_compat.h
deleted file mode 100644
index d985d10..0000000
--- a/base/atomicops_internals_atomicword_compat.h
+++ /dev/null
@@ -1,104 +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.
-
-// This file is an internal atomic implementation, use base/atomicops.h instead.
-
-#ifndef BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
-#define BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
-
-#include <stdint.h>
-
-#include "build_config.h"
-
-// AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32_t,
-// which in turn means int. On some LP32 platforms, intptr_t is an int, but
-// on others, it's a long. When AtomicWord and Atomic32 are based on different
-// fundamental types, their pointers are incompatible.
-//
-// This file defines function overloads to allow both AtomicWord and Atomic32
-// data to be used with this interface.
-//
-// On LP64 platforms, AtomicWord and Atomic64 are both always long,
-// so this problem doesn't occur.
-
-#if !defined(ARCH_CPU_64_BITS)
-
-namespace base {
-namespace subtle {
-
-inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
- return NoBarrier_CompareAndSwap(
- reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
-}
-
-inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr,
- AtomicWord new_value) {
- return NoBarrier_AtomicExchange(
- reinterpret_cast<volatile Atomic32*>(ptr), new_value);
-}
-
-inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr,
- AtomicWord increment) {
- return NoBarrier_AtomicIncrement(
- reinterpret_cast<volatile Atomic32*>(ptr), increment);
-}
-
-inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr,
- AtomicWord increment) {
- return Barrier_AtomicIncrement(
- reinterpret_cast<volatile Atomic32*>(ptr), increment);
-}
-
-inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
- return base::subtle::Acquire_CompareAndSwap(
- reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
-}
-
-inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
- return base::subtle::Release_CompareAndSwap(
- reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
-}
-
-inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) {
- NoBarrier_Store(
- reinterpret_cast<volatile Atomic32*>(ptr), value);
-}
-
-inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
- return base::subtle::Acquire_Store(
- reinterpret_cast<volatile Atomic32*>(ptr), value);
-}
-
-inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
- return base::subtle::Release_Store(
- reinterpret_cast<volatile Atomic32*>(ptr), value);
-}
-
-inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) {
- return NoBarrier_Load(
- reinterpret_cast<volatile const Atomic32*>(ptr));
-}
-
-inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
- return base::subtle::Acquire_Load(
- reinterpret_cast<volatile const Atomic32*>(ptr));
-}
-
-inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
- return base::subtle::Release_Load(
- reinterpret_cast<volatile const Atomic32*>(ptr));
-}
-
-} // namespace subtle
-} // namespace base
-
-#endif // !defined(ARCH_CPU_64_BITS)
-
-#endif // BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
diff --git a/base/atomicops_internals_portable.h b/base/atomicops_internals_portable.h
deleted file mode 100644
index b75d080..0000000
--- a/base/atomicops_internals_portable.h
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright (c) 2014 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 is an internal atomic implementation, use atomicops.h instead.
-//
-// This implementation uses C++11 atomics' member functions. The code base is
-// currently written assuming atomicity revolves around accesses instead of
-// C++11's memory locations. The burden is on the programmer to ensure that all
-// memory locations accessed atomically are never accessed non-atomically (tsan
-// should help with this).
-//
-// TODO(jfb) Modify the atomicops.h API and user code to declare atomic
-// locations as truly atomic. See the static_assert below.
-//
-// Of note in this implementation:
-// * All NoBarrier variants are implemented as relaxed.
-// * All Barrier variants are implemented as sequentially-consistent.
-// * Compare exchange's failure ordering is always the same as the success one
-// (except for release, which fails as relaxed): using a weaker ordering is
-// only valid under certain uses of compare exchange.
-// * Acquire store doesn't exist in the C11 memory model, it is instead
-// implemented as a relaxed store followed by a sequentially consistent
-// fence.
-// * Release load doesn't exist in the C11 memory model, it is instead
-// implemented as sequentially consistent fence followed by a relaxed load.
-// * Atomic increment is expected to return the post-incremented value, whereas
-// C11 fetch add returns the previous value. The implementation therefore
-// needs to increment twice (which the compiler should be able to detect and
-// optimize).
-
-#ifndef BASE_ATOMICOPS_INTERNALS_PORTABLE_H_
-#define BASE_ATOMICOPS_INTERNALS_PORTABLE_H_
-
-#include <atomic>
-
-#include "build_config.h"
-
-namespace base {
-namespace subtle {
-
-// This implementation is transitional and maintains the original API for
-// atomicops.h. This requires casting memory locations to the atomic types, and
-// assumes that the API and the C++11 implementation are layout-compatible,
-// which isn't true for all implementations or hardware platforms. The static
-// assertion should detect this issue, were it to fire then this header
-// shouldn't be used.
-//
-// TODO(jfb) If this header manages to stay committed then the API should be
-// modified, and all call sites updated.
-typedef volatile std::atomic<Atomic32>* AtomicLocation32;
-static_assert(sizeof(*(AtomicLocation32) nullptr) == sizeof(Atomic32),
- "incompatible 32-bit atomic layout");
-
-inline void MemoryBarrier() {
-#if defined(__GLIBCXX__)
- // Work around libstdc++ bug 51038 where atomic_thread_fence was declared but
- // not defined, leading to the linker complaining about undefined references.
- __atomic_thread_fence(std::memory_order_seq_cst);
-#else
- std::atomic_thread_fence(std::memory_order_seq_cst);
-#endif
-}
-
-inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
- ((AtomicLocation32)ptr)
- ->compare_exchange_strong(old_value,
- new_value,
- std::memory_order_relaxed,
- std::memory_order_relaxed);
- return old_value;
-}
-
-inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
- Atomic32 new_value) {
- return ((AtomicLocation32)ptr)
- ->exchange(new_value, std::memory_order_relaxed);
-}
-
-inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
- Atomic32 increment) {
- return increment +
- ((AtomicLocation32)ptr)
- ->fetch_add(increment, std::memory_order_relaxed);
-}
-
-inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
- Atomic32 increment) {
- return increment + ((AtomicLocation32)ptr)->fetch_add(increment);
-}
-
-inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
- ((AtomicLocation32)ptr)
- ->compare_exchange_strong(old_value,
- new_value,
- std::memory_order_acquire,
- std::memory_order_acquire);
- return old_value;
-}
-
-inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
- ((AtomicLocation32)ptr)
- ->compare_exchange_strong(old_value,
- new_value,
- std::memory_order_release,
- std::memory_order_relaxed);
- return old_value;
-}
-
-inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
- ((AtomicLocation32)ptr)->store(value, std::memory_order_relaxed);
-}
-
-inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
- ((AtomicLocation32)ptr)->store(value, std::memory_order_relaxed);
- MemoryBarrier();
-}
-
-inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
- ((AtomicLocation32)ptr)->store(value, std::memory_order_release);
-}
-
-inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
- return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed);
-}
-
-inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
- return ((AtomicLocation32)ptr)->load(std::memory_order_acquire);
-}
-
-inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
- MemoryBarrier();
- return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed);
-}
-
-#if defined(ARCH_CPU_64_BITS)
-
-typedef volatile std::atomic<Atomic64>* AtomicLocation64;
-static_assert(sizeof(*(AtomicLocation64) nullptr) == sizeof(Atomic64),
- "incompatible 64-bit atomic layout");
-
-inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value) {
- ((AtomicLocation64)ptr)
- ->compare_exchange_strong(old_value,
- new_value,
- std::memory_order_relaxed,
- std::memory_order_relaxed);
- return old_value;
-}
-
-inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
- Atomic64 new_value) {
- return ((AtomicLocation64)ptr)
- ->exchange(new_value, std::memory_order_relaxed);
-}
-
-inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
- Atomic64 increment) {
- return increment +
- ((AtomicLocation64)ptr)
- ->fetch_add(increment, std::memory_order_relaxed);
-}
-
-inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
- Atomic64 increment) {
- return increment + ((AtomicLocation64)ptr)->fetch_add(increment);
-}
-
-inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value) {
- ((AtomicLocation64)ptr)
- ->compare_exchange_strong(old_value,
- new_value,
- std::memory_order_acquire,
- std::memory_order_acquire);
- return old_value;
-}
-
-inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value) {
- ((AtomicLocation64)ptr)
- ->compare_exchange_strong(old_value,
- new_value,
- std::memory_order_release,
- std::memory_order_relaxed);
- return old_value;
-}
-
-inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
- ((AtomicLocation64)ptr)->store(value, std::memory_order_relaxed);
-}
-
-inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
- ((AtomicLocation64)ptr)->store(value, std::memory_order_relaxed);
- MemoryBarrier();
-}
-
-inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
- ((AtomicLocation64)ptr)->store(value, std::memory_order_release);
-}
-
-inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
- return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed);
-}
-
-inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
- return ((AtomicLocation64)ptr)->load(std::memory_order_acquire);
-}
-
-inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
- MemoryBarrier();
- return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed);
-}
-
-#endif // defined(ARCH_CPU_64_BITS)
-} // namespace subtle
-} // namespace base
-
-#endif // BASE_ATOMICOPS_INTERNALS_PORTABLE_H_
diff --git a/base/atomicops_internals_x86_msvc.h b/base/atomicops_internals_x86_msvc.h
deleted file mode 100644
index 38001a8..0000000
--- a/base/atomicops_internals_x86_msvc.h
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright (c) 2006-2008 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 is an internal atomic implementation, use base/atomicops.h instead.
-
-#ifndef BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_
-#define BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_
-
-#include "base/win/windows_types.h"
-
-#include <intrin.h>
-
-#include "base/macros.h"
-#include "build_config.h"
-
-#if defined(ARCH_CPU_64_BITS)
-// windows.h #defines this (only on x64). This causes problems because the
-// public API also uses MemoryBarrier at the public name for this fence. So, on
-// X64, undef it, and call its documented
-// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx)
-// implementation directly.
-#undef MemoryBarrier
-#endif
-
-namespace base {
-namespace subtle {
-
-inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
- LONG result = _InterlockedCompareExchange(
- reinterpret_cast<volatile LONG*>(ptr),
- static_cast<LONG>(new_value),
- static_cast<LONG>(old_value));
- return static_cast<Atomic32>(result);
-}
-
-inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
- Atomic32 new_value) {
- LONG result = _InterlockedExchange(
- reinterpret_cast<volatile LONG*>(ptr),
- static_cast<LONG>(new_value));
- return static_cast<Atomic32>(result);
-}
-
-inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
- Atomic32 increment) {
- return _InterlockedExchangeAdd(
- reinterpret_cast<volatile LONG*>(ptr),
- static_cast<LONG>(increment)) + increment;
-}
-
-inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
- Atomic32 increment) {
- return Barrier_AtomicIncrement(ptr, increment);
-}
-
-inline void MemoryBarrier() {
-#if defined(ARCH_CPU_64_BITS)
- // See #undef and note at the top of this file.
- __faststorefence();
-#else
- // We use the implementation of MemoryBarrier from WinNT.h
- LONG barrier;
-
- _InterlockedOr(&barrier, 0);
-#endif
-}
-
-inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
-}
-
-inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
-}
-
-inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
- *ptr = value;
-}
-
-inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
- NoBarrier_AtomicExchange(ptr, value);
- // acts as a barrier in this implementation
-}
-
-inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
- *ptr = value; // works w/o barrier for current Intel chips as of June 2005
- // See comments in Atomic64 version of Release_Store() below.
-}
-
-inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
- return *ptr;
-}
-
-inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
- Atomic32 value = *ptr;
- return value;
-}
-
-inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
- MemoryBarrier();
- return *ptr;
-}
-
-#if defined(_WIN64)
-
-// 64-bit low-level operations on 64-bit platform.
-
-static_assert(sizeof(Atomic64) == sizeof(PVOID), "atomic word is atomic");
-
-inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value) {
- PVOID result = _InterlockedCompareExchangePointer(
- reinterpret_cast<volatile PVOID*>(ptr),
- reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value));
- return reinterpret_cast<Atomic64>(result);
-}
-
-inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
- Atomic64 new_value) {
- PVOID result =
- _InterlockedExchangePointer(reinterpret_cast<volatile PVOID*>(ptr),
- reinterpret_cast<PVOID>(new_value));
- return reinterpret_cast<Atomic64>(result);
-}
-
-inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
- Atomic64 increment) {
- return _InterlockedExchangeAdd64(reinterpret_cast<volatile LONGLONG*>(ptr),
- static_cast<LONGLONG>(increment)) +
- increment;
-}
-
-inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
- Atomic64 increment) {
- return Barrier_AtomicIncrement(ptr, increment);
-}
-
-inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
- *ptr = value;
-}
-
-inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
- NoBarrier_AtomicExchange(ptr, value);
- // acts as a barrier in this implementation
-}
-
-inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
- *ptr = value; // works w/o barrier for current Intel chips as of June 2005
-
- // When new chips come out, check:
- // IA-32 Intel Architecture Software Developer's Manual, Volume 3:
- // System Programming Guide, Chatper 7: Multiple-processor management,
- // Section 7.2, Memory Ordering.
- // Last seen at:
- // http://developer.intel.com/design/pentium4/manuals/index_new.htm
-}
-
-inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
- return *ptr;
-}
-
-inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
- Atomic64 value = *ptr;
- return value;
-}
-
-inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
- MemoryBarrier();
- return *ptr;
-}
-
-inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value) {
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
-}
-
-inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
- Atomic64 old_value,
- Atomic64 new_value) {
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
-}
-
-
-#endif // defined(_WIN64)
-
-} // namespace subtle
-} // namespace base
-
-#endif // BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_
diff --git a/base/bind_helpers.h b/base/bind_helpers.h
deleted file mode 100644
index f4bbd80..0000000
--- a/base/bind_helpers.h
+++ /dev/null
@@ -1,69 +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_BIND_HELPERS_H_
-#define BASE_BIND_HELPERS_H_
-
-#include <stddef.h>
-
-#include <type_traits>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "build_config.h"
-
-// This defines a set of simple functions and utilities that people want when
-// using Callback<> and Bind().
-
-namespace base {
-
-// Creates a null callback.
-class BASE_EXPORT NullCallback {
- public:
- template <typename R, typename... Args>
- operator RepeatingCallback<R(Args...)>() const {
- return RepeatingCallback<R(Args...)>();
- }
- template <typename R, typename... Args>
- operator OnceCallback<R(Args...)>() const {
- return OnceCallback<R(Args...)>();
- }
-};
-
-// Creates a callback that does nothing when called.
-class BASE_EXPORT DoNothing {
- public:
- template <typename... Args>
- operator RepeatingCallback<void(Args...)>() const {
- return Repeatedly<Args...>();
- }
- template <typename... Args>
- operator OnceCallback<void(Args...)>() const {
- return Once<Args...>();
- }
- // Explicit way of specifying a specific callback type when the compiler can't
- // deduce it.
- template <typename... Args>
- static RepeatingCallback<void(Args...)> Repeatedly() {
- return BindRepeating([](Args... args) {});
- }
- template <typename... Args>
- static OnceCallback<void(Args...)> Once() {
- return BindOnce([](Args... args) {});
- }
-};
-
-// Useful for creating a Closure that will delete a pointer when invoked. Only
-// use this when necessary. In most cases MessageLoop::DeleteSoon() is a better
-// fit.
-template <typename T>
-void DeletePointer(T* obj) {
- delete obj;
-}
-
-} // namespace base
-
-#endif // BASE_BIND_HELPERS_H_
diff --git a/base/bits.h b/base/bits.h
deleted file mode 100644
index b02f303..0000000
--- a/base/bits.h
+++ /dev/null
@@ -1,184 +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.
-
-// This file defines some bit utilities.
-
-#ifndef BASE_BITS_H_
-#define BASE_BITS_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "build_config.h"
-
-#if defined(COMPILER_MSVC)
-#include <intrin.h>
-#endif
-
-namespace base {
-namespace bits {
-
-// Returns true iff |value| is a power of 2.
-template <typename T,
- typename = typename std::enable_if<std::is_integral<T>::value>>
-constexpr inline bool IsPowerOfTwo(T value) {
- // From "Hacker's Delight": Section 2.1 Manipulating Rightmost Bits.
- //
- // Only positive integers with a single bit set are powers of two. If only one
- // bit is set in x (e.g. 0b00000100000000) then |x-1| will have that bit set
- // to zero and all bits to its right set to 1 (e.g. 0b00000011111111). Hence
- // |x & (x-1)| is 0 iff x is a power of two.
- return value > 0 && (value & (value - 1)) == 0;
-}
-
-// Round up |size| to a multiple of alignment, which must be a power of two.
-inline size_t Align(size_t size, size_t alignment) {
- DCHECK(IsPowerOfTwo(alignment));
- return (size + alignment - 1) & ~(alignment - 1);
-}
-
-// CountLeadingZeroBits(value) returns the number of zero bits following the
-// most significant 1 bit in |value| if |value| is non-zero, otherwise it
-// returns {sizeof(T) * 8}.
-// Example: 00100010 -> 2
-//
-// CountTrailingZeroBits(value) returns the number of zero bits preceding the
-// least significant 1 bit in |value| if |value| is non-zero, otherwise it
-// returns {sizeof(T) * 8}.
-// Example: 00100010 -> 1
-//
-// C does not have an operator to do this, but fortunately the various
-// compilers have built-ins that map to fast underlying processor instructions.
-#if defined(COMPILER_MSVC)
-
-template <typename T, unsigned bits = sizeof(T) * 8>
-ALWAYS_INLINE
- typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) <= 4,
- unsigned>::type
- CountLeadingZeroBits(T x) {
- static_assert(bits > 0, "invalid instantiation");
- unsigned long index;
- return LIKELY(_BitScanReverse(&index, static_cast<uint32_t>(x)))
- ? (31 - index - (32 - bits))
- : bits;
-}
-
-template <typename T, unsigned bits = sizeof(T) * 8>
-ALWAYS_INLINE
- typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) == 8,
- unsigned>::type
- CountLeadingZeroBits(T x) {
- static_assert(bits > 0, "invalid instantiation");
- unsigned long index;
- return LIKELY(_BitScanReverse64(&index, static_cast<uint64_t>(x)))
- ? (63 - index)
- : 64;
-}
-
-template <typename T, unsigned bits = sizeof(T) * 8>
-ALWAYS_INLINE
- typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) <= 4,
- unsigned>::type
- CountTrailingZeroBits(T x) {
- static_assert(bits > 0, "invalid instantiation");
- unsigned long index;
- return LIKELY(_BitScanForward(&index, static_cast<uint32_t>(x))) ? index
- : bits;
-}
-
-template <typename T, unsigned bits = sizeof(T) * 8>
-ALWAYS_INLINE
- typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) == 8,
- unsigned>::type
- CountTrailingZeroBits(T x) {
- static_assert(bits > 0, "invalid instantiation");
- unsigned long index;
- return LIKELY(_BitScanForward64(&index, static_cast<uint64_t>(x))) ? index
- : 64;
-}
-
-ALWAYS_INLINE uint32_t CountLeadingZeroBits32(uint32_t x) {
- return CountLeadingZeroBits(x);
-}
-
-#if defined(ARCH_CPU_64_BITS)
-
-// MSVC only supplies _BitScanForward64 when building for a 64-bit target.
-ALWAYS_INLINE uint64_t CountLeadingZeroBits64(uint64_t x) {
- return CountLeadingZeroBits(x);
-}
-
-#endif
-
-#elif defined(COMPILER_GCC)
-
-// __builtin_clz has undefined behaviour for an input of 0, even though there's
-// clearly a return value that makes sense, and even though some processor clz
-// instructions have defined behaviour for 0. We could drop to raw __asm__ to
-// do better, but we'll avoid doing that unless we see proof that we need to.
-template <typename T, unsigned bits = sizeof(T) * 8>
-ALWAYS_INLINE
- typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) <= 8,
- unsigned>::type
- CountLeadingZeroBits(T value) {
- static_assert(bits > 0, "invalid instantiation");
- return LIKELY(value)
- ? bits == 64
- ? __builtin_clzll(static_cast<uint64_t>(value))
- : __builtin_clz(static_cast<uint32_t>(value)) - (32 - bits)
- : bits;
-}
-
-template <typename T, unsigned bits = sizeof(T) * 8>
-ALWAYS_INLINE
- typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) <= 8,
- unsigned>::type
- CountTrailingZeroBits(T value) {
- return LIKELY(value) ? bits == 64
- ? __builtin_ctzll(static_cast<uint64_t>(value))
- : __builtin_ctz(static_cast<uint32_t>(value))
- : bits;
-}
-
-ALWAYS_INLINE uint32_t CountLeadingZeroBits32(uint32_t x) {
- return CountLeadingZeroBits(x);
-}
-
-#if defined(ARCH_CPU_64_BITS)
-
-ALWAYS_INLINE uint64_t CountLeadingZeroBits64(uint64_t x) {
- return CountLeadingZeroBits(x);
-}
-
-#endif
-
-#endif
-
-ALWAYS_INLINE size_t CountLeadingZeroBitsSizeT(size_t x) {
- return CountLeadingZeroBits(x);
-}
-
-ALWAYS_INLINE size_t CountTrailingZeroBitsSizeT(size_t x) {
- return CountTrailingZeroBits(x);
-}
-
-// Returns the integer i such as 2^i <= n < 2^(i+1)
-inline int Log2Floor(uint32_t n) {
- return 31 - CountLeadingZeroBits(n);
-}
-
-// Returns the integer i such as 2^(i-1) < n <= 2^i
-inline int Log2Ceiling(uint32_t n) {
- // When n == 0, we want the function to return -1.
- // When n == 0, (n - 1) will underflow to 0xFFFFFFFF, which is
- // why the statement below starts with (n ? 32 : -1).
- return (n ? 32 : -1) - CountLeadingZeroBits(n - 1);
-}
-
-} // namespace bits
-} // namespace base
-
-#endif // BASE_BITS_H_
diff --git a/base/callback_helpers.cc b/base/callback_helpers.cc
deleted file mode 100644
index 9086731..0000000
--- a/base/callback_helpers.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 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.
-
-#include "base/callback_helpers.h"
-
-namespace base {
-
-ScopedClosureRunner::ScopedClosureRunner() = default;
-
-ScopedClosureRunner::ScopedClosureRunner(OnceClosure closure)
- : closure_(std::move(closure)) {}
-
-ScopedClosureRunner::~ScopedClosureRunner() {
- if (!closure_.is_null())
- std::move(closure_).Run();
-}
-
-ScopedClosureRunner::ScopedClosureRunner(ScopedClosureRunner&& other)
- : closure_(other.Release()) {}
-
-ScopedClosureRunner& ScopedClosureRunner::operator=(
- ScopedClosureRunner&& other) {
- ReplaceClosure(other.Release());
- return *this;
-}
-
-void ScopedClosureRunner::RunAndReset() {
- std::move(closure_).Run();
-}
-
-void ScopedClosureRunner::ReplaceClosure(OnceClosure closure) {
- closure_ = std::move(closure);
-}
-
-OnceClosure ScopedClosureRunner::Release() {
- return std::move(closure_);
-}
-
-} // namespace base
diff --git a/base/callback_helpers.h b/base/callback_helpers.h
deleted file mode 100644
index 0cdda6d..0000000
--- a/base/callback_helpers.h
+++ /dev/null
@@ -1,104 +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 defines helpful methods for dealing with Callbacks. Because Callbacks
-// are implemented using templates, with a class per callback signature, adding
-// methods to Callback<> itself is unattractive (lots of extra code gets
-// generated). Instead, consider adding methods here.
-
-#ifndef BASE_CALLBACK_HELPERS_H_
-#define BASE_CALLBACK_HELPERS_H_
-
-#include <utility>
-
-#include "base/atomicops.h"
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-
-namespace base {
-
-// Prefer std::move() over ResetAndReturn().
-template <typename CallbackType>
-CallbackType ResetAndReturn(CallbackType* cb) {
- CallbackType ret(std::move(*cb));
- DCHECK(!*cb);
- return ret;
-}
-
-namespace internal {
-
-template <typename... Args>
-class AdaptCallbackForRepeatingHelper final {
- public:
- explicit AdaptCallbackForRepeatingHelper(OnceCallback<void(Args...)> callback)
- : callback_(std::move(callback)) {
- DCHECK(callback_);
- }
-
- void Run(Args... args) {
- if (subtle::NoBarrier_AtomicExchange(&has_run_, 1))
- return;
- DCHECK(callback_);
- std::move(callback_).Run(std::forward<Args>(args)...);
- }
-
- private:
- volatile subtle::Atomic32 has_run_ = 0;
- base::OnceCallback<void(Args...)> callback_;
-
- DISALLOW_COPY_AND_ASSIGN(AdaptCallbackForRepeatingHelper);
-};
-
-} // namespace internal
-
-// Wraps the given OnceCallback into a RepeatingCallback that relays its
-// invocation to the original OnceCallback on the first invocation. The
-// following invocations are just ignored.
-//
-// Note that this deliberately subverts the Once/Repeating paradigm of Callbacks
-// but helps ease the migration from old-style Callbacks. Avoid if possible; use
-// if necessary for migration. TODO(tzik): Remove it. https://crbug.com/730593
-template <typename... Args>
-RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
- OnceCallback<void(Args...)> callback) {
- using Helper = internal::AdaptCallbackForRepeatingHelper<Args...>;
- return base::BindRepeating(&Helper::Run,
- std::make_unique<Helper>(std::move(callback)));
-}
-
-// ScopedClosureRunner is akin to std::unique_ptr<> for Closures. It ensures
-// that the Closure is executed no matter how the current scope exits.
-class BASE_EXPORT ScopedClosureRunner {
- public:
- ScopedClosureRunner();
- explicit ScopedClosureRunner(OnceClosure closure);
- ~ScopedClosureRunner();
-
- ScopedClosureRunner(ScopedClosureRunner&& other);
-
- // Releases the current closure if it's set and replaces it with the closure
- // from |other|.
- ScopedClosureRunner& operator=(ScopedClosureRunner&& other);
-
- // Calls the current closure and resets it, so it wont be called again.
- void RunAndReset();
-
- // Replaces closure with the new one releasing the old one without calling it.
- void ReplaceClosure(OnceClosure closure);
-
- // Releases the Closure without calling.
- OnceClosure Release() WARN_UNUSED_RESULT;
-
- private:
- OnceClosure closure_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
-};
-
-} // namespace base
-
-#endif // BASE_CALLBACK_HELPERS_H_
diff --git a/base/time/time_win.cc b/base/time/time_win.cc
index 6767fd6..ba220d6 100644
--- a/base/time/time_win.cc
+++ b/base/time/time_win.cc
@@ -37,7 +37,6 @@
#include <mmsystem.h>
#include <stdint.h>
-#include "base/atomicops.h"
#include "base/bit_cast.h"
#include "base/logging.h"
#include "base/synchronization/lock.h"
diff --git a/base/win/wrapped_window_proc.cc b/base/win/wrapped_window_proc.cc
deleted file mode 100644
index 0a00996..0000000
--- a/base/win/wrapped_window_proc.cc
+++ /dev/null
@@ -1,78 +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.
-
-#include "base/win/wrapped_window_proc.h"
-
-#include "base/atomicops.h"
-#include "base/logging.h"
-
-namespace {
-
-base::win::WinProcExceptionFilter s_exception_filter = NULL;
-
-HMODULE GetModuleFromWndProc(WNDPROC window_proc) {
- HMODULE instance = NULL;
- // Converting a pointer-to-function to a void* is undefined behavior, but
- // Windows (and POSIX) APIs require it to work.
- void* address = reinterpret_cast<void*>(window_proc);
- if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
- GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
- static_cast<char*>(address),
- &instance)) {
- NOTREACHED();
- }
- return instance;
-}
-
-} // namespace.
-
-namespace base {
-namespace win {
-
-WinProcExceptionFilter SetWinProcExceptionFilter(
- WinProcExceptionFilter filter) {
- subtle::AtomicWord rv = subtle::NoBarrier_AtomicExchange(
- reinterpret_cast<subtle::AtomicWord*>(&s_exception_filter),
- reinterpret_cast<subtle::AtomicWord>(filter));
- return reinterpret_cast<WinProcExceptionFilter>(rv);
-}
-
-int CallExceptionFilter(EXCEPTION_POINTERS* info) {
- return s_exception_filter ? s_exception_filter(info) :
- EXCEPTION_CONTINUE_SEARCH;
-}
-
-BASE_EXPORT void InitializeWindowClass(
- const char16* class_name,
- WNDPROC window_proc,
- UINT style,
- int class_extra,
- int window_extra,
- HCURSOR cursor,
- HBRUSH background,
- const char16* menu_name,
- HICON large_icon,
- HICON small_icon,
- WNDCLASSEX* class_out) {
- class_out->cbSize = sizeof(WNDCLASSEX);
- class_out->style = style;
- class_out->lpfnWndProc = window_proc;
- class_out->cbClsExtra = class_extra;
- class_out->cbWndExtra = window_extra;
- // RegisterClassEx uses a handle of the module containing the window procedure
- // to distinguish identically named classes registered in different modules.
- class_out->hInstance = GetModuleFromWndProc(window_proc);
- class_out->hIcon = large_icon;
- class_out->hCursor = cursor;
- class_out->hbrBackground = background;
- class_out->lpszMenuName = menu_name;
- class_out->lpszClassName = class_name;
- class_out->hIconSm = small_icon;
-
- // Check if |window_proc| is valid.
- DCHECK(class_out->hInstance != NULL);
-}
-
-} // namespace win
-} // namespace base
diff --git a/base/win/wrapped_window_proc.h b/base/win/wrapped_window_proc.h
deleted file mode 100644
index c586be0..0000000
--- a/base/win/wrapped_window_proc.h
+++ /dev/null
@@ -1,85 +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.
-
-// Provides a way to handle exceptions that happen while a WindowProc is
-// running. The behavior of exceptions generated inside a WindowProc is OS
-// dependent, but it is possible that the OS just ignores the exception and
-// continues execution, which leads to unpredictable behavior for Chrome.
-
-#ifndef BASE_WIN_WRAPPED_WINDOW_PROC_H_
-#define BASE_WIN_WRAPPED_WINDOW_PROC_H_
-
-#include <windows.h>
-
-#include "base/base_export.h"
-#include "base/strings/string16.h"
-
-namespace base {
-namespace win {
-
-// An exception filter for a WindowProc. The return value determines how the
-// exception should be handled, following standard SEH rules. However, the
-// expected behavior for this function is to not return, instead of returning
-// EXCEPTION_EXECUTE_HANDLER or similar, given that in general we are not
-// prepared to handle exceptions.
-typedef int (__cdecl *WinProcExceptionFilter)(EXCEPTION_POINTERS* info);
-
-// Sets the filter to deal with exceptions inside a WindowProc. Returns the old
-// exception filter, if any.
-// This function should be called before any window is created.
-BASE_EXPORT WinProcExceptionFilter SetWinProcExceptionFilter(
- WinProcExceptionFilter filter);
-
-// Calls the registered exception filter.
-BASE_EXPORT int CallExceptionFilter(EXCEPTION_POINTERS* info);
-
-// Initializes the WNDCLASSEX structure |*class_out| to be passed to
-// RegisterClassEx() making sure that it is associated with the module
-// containing the window procedure.
-BASE_EXPORT void InitializeWindowClass(
- const char16* class_name,
- WNDPROC window_proc,
- UINT style,
- int class_extra,
- int window_extra,
- HCURSOR cursor,
- HBRUSH background,
- const char16* menu_name,
- HICON large_icon,
- HICON small_icon,
- WNDCLASSEX* class_out);
-
-// Wrapper that supplies a standard exception frame for the provided WindowProc.
-// The normal usage is something like this:
-//
-// LRESULT CALLBACK MyWinProc(HWND hwnd, UINT message,
-// WPARAM wparam, LPARAM lparam) {
-// // Do Something.
-// }
-//
-// ...
-//
-// WNDCLASSEX wc = {0};
-// wc.lpfnWndProc = WrappedWindowProc<MyWinProc>;
-// wc.lpszClassName = class_name;
-// ...
-// RegisterClassEx(&wc);
-//
-// CreateWindowW(class_name, window_name, ...
-//
-template <WNDPROC proc>
-LRESULT CALLBACK
-WrappedWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
- LRESULT rv = 0;
- __try {
- rv = proc(hwnd, message, wparam, lparam);
- } __except(CallExceptionFilter(GetExceptionInformation())) {
- }
- return rv;
-}
-
-} // namespace win
-} // namespace base
-
-#endif // BASE_WIN_WRAPPED_WINDOW_PROC_H_
diff --git a/build/gen.py b/build/gen.py
index ed92d2f..318e728 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -225,7 +225,6 @@
static_libraries = {
'base': {'sources': [
- 'base/callback_helpers.cc',
'base/callback_internal.cc',
'base/command_line.cc',
'base/environment.cc',
@@ -566,7 +565,6 @@
'base/win/wait_chain.cc',
'base/win/win_util.cc',
'base/win/windows_version.cc',
- 'base/win/wrapped_window_proc.cc',
])
libs.extend([