Reland "Android: Set extractNativeLibs="false" by default for apk targets"

This reverts commit 41e92a54a8fcc5c258b8e41d7d6ad44990cb7aef.

Reason for reland: Fix landed in https://crrev.com/c/7952581

Original change's description:
> Revert "Android: Set extractNativeLibs="false" by default for apk targets"
>
> This reverts commit 5a1a32db6c745921f7e7cf90362ab91a329469d1.
>
> Reason for revert: Breaking VR apk
>
> Failure Link: https://ci.chromium.org/ui/p/chromium/builders/try/android-arm64-rel/1497497/overview
>
> Original change's description:
> > Android: Set extractNativeLibs="false" by default for apk targets
> >
> > This was already the default for bundle targets, since bundletool sets
> > it.
> >
> > This will reduce disk requirements by not extracting .so files in test
> > .apks when installing them.
> >
> > Bug: 516808390
> > Change-Id: I555343ae27c932d94d96176659686468ce2adfe1
> > Cq-Include-Trybots: luci.chrome.try:android-internal-dbg,android-internal-binary-size
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7869175
> > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
> > Owners-Override: Andrew Grieve <agrieve@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1646982}
>
> Bug: 516808390
> Cq-Include-Trybots: luci.chrome.try:android-internal-dbg,android-internal-binary-size
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: Ib3959b8d6a7a892c929cdf148dc968dbc892759e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7952140
> Commit-Queue: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Andrew Grieve <agrieve@chromium.org>
> Owners-Override: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1647597}

