aboutsummaryrefslogtreecommitdiff
path: root/objectivec/google
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2016-09-01 11:45:50 -0400
committerThomas Van Lenten <thomasvl@google.com>2016-09-01 18:08:59 -0400
commit13a41246dd9aa6c6a84d436307b933fd4a6ec4a8 (patch)
treeb3874be6ed13a5d22655c55c0a2e4f80fdb99f35 /objectivec/google
parentc0a6a6b4628a634f6a0529c9f7e9e1e0fe66d4d6 (diff)
downloadprotobuf-13a41246dd9aa6c6a84d436307b933fd4a6ec4a8.tar.gz
protobuf-13a41246dd9aa6c6a84d436307b933fd4a6ec4a8.tar.bz2
protobuf-13a41246dd9aa6c6a84d436307b933fd4a6ec4a8.zip
Make Root's +extensionRegistry generation smarter.
At generation time, walk the file's dependencies to see what really contains extensions so we can generate more minimal code that only links together the roots that provided extensions. Gets a bunch of otherwise noop code out of the call flow when the roots are +initialized.
Diffstat (limited to 'objectivec/google')
-rw-r--r--objectivec/google/protobuf/Any.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/Api.pbobjc.m14
-rw-r--r--objectivec/google/protobuf/Duration.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/Empty.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/FieldMask.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/SourceContext.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/Struct.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/Timestamp.pbobjc.m3
-rw-r--r--objectivec/google/protobuf/Type.pbobjc.m14
-rw-r--r--objectivec/google/protobuf/Wrappers.pbobjc.m3
10 files changed, 28 insertions, 24 deletions
diff --git a/objectivec/google/protobuf/Any.pbobjc.m b/objectivec/google/protobuf/Any.pbobjc.m
index 25e5b4c4..deaedc16 100644
--- a/objectivec/google/protobuf/Any.pbobjc.m
+++ b/objectivec/google/protobuf/Any.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBAnyRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBAnyRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/Api.pbobjc.m b/objectivec/google/protobuf/Api.pbobjc.m
index cd37edaa..e73ecf85 100644
--- a/objectivec/google/protobuf/Api.pbobjc.m
+++ b/objectivec/google/protobuf/Api.pbobjc.m
@@ -31,18 +31,8 @@
@implementation GPBApiRoot
-+ (GPBExtensionRegistry*)extensionRegistry {
- // This is called by +initialize so there is no need to worry
- // about thread safety and initialization of registry.
- static GPBExtensionRegistry* registry = nil;
- if (!registry) {
- GPBDebugCheckRuntimeVersion();
- registry = [[GPBExtensionRegistry alloc] init];
- [registry addExtensions:[GPBSourceContextRoot extensionRegistry]];
- [registry addExtensions:[GPBTypeRoot extensionRegistry]];
- }
- return registry;
-}
+// No extensions in the file and none of the imports (direct or indirect)
+// defined extensions, so no need to generate +extensionRegistry.
@end
diff --git a/objectivec/google/protobuf/Duration.pbobjc.m b/objectivec/google/protobuf/Duration.pbobjc.m
index 35daa3df..79fbe007 100644
--- a/objectivec/google/protobuf/Duration.pbobjc.m
+++ b/objectivec/google/protobuf/Duration.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBDurationRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBDurationRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/Empty.pbobjc.m b/objectivec/google/protobuf/Empty.pbobjc.m
index 1bdd4949..83cede25 100644
--- a/objectivec/google/protobuf/Empty.pbobjc.m
+++ b/objectivec/google/protobuf/Empty.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBEmptyRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBEmptyRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/FieldMask.pbobjc.m b/objectivec/google/protobuf/FieldMask.pbobjc.m
index 2721fdfa..906e3cbd 100644
--- a/objectivec/google/protobuf/FieldMask.pbobjc.m
+++ b/objectivec/google/protobuf/FieldMask.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBFieldMaskRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBFieldMaskRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/SourceContext.pbobjc.m b/objectivec/google/protobuf/SourceContext.pbobjc.m
index 6e3c9c07..5c6ca6c0 100644
--- a/objectivec/google/protobuf/SourceContext.pbobjc.m
+++ b/objectivec/google/protobuf/SourceContext.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBSourceContextRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBSourceContextRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/Struct.pbobjc.m b/objectivec/google/protobuf/Struct.pbobjc.m
index 8ea1f124..55c135e6 100644
--- a/objectivec/google/protobuf/Struct.pbobjc.m
+++ b/objectivec/google/protobuf/Struct.pbobjc.m
@@ -28,6 +28,9 @@
@implementation GPBStructRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBStructRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/Timestamp.pbobjc.m b/objectivec/google/protobuf/Timestamp.pbobjc.m
index 06e3ef94..5e4d5cc1 100644
--- a/objectivec/google/protobuf/Timestamp.pbobjc.m
+++ b/objectivec/google/protobuf/Timestamp.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBTimestampRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBTimestampRoot_FileDescriptor
diff --git a/objectivec/google/protobuf/Type.pbobjc.m b/objectivec/google/protobuf/Type.pbobjc.m
index 6c7b4efd..b48f4d0f 100644
--- a/objectivec/google/protobuf/Type.pbobjc.m
+++ b/objectivec/google/protobuf/Type.pbobjc.m
@@ -31,18 +31,8 @@
@implementation GPBTypeRoot
-+ (GPBExtensionRegistry*)extensionRegistry {
- // This is called by +initialize so there is no need to worry
- // about thread safety and initialization of registry.
- static GPBExtensionRegistry* registry = nil;
- if (!registry) {
- GPBDebugCheckRuntimeVersion();
- registry = [[GPBExtensionRegistry alloc] init];
- [registry addExtensions:[GPBAnyRoot extensionRegistry]];
- [registry addExtensions:[GPBSourceContextRoot extensionRegistry]];
- }
- return registry;
-}
+// No extensions in the file and none of the imports (direct or indirect)
+// defined extensions, so no need to generate +extensionRegistry.
@end
diff --git a/objectivec/google/protobuf/Wrappers.pbobjc.m b/objectivec/google/protobuf/Wrappers.pbobjc.m
index b5405a7d..ebf8e228 100644
--- a/objectivec/google/protobuf/Wrappers.pbobjc.m
+++ b/objectivec/google/protobuf/Wrappers.pbobjc.m
@@ -27,6 +27,9 @@
@implementation GPBWrappersRoot
+// No extensions in the file and no imports, so no need to generate
+// +extensionRegistry.
+
@end
#pragma mark - GPBWrappersRoot_FileDescriptor