DescriptionComponentize protobuf_lite
Several parts of chrome that use protobufs depend on the static library 'protobuf_lite' in third_party/protobuf. As more parts of chrome are pulled into their own components, we end up linking duplicate copies of protobuf_lite into each of them. This causes memory corruption errors due to protobuf's use of static variables to maintain state.
Componentizing protobuf_lite isn't as simple as changing its target type to '<(component)'. This is because there is a larger, more full-fledged version of protobuf in the target 'protobuf_full_do_not_use', which cannot be dynamically linked with the component protobuf_lite. This is because several classes declared in protobuf_lite are partially defined in protobuf_full_do_not_use, due to which we run into issues with dllexport/dllimport annotations.
The target 'protobuf_lite' is used as a dependency all over chrome, while the target 'protobuf_full_do_not_use' is used only in one place, where it is statically linked into the protobuf compiler executable 'protoc'.
This patch does the following:
1) Pulls out most of the target definitions of 'protobuf_lite' into a separate gypi file.
2) Defines protobuf export macros for all platforms in protobuf/stubs/common.h.
3) For the target 'protobuf_lite':
- Changes the target type to '<(component)'.
- Includes the contents of protobuf_lite.gypi.
- Exports symbols via the LIBPROTOBUF_EXPORT macro.
- Makes sure targets that consume it can import its symbols.
4) For the target 'protobuf_full_do_not_use':
- Retains the target type of 'static_library'.
- Includes the contents of protobuf_lite.gypi instead of depending on the target 'protobuf_lite'.
BUG=172800
TEST=Enable component builds and make sure all chrome targets build, and all tests run and pass.
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=179806
Patch Set 1 : #
Total comments: 2
Patch Set 2 : Move protobuf_full_do_not_use back into protobuf.gyp #
Total comments: 6
Patch Set 3 : Address feedback #
Messages
Total messages: 8 (0 generated)
|