Bug: 516808390
Cq-Include-Trybots: luci.chrome.try:android-internal-dbg,android-internal-binary-size
Change-Id: I01699ba1a67df04ad441315438ccd10d3a66e5e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7952042
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1647846}
NOKEYCHECK=True
GitOrigin-RevId: 4f4d0ed7e251f9fd123e4fad947388f3b867f81d
4 files changed
tree: 88bfae0d39fd6c7815902474a103fbe628350d69
  1. allocator/
  2. android/
  3. apple/
  4. containers/
  5. debug/
  6. files/
  7. fuchsia/
  8. functional/
  9. hash/
  10. i18n/
  11. ios/
  12. json/
  13. logging/
  14. mac/
  15. macros/
  16. memory/
  17. memory_coordinator/
  18. message_loop/
  19. metrics/
  20. nix/
  21. numerics/
  22. posix/
  23. power_monitor/
  24. process/
  25. profiler/
  26. sampling_heap_profiler/
  27. strings/
  28. substring_set_matcher/
  29. synchronization/
  30. system/
  31. task/
  32. test/
  33. third_party/
  34. threading/
  35. time/
  36. timer/
  37. tools/
  38. trace_event/
  39. tracing/
  40. types/
  41. version_info/
  42. win/
  43. at_exit.cc
  44. at_exit.h
  45. at_exit_unittest.cc
  46. atomic_ref_count.h
  47. atomic_sequence_num.h
  48. atomicops.cc
  49. atomicops.h
  50. atomicops_internals_portable.h
  51. atomicops_unittest.cc
  52. auto_reset.h
  53. auto_reset_unittest.cc
  54. barrier_callback.h
  55. barrier_callback_unittest.cc
  56. barrier_closure.cc
  57. barrier_closure.h
  58. barrier_closure_unittest.cc
  59. base64.cc
  60. base64.h
  61. base64_decode_fuzzer.cc
  62. base64_encode_fuzzer.cc
  63. base64_unittest.cc
  64. base64url.cc
  65. base64url.h
  66. base64url_unittest.cc
  67. base_export.h
  68. base_paths.cc
  69. base_paths.h
  70. base_paths_android.cc
  71. base_paths_android.h
  72. base_paths_apple.cc
  73. base_paths_apple.h
  74. base_paths_fuchsia.cc
  75. base_paths_ios.h
  76. base_paths_ios.mm
  77. base_paths_mac.h
  78. base_paths_mac.mm
  79. base_paths_posix.cc
  80. base_paths_posix.h
  81. base_paths_win.cc
  82. base_paths_win.h
  83. base_rust_unittests.rs
  84. base_switches.h
  85. big_endian.h
  86. big_endian_perftest.cc
  87. bit_cast.h
  88. bit_cast_unittest.cc
  89. bits.h
  90. bits_unittest.cc
  91. BUILD.gn
  92. build_time.h
  93. build_time_unittest.cc
  94. byte_count.cc
  95. byte_count.h
  96. byte_count_unittest.cc
  97. byte_size.cc
  98. byte_size.h
  99. byte_size_nocompile.nc
  100. byte_size_unittest.cc
  101. callback_list.cc
  102. callback_list.h
  103. callback_list_nocompile.nc
  104. callback_list_unittest.cc
  105. cancelable_callback.h
  106. cancelable_callback_unittest.cc
  107. check.cc
  108. check.h
  109. check_deref.h
  110. check_deref_nocompile.nc
  111. check_deref_unittest.cc
  112. check_example.cc
  113. check_is_test.cc
  114. check_is_test.h
  115. check_is_test_unittest.cc
  116. check_nocompile.nc
  117. check_op.cc
  118. check_op.h
  119. check_unittest.cc
  120. check_version_internal.h.in
  121. command_line.cc
  122. command_line.h
  123. command_line_fuzzer.cc
  124. command_line_unittest.cc
  125. compiler_hardening_test.cc
  126. compiler_specific.h
  127. component_export.h
  128. component_export_unittest.cc
  129. cpu.cc
  130. cpu.h
  131. cpu_unittest.cc
  132. critical_closure.h
  133. critical_closure_internal_ios.mm
  134. dcheck_is_on.h
  135. DEPS
  136. DIR_METADATA
  137. enterprise_util.cc
  138. enterprise_util.h
  139. enterprise_util_mac.mm
  140. enterprise_util_mac_unittest.mm
  141. enterprise_util_win.cc
  142. environment.cc
  143. environment.h
  144. environment_unittest.cc
  145. export_template.h
  146. feature.h
  147. feature.rs
  148. feature_internal.h
  149. feature_list.cc
  150. feature_list.h
  151. feature_list_internal.cc
  152. feature_list_internal.h
  153. feature_list_unittest.cc
  154. feature_unittest.rs
  155. feature_visitor.h
  156. features.cc
  157. features.h
  158. file_descriptor_posix.cc
  159. file_descriptor_posix.h
  160. file_descriptor_store.cc
  161. file_descriptor_store.h
  162. file_version_info.h
  163. file_version_info_apple.h
  164. file_version_info_apple.mm
  165. file_version_info_win.cc
  166. file_version_info_win.h
  167. file_version_info_win_unittest.cc
  168. format_macros.h
  169. gmock_unittest.cc
  170. gtest_prod_util.h
  171. immediate_crash.h
  172. immediate_crash_unittest.cc
  173. lazy_instance.h
  174. lazy_instance_helpers.cc
  175. lazy_instance_helpers.h
  176. lazy_instance_unittest.cc
  177. libcpp_hardening_test.cc
  178. linux_util.cc
  179. linux_util.h
  180. linux_util_unittest.cc
  181. location.cc
  182. location.h
  183. location_unittest.cc
  184. logging.cc
  185. logging.h
  186. logging_chromeos.cc
  187. logging_nocompile.nc
  188. logging_unittest.cc
  189. logging_win.cc
  190. logging_win.h
  191. moving_window.h
  192. moving_window_unittest.cc
  193. native_library.h
  194. native_library_apple.mm
  195. native_library_fuchsia.cc
  196. native_library_posix.cc
  197. native_library_unittest.cc
  198. native_library_win.cc
  199. no_destructor.h
  200. no_destructor_nocompile.nc
  201. no_destructor_unittest.cc
  202. not_fatal_until.h
  203. notimplemented.h
  204. notreached.h
  205. observer_list.h
  206. observer_list_internal.cc
  207. observer_list_internal.h
  208. observer_list_nocompile.nc
  209. observer_list_perftest.cc
  210. observer_list_threadsafe.cc
  211. observer_list_threadsafe.h
  212. observer_list_threadsafe_unittest.cc
  213. observer_list_types.cc
  214. observer_list_types.h
  215. observer_list_unittest.cc
  216. one_shot_event.cc
  217. one_shot_event.h
  218. one_shot_event_unittest.cc
  219. os_compat_android.cc
  220. os_compat_android.h
  221. OWNERS
  222. parameter_pack.h
  223. parameter_pack_unittest.cc
  224. path_service.cc
  225. path_service.h
  226. path_service_unittest.cc
  227. pending_task.cc
  228. pending_task.h
  229. pickle.cc
  230. pickle.h
  231. pickle_fuzzer.cc
  232. pickle_unittest.cc
  233. PRESUBMIT.py
  234. protobuf_hardening_test.cc
  235. protobuf_hardening_test_support.proto
  236. rand_util.cc
  237. rand_util.h
  238. rand_util_fuchsia.cc
  239. rand_util_perftest.cc
  240. rand_util_posix.cc
  241. rand_util_unittest.cc
  242. rand_util_win.cc
  243. README.md
  244. run_loop.cc
  245. run_loop.h
  246. run_loop.rs
  247. run_loop_nocompile.nc
  248. run_loop_rust_shim.cc
  249. run_loop_rust_shim.h
  250. run_loop_unittest.cc
  251. safe_numerics_nocompile.nc
  252. safe_numerics_unittest.cc
  253. scoped_add_feature_flags.cc
  254. scoped_add_feature_flags.h
  255. scoped_add_feature_flags_unittest.cc
  256. scoped_clear_last_error.h
  257. scoped_clear_last_error_unittest.cc
  258. scoped_clear_last_error_win.cc
  259. scoped_environment_variable_override.cc
  260. scoped_environment_variable_override.h
  261. scoped_generic.h
  262. scoped_generic_unittest.cc
  263. scoped_multi_source_observation.h
  264. scoped_multi_source_observation_unittest.cc
  265. scoped_native_library.cc
  266. scoped_native_library.h
  267. scoped_native_library_unittest.cc
  268. scoped_observation.h
  269. scoped_observation_traits.h
  270. scoped_observation_unittest.cc
  271. SECURITY_OWNERS
  272. security_unittest.cc
  273. sequence_checker.cc
  274. sequence_checker.h
  275. sequence_checker_impl.cc
  276. sequence_checker_impl.h
  277. sequence_checker_nocompile.nc
  278. sequence_checker_unittest.cc
  279. sequence_token.cc
  280. sequence_token.h
  281. sequence_token_unittest.cc
  282. simdutf_shim.cc
  283. simdutf_shim.h
  284. stack_canary_linux.cc
  285. stack_canary_linux.h
  286. stack_canary_linux_unittest.cc
  287. state_transitions.h
  288. state_transitions_unittest.cc
  289. std_clamp_unittest.cc
  290. stl_util.h
  291. stl_util_unittest.cc
  292. supports_user_data.cc
  293. supports_user_data.h
  294. supports_user_data_unittest.cc
  295. sync_socket.cc
  296. sync_socket.h
  297. sync_socket_posix.cc
  298. sync_socket_unittest.cc
  299. sync_socket_win.cc
  300. sys_byteorder.h
  301. sys_byteorder_unittest.cc
  302. syslog_logging.cc
  303. syslog_logging.h
  304. thread_annotations.h
  305. thread_annotations_nocompile.nc
  306. thread_annotations_unittest.cc
  307. token.cc
  308. token.h
  309. token_unittest.cc
  310. tools_sanity_unittest.cc
  311. traits_bag.h
  312. traits_bag_nocompile.nc
  313. traits_bag_unittest.cc
  314. tuple.h
  315. tuple_unittest.cc
  316. unguessable_token.cc
  317. unguessable_token.h
  318. unguessable_token_unittest.cc
  319. unsafe_buffers_nocompile.nc
  320. unsafe_buffers_unittest.cc
  321. uuid.cc
  322. uuid.h
  323. uuid_unittest.cc
  324. value_iterators.cc
  325. value_iterators.h
  326. value_iterators_unittest.cc
  327. values.cc
  328. values.h
  329. values_nocompile.nc
  330. values_unittest.cc
  331. version.cc
  332. version.h
  333. version_unittest.cc
  334. vlog.cc
  335. vlog.h
  336. vlog_unittest.cc
  337. write_build_date_header.py
