| OLD | NEW |
| (Empty) | |
| 1 diff --git a/third_party/protobuf/BUILD.gn b/third_party/protobuf/BUILD.gn |
| 2 index 727bf07..070ed44 100644 |
| 3 --- a/third_party/protobuf/BUILD.gn |
| 4 +++ b/third_party/protobuf/BUILD.gn |
| 5 @@ -10,6 +10,12 @@ config("protobuf_config") { |
| 6 ] |
| 7 } |
| 8 |
| 9 +if (is_component_build) { |
| 10 + config("protobuf_use_dlls") { |
| 11 + defines = [ "PROTOBUF_USE_DLLS" ] |
| 12 + } |
| 13 +} |
| 14 + |
| 15 # This config should be applied to targets using generated code from the proto |
| 16 # compiler. It sets up the include directories properly. |
| 17 config("using_proto") { |
| 18 @@ -42,6 +48,7 @@ protobuf_lite_sources = [ |
| 19 "src/google/protobuf/message.h", |
| 20 "src/google/protobuf/message_lite.cc", |
| 21 "src/google/protobuf/message_lite.h", |
| 22 + "src/google/protobuf/metadata.cc", |
| 23 "src/google/protobuf/metadata.h", |
| 24 "src/google/protobuf/repeated_field.cc", |
| 25 "src/google/protobuf/repeated_field.h", |
| 26 @@ -117,7 +124,7 @@ if (is_win) { |
| 27 ] |
| 28 } |
| 29 |
| 30 -source_set("protobuf_lite") { |
| 31 +component("protobuf_lite") { |
| 32 sources = protobuf_lite_sources |
| 33 |
| 34 configs -= [ "//build/config/compiler:chromium_code" ] |
| 35 @@ -133,6 +140,12 @@ source_set("protobuf_lite") { |
| 36 ] |
| 37 |
| 38 cflags = protobuf_lite_cflags |
| 39 + |
| 40 + # Required for component builds. See http://crbug.com/172800. |
| 41 + if (is_component_build) { |
| 42 + public_configs += [ ":protobuf_use_dlls" ] |
| 43 + defines = [ "LIBPROTOBUF_EXPORTS" ] |
| 44 + } |
| 45 } |
| 46 |
| 47 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't |
| 48 @@ -143,7 +156,8 @@ source_set("protobuf_full") { |
| 49 # Prevent people from depending on this outside our file. |
| 50 visibility = [ ":*" ] |
| 51 |
| 52 - sources = [ |
| 53 + sources = protobuf_lite_sources |
| 54 + sources += [ |
| 55 "src/google/protobuf/any.cc", |
| 56 "src/google/protobuf/any.h", |
| 57 "src/google/protobuf/any.pb.cc", |
| 58 @@ -273,10 +287,6 @@ source_set("protobuf_full") { |
| 59 ] |
| 60 |
| 61 cflags = protobuf_lite_cflags |
| 62 - |
| 63 - deps = [ |
| 64 - ":protobuf_lite", |
| 65 - ] |
| 66 } |
| 67 |
| 68 # Only compile the compiler for the host architecture. |
| 69 diff --git a/third_party/protobuf/README.chromium b/third_party/protobuf/README.
chromium |
| 70 index ec6f4ab..8f96459 100644 |
| 71 --- a/third_party/protobuf/README.chromium |
| 72 +++ b/third_party/protobuf/README.chromium |
| 73 @@ -25,6 +25,7 @@ Steps used to create the current version: |
| 74 02: Add unknown field retention to protobuf_lite. This is a large and comple
x |
| 75 patch which will likely require reworking to apply correctly. Based on |
| 76 http://crrev.com/62331 and http://crrev.com/173228 . |
| 77 + 03: Convert protobuf_lite to a component. Based on http://crrev.com/179806 . |
| 78 (3) Generate descriptor_pb2.py using something like the following steps. Make |
| 79 sure you've regenerated your buildfiles and will build protoc from the |
| 80 newly-modified sources above. |
| 81 diff --git a/third_party/protobuf/protobuf.gyp b/third_party/protobuf/protobuf.g
yp |
| 82 index 363df49..7e3aed5 100644 |
| 83 --- a/third_party/protobuf/protobuf.gyp |
| 84 +++ b/third_party/protobuf/protobuf.gyp |
| 85 @@ -76,11 +76,21 @@ |
| 86 # to your .proto file. |
| 87 { |
| 88 'target_name': 'protobuf_lite', |
| 89 - 'type': 'static_library', |
| 90 + 'type': '<(component)', |
| 91 'toolsets': ['host', 'target'], |
| 92 'includes': [ |
| 93 'protobuf_lite.gypi', |
| 94 ], |
| 95 + # Required for component builds. See http://crbug.com/172800. |
| 96 + 'defines': [ |
| 97 + 'LIBPROTOBUF_EXPORTS', |
| 98 + 'PROTOBUF_USE_DLLS', |
| 99 + ], |
| 100 + 'direct_dependent_settings': { |
| 101 + 'defines': [ |
| 102 + 'PROTOBUF_USE_DLLS', |
| 103 + ], |
| 104 + }, |
| 105 }, |
| 106 # This is the full, heavy protobuf lib that's needed for c++ .protos |
| 107 # that don't specify the LITE_RUNTIME option. The protocol |
| 108 @@ -91,6 +101,9 @@ |
| 109 'target_name': 'protobuf_full_do_not_use', |
| 110 'type': 'static_library', |
| 111 'toolsets': ['host','target'], |
| 112 + 'includes': [ |
| 113 + 'protobuf_lite.gypi', |
| 114 + ], |
| 115 'sources': [ |
| 116 'src/google/protobuf/any.cc', |
| 117 'src/google/protobuf/any.h', |
| 118 @@ -206,12 +219,6 @@ |
| 119 'src/google/protobuf/wrappers.pb.cc', |
| 120 'src/google/protobuf/wrappers.pb.h', |
| 121 ], |
| 122 - 'dependencies': [ |
| 123 - 'protobuf_lite', |
| 124 - ], |
| 125 - 'export_dependent_settings': [ |
| 126 - 'protobuf_lite', |
| 127 - ], |
| 128 }, |
| 129 { |
| 130 'target_name': 'protoc', |
| 131 diff --git a/third_party/protobuf/protobuf_lite.gypi b/third_party/protobuf/prot
obuf_lite.gypi |
| 132 index ed110ef..ab5c57c 100644 |
| 133 --- a/third_party/protobuf/protobuf_lite.gypi |
| 134 +++ b/third_party/protobuf/protobuf_lite.gypi |
| 135 @@ -26,6 +26,7 @@ |
| 136 'src/google/protobuf/message.h', |
| 137 'src/google/protobuf/message_lite.cc', |
| 138 'src/google/protobuf/message_lite.h', |
| 139 + 'src/google/protobuf/metadata.cc', |
| 140 'src/google/protobuf/metadata.h', |
| 141 'src/google/protobuf/repeated_field.cc', |
| 142 'src/google/protobuf/repeated_field.h', |
| 143 diff --git a/third_party/protobuf/src/google/protobuf/metadata.cc b/third_party/
protobuf/src/google/protobuf/metadata.cc |
| 144 new file mode 100644 |
| 145 index 0000000..99d2cf9 |
| 146 --- /dev/null |
| 147 +++ b/third_party/protobuf/src/google/protobuf/metadata.cc |
| 148 @@ -0,0 +1,42 @@ |
| 149 +// Protocol Buffers - Google's data interchange format |
| 150 +// Copyright 2015 Google Inc. All rights reserved. |
| 151 +// https://developers.google.com/protocol-buffers/ |
| 152 +// |
| 153 +// Redistribution and use in source and binary forms, with or without |
| 154 +// modification, are permitted provided that the following conditions are |
| 155 +// met: |
| 156 +// |
| 157 +// * Redistributions of source code must retain the above copyright |
| 158 +// notice, this list of conditions and the following disclaimer. |
| 159 +// * Redistributions in binary form must reproduce the above |
| 160 +// copyright notice, this list of conditions and the following disclaimer |
| 161 +// in the documentation and/or other materials provided with the |
| 162 +// distribution. |
| 163 +// * Neither the name of Google Inc. nor the names of its |
| 164 +// contributors may be used to endorse or promote products derived from |
| 165 +// this software without specific prior written permission. |
| 166 +// |
| 167 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 168 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 169 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 170 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 171 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 172 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 173 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 174 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 175 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 176 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 177 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 178 + |
| 179 +#include <google/protobuf/metadata.h> |
| 180 + |
| 181 +namespace google { |
| 182 +namespace protobuf { |
| 183 +namespace internal { |
| 184 + |
| 185 +InternalMetadataWithArena::InternalMetadataWithArena(Arena* arena) |
| 186 + : ptr_ (arena) {} |
| 187 + |
| 188 +} // namespace internal |
| 189 +} // namespace protobuf |
| 190 +} // namespace google |
| 191 diff --git a/third_party/protobuf/src/google/protobuf/metadata.h b/third_party/p
rotobuf/src/google/protobuf/metadata.h |
| 192 index 30b2a6e..85065f0 100644 |
| 193 --- a/third_party/protobuf/src/google/protobuf/metadata.h |
| 194 +++ b/third_party/protobuf/src/google/protobuf/metadata.h |
| 195 @@ -59,8 +59,7 @@ namespace internal { |
| 196 class LIBPROTOBUF_EXPORT InternalMetadataWithArena { |
| 197 public: |
| 198 InternalMetadataWithArena() : ptr_(NULL) {} |
| 199 - explicit InternalMetadataWithArena(Arena* arena) |
| 200 - : ptr_ (arena) {} |
| 201 + explicit InternalMetadataWithArena(Arena* arena); |
| 202 |
| 203 ~InternalMetadataWithArena() { |
| 204 if (have_unknown_fields() && arena() == NULL) { |
| 205 diff --git a/third_party/protobuf/src/google/protobuf/stubs/port.h b/third_party
/protobuf/src/google/protobuf/stubs/port.h |
| 206 index 8a5d1a1..cd8a0af 100644 |
| 207 --- a/third_party/protobuf/src/google/protobuf/stubs/port.h |
| 208 +++ b/third_party/protobuf/src/google/protobuf/stubs/port.h |
| 209 @@ -63,18 +63,33 @@ |
| 210 #define PROTOBUF_LITTLE_ENDIAN 1 |
| 211 #endif |
| 212 #endif |
| 213 -#if defined(_MSC_VER) && defined(PROTOBUF_USE_DLLS) |
| 214 - #ifdef LIBPROTOBUF_EXPORTS |
| 215 - #define LIBPROTOBUF_EXPORT __declspec(dllexport) |
| 216 - #else |
| 217 - #define LIBPROTOBUF_EXPORT __declspec(dllimport) |
| 218 +// The macros defined below are required in order to make protobuf_lite a |
| 219 +// component on all platforms. See http://crbug.com/172800. |
| 220 +#if defined(COMPONENT_BUILD) && defined(PROTOBUF_USE_DLLS) |
| 221 + #if defined(_MSC_VER) |
| 222 + #ifdef LIBPROTOBUF_EXPORTS |
| 223 + #define LIBPROTOBUF_EXPORT __declspec(dllexport) |
| 224 + #else |
| 225 + #define LIBPROTOBUF_EXPORT __declspec(dllimport) |
| 226 + #endif |
| 227 + #ifdef LIBPROTOC_EXPORTS |
| 228 + #define LIBPROTOC_EXPORT __declspec(dllexport) |
| 229 + #else |
| 230 + #define LIBPROTOC_EXPORT __declspec(dllimport) |
| 231 + #endif |
| 232 + #else // defined(_MSC_VER) |
| 233 + #ifdef LIBPROTOBUF_EXPORTS |
| 234 + #define LIBPROTOBUF_EXPORT __attribute__((visibility("default"))) |
| 235 + #else |
| 236 + #define LIBPROTOBUF_EXPORT |
| 237 + #endif |
| 238 + #ifdef LIBPROTOC_EXPORTS |
| 239 + #define LIBPROTOC_EXPORT __attribute__((visibility("default"))) |
| 240 + #else |
| 241 + #define LIBPROTOC_EXPORT |
| 242 + #endif |
| 243 #endif |
| 244 - #ifdef LIBPROTOC_EXPORTS |
| 245 - #define LIBPROTOC_EXPORT __declspec(dllexport) |
| 246 - #else |
| 247 - #define LIBPROTOC_EXPORT __declspec(dllimport) |
| 248 - #endif |
| 249 -#else |
| 250 +#else // defined(COMPONENT_BUILD) && defined(PROTOBUF_USE_DLLS) |
| 251 #define LIBPROTOBUF_EXPORT |
| 252 #define LIBPROTOC_EXPORT |
| 253 #endif |
| OLD | NEW |