mac-arm64: Run x86_64 Widevine, if available, under Rosetta

On mac-arm64, allow the x86_64 Widevine content decryption module (CDM)
to run under Rosetta translation, even when running native arm64 Chrome.
This is necessary because there isn’t currently an arm64-native Widevine
CDM. It’s not necessary to run the rest of Chrome as x86_64 under
Rosetta translation. The isolated Widevine CDM runs in its own x86_64
utility process, and is IPC-compatible with the rest of Chrome. This
alleviates any performance impact on the rest of Chrome, and allows
crash reporting to work correctly for the rest of Chrome.

An ordinary build of Chrome for mac-arm64, even an official build, will
not include a bundled x86_64 Widevine CDM library (or, obviously, an
arm64 one, as it does not yet exist). The x86_64 Widevine library is
useless to an arm64 Chrome without an x86_64 process to host it.
However, if a universal build of Chrome is created by merging
same-version x86_64 and arm64 builds, the arm64 code will look for an
x86_64 Widevine CDM and, if found, launch an x86_64 helper process under
Rosetta translation to host it.
https://chromium-review.googlesource.com/c/2515521/ is a proposal for
creating such a universal build.

Implementation notes: if no Widevine CDM library is found in the arm64
platform-specific location, Chrome on mac-arm64 will look for one in the
x86_64 platform-specific location. This allows mac-arm64 Chrome to find
the x86_64-only bundled Widevine library. Separately, any Widevine
library found will be examined to determine its architecture. If it
contains x86_64 code and no arm64 code, an x86_64 helper will be
launched to host it. This is done because, although the Widevine library
bundled in Chrome is known to be x86_64-only and will only exist in the
x86_64 platform-specific location, it is expected that a future update
distributed by the component updater will support arm64 natively.
However, in the event that a component update is produced that supports
x86_64 but not yet arm64, it is likely that the x86_64 version
distributed to arm64 users as a component update will appear in the
arm64 platform-specific location, despite being x86_64 code. This means
that the platform-specific location path cannot be trusted to convey the
actual architecture of the library contained therein, and the
architecture must be determined by examining the library to be loaded.

No behavior change for non-mac-arm64 builds.

(cherry picked from commit dcfbb59cc22614ae318618824fccc5d446adcb12)

Bug: 1142017
Code-Word: calamity
CQ-Include-Trybots: luci.chromium.try:mac-arm64-rel
Change-Id: Ib3f4a654f89f41c0fbf9239f99010387ea242763
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2493191
Commit-Queue: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Auto-Submit: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Joshua Pawlicki <waffles@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#823801}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519881
Reviewed-by: Srinivas Sista <srinivassista@chromium.org>
Cr-Commit-Position: refs/branch-heads/4315@{#12}
Cr-Branched-From: 7ba203c1d123a84d65e7d350a46b0108f7369b20-refs/heads/master@{#823725}
26 files changed
tree: 0d67d00e871f235b9df796e956a6f8fe34082d1e
  1. android_webview/
  2. apps/
  3. ash/
  4. base/
  5. build/
  6. build_overrides/
  7. buildtools/
  8. cc/
  9. chrome/
  10. chromecast/
  11. chromeos/
  12. cloud_print/
  13. codelabs/
  14. components/
  15. content/
  16. courgette/
  17. crypto/
  18. dbus/
  19. device/
  20. docs/
  21. extensions/
  22. fuchsia/
  23. gin/
  24. google_apis/
  25. google_update/
  26. gpu/
  27. headless/
  28. infra/
  29. ios/
  30. ipc/
  31. jingle/
  32. media/
  33. mojo/
  34. native_client_sdk/
  35. net/
  36. pdf/
  37. ppapi/
  38. printing/
  39. remoting/
  40. rlz/
  41. sandbox/
  42. services/
  43. skia/
  44. sql/
  45. storage/
  46. styleguide/
  47. testing/
  48. third_party/
  49. tools/
  50. ui/
  51. url/
  52. weblayer/
  53. .clang-format
  54. .clang-tidy
  55. .eslintrc.js
  56. .git-blame-ignore-revs
  57. .gitattributes
  58. .gitignore
  59. .gn
  60. .vpython
  61. .vpython3
  62. .yapfignore
  63. AUTHORS
  64. BUILD.gn
  65. CODE_OF_CONDUCT.md
  66. codereview.settings
  67. DEPS
  68. DIR_METADATA
  69. ENG_REVIEW_OWNERS
  70. LICENSE
  71. LICENSE.chromium_os
  72. OWNERS
  73. PRESUBMIT.py
  74. PRESUBMIT_test.py
  75. PRESUBMIT_test_mocks.py
  76. README.md
  77. WATCHLISTS
README.md

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure .

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.