Skip to content

Commit e1e8b04

Browse files
committed
Improve patching commands
1 parent bace20d commit e1e8b04

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.github/workflows/chromium.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
asset_content_type: application/octet-stream
9191

9292
- name: Upload Swiftshader Asset
93-
id: upload_chromium_asset
93+
id: upload_swiftshader_asset
9494
uses: actions/[email protected]
9595
env:
9696
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

chromium_build/entrypoint.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,29 @@ if [ "$1" = "build" ]; then
1111
gclient runhooks
1212

1313
# Patching Chromium
14-
sed -i 's/^\(\s\+\)PLOG(WARNING) << "poll";$/\1PLOG(WARNING) << "poll"; failed_polls = 0;/' /srv/source/chromium/src/content/browser/sandbox_ipc_linux.cc
15-
sed -i 's/^\(\s*\)CHECK(render_process_host->InSameStoragePartition(.*$//*CHECK(render_process_host->InSameStoragePartition(browser_context->GetStoragePartition(site_instance, false)));*/' /srv/source/chromium/src/content/browser/renderer_host/render_process_host_impl.cc
14+
awk '{
15+
if ($0 ~ /^\s+PLOG\(WARNING\) << "poll";$/) {
16+
match($0, /^(\\s+)/, arr);
17+
leading_space = arr[1];
18+
print leading_space "PLOG(WARNING) << \"poll\"; failed_polls = 0;";
19+
} else {
20+
print $0;
21+
}
22+
}' /srv/source/chromium/src/content/browser/sandbox_ipc_linux.cc > tmp_file && mv tmp_file /srv/source/chromium/src/content/browser/sandbox_ipc_linux.cc
23+
24+
awk 'BEGIN {flag=0} {
25+
if (flag == 0 && $0 ~ /CHECK\(render_process_host->InSameStoragePartition\(/) {
26+
print "/*";
27+
print $0;
28+
flag = 1;
29+
} else if (flag == 1 && $0 ~ /false\)\)\);/) {
30+
print $0;
31+
print " */";
32+
flag = 0;
33+
} else {
34+
print $0;
35+
}
36+
}' /srv/source/chromium/src/content/browser/renderer_host/render_process_host_impl.cc > tmp_file && mv tmp_file /srv/source/chromium/src/content/browser/renderer_host/render_process_host_impl.cc
1637

1738
# Create the build configuration directory
1839
mkdir -p /srv/source/chromium/src/out/Default
@@ -21,7 +42,7 @@ if [ "$1" = "build" ]; then
2142
mv /srv/source/chromium/args.gn /srv/source/chromium/src/out/Default/args.gn
2243

2344
# Generate the build configuration
24-
RUN gn gen out/Default
45+
gn gen out/Default
2546

2647
# Mounting the filesystem like this will require privileged execution of the docker container
2748
mount --types tmpfs --options size=100G,nr_inodes=256k,mode=1777 tmpfs /srv/source/chromium/src/out/Default

0 commit comments

Comments
 (0)