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

Unified Diff: third_party/protobuf/src/google/protobuf/message.cc

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/message.cc
diff --git a/third_party/protobuf/src/google/protobuf/message.cc b/third_party/protobuf/src/google/protobuf/message.cc
index a5a7feb62bfdec1f9c8e9fb2b14405671bd4d20a..d62ca79c80cb7d49cdf4a2dc814db293560f5f81 100644
--- a/third_party/protobuf/src/google/protobuf/message.cc
+++ b/third_party/protobuf/src/google/protobuf/message.cc
@@ -46,9 +46,9 @@
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/map_field.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/map_field.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
@@ -62,6 +62,8 @@ namespace protobuf {
using internal::WireFormat;
using internal::ReflectionOps;
+Message::~Message() {}
+
void Message::MergeFrom(const Message& from) {
const Descriptor* descriptor = GetDescriptor();
GOOGLE_CHECK_EQ(from.GetDescriptor(), descriptor)
@@ -96,12 +98,12 @@ bool Message::IsInitialized() const {
return ReflectionOps::IsInitialized(*this);
}
-void Message::FindInitializationErrors(std::vector<string>* errors) const {
+void Message::FindInitializationErrors(vector<string>* errors) const {
return ReflectionOps::FindInitializationErrors(*this, "", errors);
}
string Message::InitializationErrorString() const {
- std::vector<string> errors;
+ vector<string> errors;
FindInitializationErrors(&errors);
return Join(errors, ", ");
}
@@ -146,9 +148,9 @@ void Message::SerializeWithCachedSizes(
WireFormat::SerializeWithCachedSizes(*this, GetCachedSize(), output);
}
-size_t Message::ByteSizeLong() const {
- size_t size = WireFormat::ByteSize(*this);
- SetCachedSize(internal::ToCachedSize(size));
+int Message::ByteSize() const {
+ int size = WireFormat::ByteSize(*this);
+ SetCachedSize(size);
return size;
}
@@ -225,6 +227,38 @@ void* Reflection::MutableRawRepeatedString(
}
+// Default EnumValue API implementations. Real reflection implementations should
+// override these. However, there are several legacy implementations that do
+// not, and cannot easily be changed at the same time as the Reflection API, so
+// we provide these for now.
+// TODO: Remove these once all Reflection implementations are updated.
+int Reflection::GetEnumValue(const Message& message,
+ const FieldDescriptor* field) const {
+ GOOGLE_LOG(FATAL) << "Unimplemented EnumValue API.";
+ return 0;
+}
+void Reflection::SetEnumValue(Message* message,
+ const FieldDescriptor* field,
+ int value) const {
+ GOOGLE_LOG(FATAL) << "Unimplemented EnumValue API.";
+}
+int Reflection::GetRepeatedEnumValue(
+ const Message& message,
+ const FieldDescriptor* field, int index) const {
+ GOOGLE_LOG(FATAL) << "Unimplemented EnumValue API.";
+ return 0;
+}
+void Reflection::SetRepeatedEnumValue(Message* message,
+ const FieldDescriptor* field, int index,
+ int value) const {
+ GOOGLE_LOG(FATAL) << "Unimplemented EnumValue API.";
+}
+void Reflection::AddEnumValue(Message* message,
+ const FieldDescriptor* field,
+ int value) const {
+ GOOGLE_LOG(FATAL) << "Unimplemented EnumValue API.";
+}
+
MapIterator Reflection::MapBegin(
Message* message,
const FieldDescriptor* field) const {
@@ -267,8 +301,8 @@ class GeneratedMessageFactory : public MessageFactory {
hash_map<const char*, RegistrationFunc*,
hash<const char*>, streq> file_map_;
- Mutex mutex_;
// Initialized lazily, so requires locking.
+ Mutex mutex_;
hash_map<const Descriptor*, const Message*> type_map_;
};
« no previous file with comments | « third_party/protobuf/src/google/protobuf/message.h ('k') | third_party/protobuf/src/google/protobuf/message_lite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698