Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: third_party/protobuf/src/google/protobuf/has_bits.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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__

Powered by Google App Engine
This is Rietveld 408576698