Skip to content

Commit

Permalink
Revert "Rollback protobuf lite runtime to 3.0.1"
Browse files Browse the repository at this point in the history
This reverts commit 8a3e6a2.

Reason for revert: Revert before next branch cut, was only required for a cherry-pick to M84

Original change's description:
> Rollback protobuf lite runtime to 3.0.1
> 
> As a temporary fix for android webview regression b/157318961 this cl
> rolls back the protobuf lite runtime to 3.0.1 using the codegen plugin.
> 
> Binary-Size: This is temporary and there is not really much we could do.
> Bug: 1093059, b/157318961
> Change-Id: I2bbaf6d3b434221b667901423c4616e26a7550c5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2238872
> Reviewed-by: Dan H <harringtond@chromium.org>
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
> Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#777495}

TBR=yfriedman@chromium.org,agrieve@chromium.org,mheikal@chromium.org,harringtond@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1093059, b/157318961
Change-Id: Ieda4530327ff3de513601ae3fe0ad5e9c99eeed0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264466
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Dan H <harringtond@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782219}
  • Loading branch information
m0hamed authored and Commit Bot committed Jun 25, 2020
1 parent d7b27d0 commit 25f926b
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 94 deletions.
6 changes: 3 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3356,11 +3356,11 @@ deps = {
'dep_type': 'cipd',
},

'src/third_party/android_deps/libs/com_google_protobuf_protobuf_lite': {
'src/third_party/android_deps/libs/com_google_protobuf_protobuf_javalite': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_protobuf_protobuf_lite',
'version': 'version:3.0.1-cr0',
'package': 'chromium/third_party/android_deps/libs/com_google_protobuf_protobuf_javalite',
'version': 'version:3.12.2-cr0',
},
],
'condition': 'checkout_android',
Expand Down
5 changes: 5 additions & 0 deletions base/android/proguard/chromium_apk.flags
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,8 @@
public int getMinApkVersion();
public boolean requiresSignIn();
}

# Protobuf java lite runtime uses reflection
-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
<fields>;
}
6 changes: 0 additions & 6 deletions build/config/android/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -4053,7 +4053,6 @@ if (enable_java_templates) {
# Use the regular proto library to generate lite protos.
_protoc_bin = "//third_party/android_protoc/protoc"
_proto_runtime = "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java"
_protoc_javalite_plugin_dir = "//third_party/protoc_javalite/"
}
_proto_path = invoker.proto_path
_template_name = target_name
Expand Down Expand Up @@ -4097,11 +4096,6 @@ if (enable_java_templates) {

if (_generate_nano) {
args += [ "--nano" ]
} else {
args += [
"--protoc-javalite-plugin-dir",
rebase_path(_protoc_javalite_plugin_dir, root_build_dir),
]
}
}

Expand Down
14 changes: 1 addition & 13 deletions build/protoc_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def main(argv):
parser.add_option("--stamp", help="File to touch on success.")
parser.add_option("--nano",
help="Use to generate nano protos.", action='store_true')
parser.add_option("--protoc-javalite-plugin-dir",
help="Path to protoc java lite plugin directory.")
parser.add_option("--import-dir", action="append", default=[],
help="Extra import directory for protos, can be repeated.")
options, args = parser.parse_args(argv)
Expand All @@ -59,21 +57,11 @@ def main(argv):
'store_unknown_fields=true']
out_arg = '--javanano_out=' + ','.join(generator_args) + ':' + temp_dir
else:
out_arg = '--javalite_out=' + temp_dir

custom_env = os.environ.copy()
if options.protoc_javalite_plugin_dir:
# If we are generating lite protos, then the lite plugin needs to be in
# the path when protoc is called. See
# https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md
custom_env['PATH'] = '{}:{}'.format(
os.path.abspath(options.protoc_javalite_plugin_dir),
custom_env['PATH'])
out_arg = '--java_out=lite:' + temp_dir

# Generate Java files using protoc.
build_utils.CheckOutput(
[options.protoc] + proto_path_args + [out_arg] + args,
env=custom_env,
# protoc generates superfluous warnings about LITE_RUNTIME deprecation
# even though we are using the new non-deprecated method.
stderr_filter=lambda output: build_utils.FilterLines(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@
public boolean requiresSignIn();
}

# Protobuf java lite runtime uses reflection
-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
<fields>;
}

