| Index: third_party/protobuf/src/google/protobuf/has_bits.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/arena_test_util.h b/third_party/protobuf/src/google/protobuf/has_bits.h
|
| similarity index 67%
|
| copy from third_party/protobuf/src/google/protobuf/arena_test_util.h
|
| copy to third_party/protobuf/src/google/protobuf/has_bits.h
|
| index 690cc706ee5f2d029752fe6f1b323130046938e5..133bc02a2dd5919757fb310e65bff5bbb02a3f74 100644
|
| --- a/third_party/protobuf/src/google/protobuf/arena_test_util.h
|
| +++ b/third_party/protobuf/src/google/protobuf/has_bits.h
|
| @@ -28,33 +28,45 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#ifndef GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
|
| -#define GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
|
| +#ifndef GOOGLE_PROTOBUF_HAS_BITS_H__
|
| +#define GOOGLE_PROTOBUF_HAS_BITS_H__
|
|
|
| +#include <google/protobuf/stubs/common.h>
|
|
|
| namespace google {
|
| namespace protobuf {
|
| namespace internal {
|
|
|
| -class NoHeapChecker {
|
| +template<size_t doublewords>
|
| +class HasBits {
|
| public:
|
| - NoHeapChecker() {
|
| - capture_alloc.Hook();
|
| + HasBits() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { Clear(); }
|
| +
|
| + void Clear() GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
|
| + memset(has_bits_, 0, sizeof(has_bits_));
|
| + }
|
| +
|
| + ::google::protobuf::uint32& operator[](int index) GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
|
| + return has_bits_[index];
|
| + }
|
| +
|
| + const ::google::protobuf::uint32& operator[](int index) const GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
|
| + return has_bits_[index];
|
| + }
|
| +
|
| + bool operator==(const HasBits<doublewords>& rhs) const {
|
| + return memcmp(has_bits_, rhs.has_bits_, sizeof(has_bits_)) == 0;
|
| + }
|
| +
|
| + bool operator!=(const HasBits<doublewords>& rhs) const {
|
| + return !(*this == rhs);
|
| }
|
| - ~NoHeapChecker();
|
| private:
|
| - class NewDeleteCapture {
|
| - public:
|
| - // TOOD(xiaofeng): Implement this for opensource protobuf.
|
| - void Hook() {}
|
| - void Unhook() {}
|
| - int alloc_count() { return 0; }
|
| - int free_count() { return 0; }
|
| - } capture_alloc;
|
| + ::google::protobuf::uint32 has_bits_[doublewords];
|
| };
|
|
|
| } // namespace internal
|
| } // namespace protobuf
|
|
|
| } // namespace google
|
| -#endif // GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
|
| +#endif // GOOGLE_PROTOBUF_HAS_BITS_H__
|
|
|