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

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

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Update to new HEAD (b7632464b4) + restore GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER Created 4 years, 1 month 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/dynamic_message.cc
diff --git a/third_party/protobuf/src/google/protobuf/dynamic_message.cc b/third_party/protobuf/src/google/protobuf/dynamic_message.cc
index 9e83bd2918e4e828312026515a6b4c5ec4399856..f51bc9d6c90c976ea58f8c7f798c12652cac873f 100644
--- a/third_party/protobuf/src/google/protobuf/dynamic_message.cc
+++ b/third_party/protobuf/src/google/protobuf/dynamic_message.cc
@@ -70,7 +70,6 @@
#endif
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/scoped_ptr.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/descriptor.h>
@@ -224,7 +223,6 @@ class DynamicMessage : public Message {
int oneof_case_offset;
int unknown_fields_offset;
int extensions_offset;
- int is_default_instance_offset;
// Not owned by the TypeInfo.
DynamicMessageFactory* factory; // The factory that created this object.
@@ -333,11 +331,6 @@ void DynamicMessage::SharedCtor() {
uint32(0);
}
- if (type_info_->is_default_instance_offset != -1) {
- *reinterpret_cast<bool*>(
- OffsetToPointer(type_info_->is_default_instance_offset)) = false;
- }
-
new(OffsetToPointer(type_info_->unknown_fields_offset)) UnknownFieldSet;
if (type_info_->extensions_offset != -1) {
@@ -557,14 +550,6 @@ void DynamicMessage::CrossLinkPrototypes() {
factory->GetPrototypeNoLock(field->message_type());
}
}
-
- // Set as the default instance -- this affects field-presence semantics for
- // proto3.
- if (type_info_->is_default_instance_offset != -1) {
- void* is_default_instance_ptr =
- OffsetToPointer(type_info_->is_default_instance_offset);
- *reinterpret_cast<bool*>(is_default_instance_ptr) = true;
- }
}
Message* DynamicMessage::New() const {
@@ -684,15 +669,6 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock(
size = AlignOffset(size);
}
- // The is_default_instance member, if any.
- if (type->file()->syntax() == FileDescriptor::SYNTAX_PROTO3) {
- type_info->is_default_instance_offset = size;
- size += sizeof(bool);
- size = AlignOffset(size);
- } else {
- type_info->is_default_instance_offset = -1;
- }
-
// The oneof_case, if any. It is an array of uint32s.
if (type->oneof_decl_count() > 0) {
type_info->oneof_case_offset = size;
@@ -770,35 +746,18 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock(
ConstructDefaultOneofInstance(type_info->type,
type_info->offsets.get(),
type_info->default_oneof_instance);
- type_info->reflection.reset(
- new GeneratedMessageReflection(
- type_info->type,
- type_info->prototype,
- type_info->offsets.get(),
- type_info->has_bits_offset,
- type_info->unknown_fields_offset,
- type_info->extensions_offset,
- type_info->default_oneof_instance,
- type_info->oneof_case_offset,
- type_info->pool,
- this,
- type_info->size,
- -1 /* arena_offset */,
- type_info->is_default_instance_offset));
+ type_info->reflection.reset(new GeneratedMessageReflection(
+ type_info->type, type_info->prototype, type_info->offsets.get(),
+ type_info->has_bits_offset, type_info->unknown_fields_offset,
+ type_info->extensions_offset, type_info->default_oneof_instance,
+ type_info->oneof_case_offset, type_info->pool, this, type_info->size,
+ -1 /* arena_offset */));
} else {
- type_info->reflection.reset(
- new GeneratedMessageReflection(
- type_info->type,
- type_info->prototype,
- type_info->offsets.get(),
- type_info->has_bits_offset,
- type_info->unknown_fields_offset,
- type_info->extensions_offset,
- type_info->pool,
- this,
- type_info->size,
- -1 /* arena_offset */,
- type_info->is_default_instance_offset));
+ type_info->reflection.reset(new GeneratedMessageReflection(
+ type_info->type, type_info->prototype, type_info->offsets.get(),
+ type_info->has_bits_offset, type_info->unknown_fields_offset,
+ type_info->extensions_offset, type_info->pool, this, type_info->size,
+ -1 /* arena_offset */));
}
// Cross link prototypes.
prototype->CrossLinkPrototypes();

Powered by Google App Engine
This is Rietveld 408576698