README.md

What is this

Contains a written down set of principles and other information on //base. Please add to it!

About //base:

Chromium is a very mature project. Most things that are generally useful are already here and things not here aren't generally useful.

The bar for adding stuff to base is that it must have demonstrated wide applicability. Prefer to add things closer to where they're used (i.e. “not base”), and pull into base only when needed. In a project our size, sometimes even duplication is OK and inevitable.

Adding a new logging macro DPVELOG_NE is not more clear than just writing the stuff you want to log in a regular logging statement, even if it makes your calling code longer. Just add it to your own code.

If the code in question does not need to be used inside base, but will have multiple consumers across the codebase, consider placing it in a new directory under components/ instead.

base is written for the Chromium project and is not intended to be used outside it. Using base outside of src.git is explicitly not supported, and base makes no guarantees about API (or even ABI) stability (like all other code in Chromium). New code that depends on base/ must be in src.git. Code that's not in src.git but pulled in through DEPS (for example, v8) cannot use base.

Qualifications for being in //base OWNERS

  • interest and ability to learn low level/high detail/complex c++ stuff
  • inclination to always ask why and understand everything (including external interactions like win32) rather than just hoping the author did it right
  • mentorship/experience
  • demonstrated good judgement (esp with regards to public APIs) over a length of time

Owners are added when a contributor has shown the above qualifications and when they express interest. There isn't an upper bound on the number of OWNERS.

