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

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

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: 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/arenastring.h
diff --git a/third_party/protobuf/src/google/protobuf/arenastring.h b/third_party/protobuf/src/google/protobuf/arenastring.h
index d8bd580670174837148d5df6d5dc2c854853ede2..d983cf6ce50f3ffe85a16d98f56575344900535b 100755
--- a/third_party/protobuf/src/google/protobuf/arenastring.h
+++ b/third_party/protobuf/src/google/protobuf/arenastring.h
@@ -37,6 +37,7 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/fastmem.h>
#include <google/protobuf/arena.h>
+#include <google/protobuf/generated_message_util.h>
@@ -63,7 +64,9 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
}
// Basic accessors.
- inline const ::std::string& Get() const { return *ptr_; }
+ inline const ::std::string& Get(const ::std::string* /* default_value */) const {
+ return *ptr_;
+ }
inline ::std::string* Mutable(const ::std::string* default_value,
::google::protobuf::Arena* arena) {
@@ -147,12 +150,13 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
std::swap(ptr_, other->ptr_);
}
- // Frees storage (if not on an arena).
+ // Frees storage (if not on an arena) and sets field to default value.
inline void Destroy(const ::std::string* default_value,
::google::protobuf::Arena* arena) {
if (arena == NULL && ptr_ != default_value) {
delete ptr_;
}
+ ptr_ = const_cast< ::std::string* >(default_value);
}
// Clears content, but keeps allocated string if arena != NULL, to avoid the
@@ -212,7 +216,9 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
void AssignWithDefault(const ::std::string* default_value, ArenaStringPtr value);
- inline const ::std::string& GetNoArena() const { return *ptr_; }
+ inline const ::std::string& GetNoArena(const ::std::string* /* default_value */) const {
+ return *ptr_;
+ }
::std::string* MutableNoArena(const ::std::string* default_value);
@@ -265,10 +271,6 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
return &ptr_;
}
- inline bool IsDefault(const ::std::string* default_value) const {
- return ptr_ == default_value;
- }
-
private:
::std::string* ptr_;
« no previous file with comments | « third_party/protobuf/src/google/protobuf/arena_unittest.cc ('k') | third_party/protobuf/src/google/protobuf/arenastring.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698