From d846b0b059b4d867536b98aa29475a387aa09114 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 8 Jun 2015 16:24:57 -0400 Subject: Beta quality drop of Objective C Support. - Add more to the ObjC dir readme. - Merge the ExtensionField and ExtensionDescriptor to reduce overhead. - Fix an initialization race. - Clean up the Xcode schemes. - Remove the class/enum filter. - Remove some forced inline that were bloating things without proof of performance wins. - Rename some internal types to avoid conflicts with the well know types protos. - Drop the use of ApplyFunctions to the compiler/optimizer can do what it wants. - Better document some possible future improvements. - Add missing support for parsing repeated primitive fields in packed or unpacked forms. - Improve -hash. - Add *Count for repeated and map<> fields to avoid auto create when checking for them being set. --- objectivec/google/protobuf/FieldMask.pbobjc.m | 46 +++++++++++++++------------ 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'objectivec/google/protobuf/FieldMask.pbobjc.m') diff --git a/objectivec/google/protobuf/FieldMask.pbobjc.m b/objectivec/google/protobuf/FieldMask.pbobjc.m index e37ac6c2..f9684f51 100644 --- a/objectivec/google/protobuf/FieldMask.pbobjc.m +++ b/objectivec/google/protobuf/FieldMask.pbobjc.m @@ -11,11 +11,14 @@ @end +#pragma mark - GPBFieldMaskRoot_FileDescriptor + static GPBFileDescriptor *GPBFieldMaskRoot_FileDescriptor(void) { // This is called by +initialize so there is no need to worry // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { + GPBDebugCheckRuntimeVersion(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" syntax:GPBFileSyntaxProto3]; } @@ -26,17 +29,17 @@ static GPBFileDescriptor *GPBFieldMaskRoot_FileDescriptor(void) { @implementation GPBFieldMask -@dynamic pathsArray; +@dynamic pathsArray, pathsArray_Count; -typedef struct GPBFieldMask_Storage { +typedef struct GPBFieldMask__storage_ { uint32_t _has_storage_[1]; NSMutableArray *pathsArray; -} GPBFieldMask_Storage; +} GPBFieldMask__storage_; // This method is threadsafe because it is initially called // in +initialize for each subclass. + (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; + static GPBDescriptor *descriptor = nil; if (!descriptor) { static GPBMessageFieldDescription fields[] = { { @@ -44,26 +47,29 @@ typedef struct GPBFieldMask_Storage { .number = GPBFieldMask_FieldNumber_PathsArray, .hasIndex = GPBNoHasBit, .flags = GPBFieldRepeated, - .type = GPBTypeString, - .offset = offsetof(GPBFieldMask_Storage, pathsArray), + .dataType = GPBDataTypeString, + .offset = offsetof(GPBFieldMask__storage_, pathsArray), .defaultValue.valueMessage = nil, - .typeSpecific.className = NULL, + .dataTypeSpecific.className = NULL, .fieldOptions = NULL, }, }; - descriptor = [GPBDescriptor allocDescriptorForClass:[GPBFieldMask class] - rootClass:[GPBFieldMaskRoot class] - file:GPBFieldMaskRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(GPBFieldMask_Storage) - wireFormat:NO]; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GPBFieldMask class] + rootClass:[GPBFieldMaskRoot class] + file:GPBFieldMaskRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(GPBFieldMask__storage_) + wireFormat:NO]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; } return descriptor; } -- cgit v1.2.3