################################################################################
# ../../base/android/proguard/chromium_code.flags
################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController;
import org.chromium.components.feed.proto.FeedUiProto.SharedState;
import org.chromium.components.feed.proto.FeedUiProto.Slice;
import org.chromium.components.feed.proto.FeedUiProto.Slice.SliceDataCase;
import org.chromium.components.feed.proto.FeedUiProto.StreamUpdate;
import org.chromium.components.feed.proto.FeedUiProto.StreamUpdate.SliceUpdate;
import org.chromium.components.feed.proto.FeedUiProto.StreamUpdate.SliceUpdate.UpdateCase;
import org.chromium.components.signin.base.CoreAccountInfo;
import org.chromium.components.signin.identitymanager.ConsentLevel;
import org.chromium.content_public.browser.LoadUrlParams;
Expand Down Expand Up @@ -314,7 +312,7 @@ void onStreamUpdated(byte[] data) {
newContentList.add(mContentManager.getContent(i));
}
for (SliceUpdate sliceUpdate : streamUpdate.getUpdatedSlicesList()) {
if (sliceUpdate.getUpdateCase() == UpdateCase.SLICE) {
if (sliceUpdate.hasSlice()) {
newContentList.add(createContentFromSlice(sliceUpdate.getSlice()));
} else {
String existingSliceId = sliceUpdate.getSliceId();
Expand Down Expand Up @@ -379,10 +377,10 @@ private void updateContentsInPlace(

private FeedListContentManager.FeedContent createContentFromSlice(Slice slice) {
String sliceId = slice.getSliceId();
if (slice.getSliceDataCase() == SliceDataCase.XSURFACE_SLICE) {
if (slice.hasXsurfaceSlice()) {
return new FeedListContentManager.ExternalViewContent(
sliceId, slice.getXsurfaceSlice().getXsurfaceFrame().toByteArray());
} else if (slice.getSliceDataCase() == SliceDataCase.LOADING_SPINNER_SLICE) {
} else if (slice.hasLoadingSpinnerSlice()) {
return new FeedListContentManager.NativeViewContent(sliceId, R.layout.feed_spinner);
} else {
// TODO(jianli): Create native view for ZeroStateSlice.
Expand Down
13 changes: 4 additions & 9 deletions third_party/android_deps/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ java_annotation_processor("dagger_processor") {
deps = [ ":com_google_dagger_dagger_compiler_java" ]
}

# Alias new java lite runtime to old javalite runtime name until
# crbug.com/1093059 is fixed and we go back to the latest runtime.
java_group("com_google_protobuf_protobuf_javalite_java") {
deps = [ ":com_google_protobuf_protobuf_lite_cr1_java" ]
}

# The section below is generated by running
# `//tools/android/roll/android_deps/fetch_all.py`

Expand Down Expand Up @@ -1404,9 +1398,10 @@ java_prebuilt("com_google_j2objc_j2objc_annotations_java") {
}

# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("com_google_protobuf_protobuf_lite_cr1_java") {
jar_path = "libs/com_google_protobuf_protobuf_lite/protobuf-lite-3.0.1.jar"
output_name = "com_google_protobuf_protobuf_lite"
java_prebuilt("com_google_protobuf_protobuf_javalite_java") {
jar_path =
"libs/com_google_protobuf_protobuf_javalite/protobuf-javalite-3.12.2.jar"
output_name = "com_google_protobuf_protobuf_javalite"
supports_android = true
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/android_deps/additional_readme_paths.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"libs/com_google_guava_listenablefuture",
"libs/com_google_j2objc_j2objc_annotations",
"libs/com_google_protobuf_protobuf_java",
"libs/com_google_protobuf_protobuf_lite",
"libs/com_google_protobuf_protobuf_javalite",
"libs/com_googlecode_java_diff_utils_diffutils",
"libs/com_squareup_javapoet",
"libs/com_squareup_javawriter",
Expand Down
2 changes: 1 addition & 1 deletion third_party/android_deps/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ dependencies {
compile "com.google.guava:failureaccess:1.0.1"
compile "com.google.guava:listenablefuture:1.0"
compile "com.google.j2objc:j2objc-annotations:1.1"
compile "com.google.protobuf:protobuf-lite:3.0.1"
compile "com.google.protobuf:protobuf-javalite:3.12.2"
compile "javax.annotation:javax.annotation-api:1.3.2"
compile "javax.annotation:jsr250-api:1.0"
compile "javax.inject:javax.inject:1"
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 25f926b

Please sign in to comment.