aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/map_field_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/map_field_test.cc')
-rw-r--r--src/google/protobuf/map_field_test.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/google/protobuf/map_field_test.cc b/src/google/protobuf/map_field_test.cc
index 4e0e751c..f58d59e5 100644
--- a/src/google/protobuf/map_field_test.cc
+++ b/src/google/protobuf/map_field_test.cc
@@ -30,9 +30,6 @@
#include <map>
#include <memory>
-#ifndef _SHARED_PTR_H
-#include <google/protobuf/stubs/shared_ptr.h>
-#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -71,10 +68,18 @@ class MapFieldBaseStub : public MapFieldBase {
RepeatedPtrField<Message>* InternalRepeatedField() {
return repeated_field_;
}
- bool IsMapClean() { return state_ != 0; }
- bool IsRepeatedClean() { return state_ != 1; }
- void SetMapDirty() { state_ = 0; }
- void SetRepeatedDirty() { state_ = 1; }
+ bool IsMapClean() {
+ return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_MAP;
+ }
+ bool IsRepeatedClean() {
+ return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_REPEATED;
+ }
+ void SetMapDirty() {
+ state_.store(STATE_MODIFIED_MAP, std::memory_order_relaxed);
+ }
+ void SetRepeatedDirty() {
+ state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
+ }
bool ContainsMapKey(const MapKey& map_key) const {
return false;
}
@@ -124,7 +129,7 @@ class MapFieldBasePrimitiveTest : public ::testing::Test {
EXPECT_EQ(2, map_->size());
}
- google::protobuf::scoped_ptr<MapFieldType> map_field_;
+ std::unique_ptr<MapFieldType> map_field_;
MapFieldBase* map_field_base_;
Map<int32, int32>* map_;
const Descriptor* map_descriptor_;
@@ -291,7 +296,7 @@ class MapFieldStateTest
}
}
- google::protobuf::scoped_ptr<MapFieldType> map_field_;
+ std::unique_ptr<MapFieldType> map_field_;
MapFieldBase* map_field_base_;
State state_;
};