Design and naming

  • Be sure to use the base namespace.
  • STL-like constructs should adhere as closely to STL as possible. Functions and behaviors not present in STL should only be added when they are related to the specific data structure implemented by the container.
  • For STL-like constructs our policy is that they should use STL-like naming even when it may conflict with the style guide. So functions and class names should be lower case with underscores. Non-STL-like classes and functions should use Google naming.

Performance testing

Since the primitives provided by //base are used very widely, it is important to ensure they scale to the necessary workloads and perform well under all supported platforms. The base_perftests target is a suite of synthetic microbenchmarks that measure performance in various scenarios:

  • BasicPostTaskPerfTest: Exercises MessageLoopTaskRunner's multi-threaded queue in isolation.
  • ConditionVariablePerfTest: Measures thread switching cost of condition variables.
  • IntegratedPostTaskPerfTest: Exercises the full MessageLoop/RunLoop machinery.
  • JSONPerfTest: Tests JSONWriter and JSONReader performance.
  • MessageLoopPerfTest: Measures the speed of task posting in various configurations.
  • ObserverListPerfTest: Exercises adding, removing and signalling observers.
  • PartitionLockPerfTest: Tests the implementation of Lock used in PartitionAlloc
  • PthreadEventPerfTest: Establishes the baseline thread switching cost using pthreads.
  • RandUtilPerfTest: Measures the time it takes to generate random numbers.
  • ScheduleWorkTest: Measures the overhead of MessagePump::ScheduleWork.
  • SequenceManagerPerfTest: Benchmarks SequenceManager scheduling with various underlying task runners.
  • TaskObserverPerfTest: Measures the incremental cost of adding task observers.
  • TaskPerfTest: Checks the cost of posting tasks between threads.
  • ThreadLocalStoragePerfTest: Exercises different mechanisms for accessing data associated with the current thread (C++ thread_local, the implementation in //base, the POSIX/WinAPI directly)
  • WaitableEvent{Thread,}PerfTest: Measures waitable events in single and multithreaded scenarios.

Regressions in these benchmarks can generally by caused by 1) operating system changes, 2) compiler version or flag changes or 3) changes in //base code itself.

Rust code

Rust code in base should be organized into very small crates, split up by function. Merging crates is sometimes unavoidable (due to dependency cycles or the orphaning rule).

Rust files should live near the equivalent C++ files (if any), and use the same naming scheme (for example, run_loop.rs, not run_loop_rust.rs).

When adding FFI shims, prefer separate _shim.h files rather than adding code to existing C++ files. This helps avoid circular dependencies with the //base target. It also avoids adding code to commonly-used headers, which can increase compile size by a lot.

Crates which you expect to be widely used should be added to the public_deps of the //base:base_rust target, so that developers can simply depend on //base:base_rust the same way they do with //base.