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

Issue 12090058: Componentize protobuf_lite (Closed)

Created:
7 years, 10 months ago by Raghu Simha
Modified:
7 years, 10 months ago
Reviewers:
Dirk Pranke
CC:
chromium-reviews, Ryan Sleevi, tim (not reviewing)
Visibility:
Public.

Description

Componentize 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+112 lines, -77 lines) Patch
M third_party/protobuf/README.chromium View 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/protobuf/protobuf.gyp View 1 2 3 chunks +11 lines, -65 lines 0 comments Download
A third_party/protobuf/protobuf_lite.gypi View 1 chunk +69 lines, -0 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/common.h View 1 chunk +26 lines, -11 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/once.h View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 8 (0 generated)
Raghu Simha
Ryan, please review. Thanks.
7 years, 10 months ago (2013-01-29 23:42:42 UTC) #1
Ryan Sleevi
I'm actually going to ask Dirk to take a look at this, given his involvement ...
7 years, 10 months ago (2013-01-30 00:24:00 UTC) #2
Dirk Pranke
I will take a look, but I may not get to this until tomorrow.
7 years, 10 months ago (2013-01-30 00:26:04 UTC) #3
Raghu Simha
Thanks Ryan. Your one comment is addressed below. Dirk, tomorrow is fine. Thanks. https://codereview.chromium.org/12090058/diff/3001/third_party/protobuf/protobuf.gyp File ...
7 years, 10 months ago (2013-01-30 00:48:48 UTC) #4
Raghu Simha
Dirk: think you'll be able to look at this today?
7 years, 10 months ago (2013-01-30 21:58:14 UTC) #5
Dirk Pranke
this basically looks good; a couple of comments to clarify my understanding, and then we're ...
7 years, 10 months ago (2013-01-31 02:15:06 UTC) #6
Raghu Simha
Dirk, PTAL. Thanks. https://codereview.chromium.org/12090058/diff/8006/third_party/protobuf/protobuf.gyp File third_party/protobuf/protobuf.gyp (right): https://codereview.chromium.org/12090058/diff/8006/third_party/protobuf/protobuf.gyp#newcode1 third_party/protobuf/protobuf.gyp:1: # Copyright 2013 The Chromium Authors. ...
7 years, 10 months ago (2013-01-31 03:14:40 UTC) #7
Dirk Pranke
7 years, 10 months ago (2013-01-31 04:34:45 UTC) #8
Makes sense. lgtm.

Powered by Google App Engine
This is Rietveld 408576698