[go: nahoru, domu]

tree: d604d090fcf1c1f7f0a540b424653275e2d68d74 [path history] [tgz]
  1. allocator/
  2. android/
  3. containers/
  4. debug/
  5. files/
  6. fuchsia/
  7. functional/
  8. hash/
  9. i18n/
  10. ios/
  11. json/
  12. mac/
  13. memory/
  14. message_loop/
  15. metrics/
  16. nix/
  17. numerics/
  18. posix/
  19. power_monitor/
  20. process/
  21. profiler/
  22. ranges/
  23. sampling_heap_profiler/
  24. strings/
  25. synchronization/
  26. system/
  27. task/
  28. test/
  29. third_party/
  30. threading/
  31. time/
  32. timer/
  33. trace_event/
  34. tracing/
  35. types/
  36. util/
  37. win/
  38. as_const.h
  39. as_const_unittest.cc
  40. at_exit.cc
  41. at_exit.h
  42. at_exit_unittest.cc
  43. atomic_ref_count.h
  44. atomic_sequence_num.h
  45. atomicops.h
  46. atomicops_internals_atomicword_compat.h
  47. atomicops_internals_portable.h
  48. atomicops_unittest.cc
  49. auto_reset.h
  50. auto_reset_unittest.cc
  51. barrier_callback.h
  52. barrier_callback_unittest.cc
  53. barrier_closure.cc
  54. barrier_closure.h
  55. barrier_closure_unittest.cc
  56. base64.cc
  57. base64.h
  58. base64_decode_fuzzer.cc
  59. base64_encode_fuzzer.cc
  60. base64_unittest.cc
  61. base64url.cc
  62. base64url.h
  63. base64url_unittest.cc
  64. base_export.h
  65. base_paths.cc
  66. base_paths.h
  67. base_paths_android.cc
  68. base_paths_android.h
  69. base_paths_fuchsia.cc
  70. base_paths_fuchsia.h
  71. base_paths_mac.h
  72. base_paths_mac.mm
  73. base_paths_posix.cc
  74. base_paths_posix.h
  75. base_paths_win.cc
  76. base_paths_win.h
  77. base_switches.cc
  78. base_switches.h
  79. big_endian.cc
  80. big_endian.h
  81. big_endian_unittest.cc
  82. bind.h
  83. bind_internal.h
  84. bind_post_task.h
  85. bind_post_task_internal.h
  86. bind_post_task_unittest.cc
  87. bind_post_task_unittest.nc
  88. bind_unittest.cc
  89. bind_unittest.nc
  90. bit_cast.h
  91. bit_cast_unittest.cc
  92. bits.h
  93. bits_unittest.cc
  94. BUILD.gn
  95. build_time.cc
  96. build_time.h
  97. build_time_unittest.cc
  98. callback.h
  99. callback_forward.h
  100. callback_helpers.cc
  101. callback_helpers.h
  102. callback_helpers_unittest.cc
  103. callback_internal.cc
  104. callback_internal.h
  105. callback_list.cc
  106. callback_list.h
  107. callback_list_unittest.cc
  108. callback_list_unittest.nc
  109. callback_unittest.cc
  110. callback_unittest.nc
  111. cancelable_callback.h
  112. cancelable_callback_unittest.cc
  113. check.cc
  114. check.h
  115. check_example.cc
  116. check_op.cc
  117. check_op.h
  118. check_unittest.cc
  119. command_line.cc
  120. command_line.h
  121. command_line_unittest.cc
  122. compiler_specific.h
  123. component_export.h
  124. component_export_unittest.cc
  125. cpu.cc
  126. cpu.h
  127. cpu_affinity_posix.cc
  128. cpu_affinity_posix.h
  129. cpu_affinity_posix_unittest.cc
  130. cpu_unittest.cc
  131. critical_closure.h
  132. critical_closure_internal_ios.mm
  133. cxx17_backports.h
  134. cxx17_backports_unittest.cc
  135. cxx20_to_address.h
  136. dcheck_is_on.h
  137. deferred_sequenced_task_runner.cc
  138. deferred_sequenced_task_runner.h
  139. deferred_sequenced_task_runner_unittest.cc
  140. DEPS
  141. DIR_METADATA
  142. enterprise_util.h
  143. enterprise_util_mac.mm
  144. enterprise_util_mac_unittest.mm
  145. enterprise_util_win.cc
  146. environment.cc
  147. environment.h
  148. environment_unittest.cc
  149. export_template.h
  150. feature_list.cc
  151. feature_list.h
  152. feature_list_unittest.cc
  153. file_descriptor_posix.cc
  154. file_descriptor_posix.h
  155. file_descriptor_store.cc
  156. file_descriptor_store.h
  157. file_version_info.h
  158. file_version_info_mac.h
  159. file_version_info_mac.mm
  160. file_version_info_win.cc
  161. file_version_info_win.h
  162. file_version_info_win_unittest.cc
  163. format_macros.h
  164. gmock_unittest.cc
  165. gtest_prod_util.h
  166. guid.cc
  167. guid.h
  168. guid_unittest.cc
  169. immediate_crash.h
  170. immediate_crash_unittest.cc
  171. lazy_instance.h
  172. lazy_instance_helpers.cc
  173. lazy_instance_helpers.h
  174. lazy_instance_unittest.cc
  175. linux_util.cc
  176. linux_util.h
  177. linux_util_unittest.cc
  178. location.cc
  179. location.h
  180. location_unittest.cc
  181. logging.cc
  182. logging.h
  183. logging_chromeos.cc
  184. logging_unittest.cc
  185. logging_win.cc
  186. logging_win.h
  187. macros.h
  188. native_library.cc
  189. native_library.h
  190. native_library_fuchsia.cc
  191. native_library_ios.mm
  192. native_library_mac.mm
  193. native_library_posix.cc
  194. native_library_unittest.cc
  195. native_library_win.cc
  196. no_destructor.h
  197. no_destructor_unittest.cc
  198. no_destructor_unittest.nc
  199. notreached.cc
  200. notreached.h
  201. observer_list.h
  202. observer_list_internal.cc
  203. observer_list_internal.h
  204. observer_list_perftest.cc
  205. observer_list_threadsafe.cc
  206. observer_list_threadsafe.h
  207. observer_list_threadsafe_unittest.cc
  208. observer_list_types.cc
  209. observer_list_types.h
  210. observer_list_unittest.cc
  211. observer_list_unittest.nc
  212. one_shot_event.cc
  213. one_shot_event.h
  214. one_shot_event_unittest.cc
  215. optional_unittest.cc
  216. os_compat_android.cc
  217. os_compat_android.h
  218. os_compat_android_unittest.cc
  219. os_compat_nacl.cc
  220. os_compat_nacl.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. post_task_and_reply_with_result_internal.h
  234. PRESUBMIT.py
  235. rand_util.cc
  236. rand_util.h
  237. rand_util_fuchsia.cc
  238. rand_util_nacl.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_unittest.cc
  247. safe_numerics_unittest.cc
  248. scoped_clear_last_error.h
  249. scoped_clear_last_error_unittest.cc
  250. scoped_clear_last_error_win.cc
  251. scoped_generic.h
  252. scoped_generic_unittest.cc
  253. scoped_multi_source_observation.h
  254. scoped_multi_source_observation_unittest.cc
  255. scoped_native_library.cc
  256. scoped_native_library.h
  257. scoped_native_library_unittest.cc
  258. scoped_observation.h
  259. scoped_observation_unittest.cc
  260. SECURITY_OWNERS
  261. security_unittest.cc
  262. sequence_checker.h
  263. sequence_checker_impl.cc
  264. sequence_checker_impl.h
  265. sequence_checker_unittest.cc
  266. sequence_checker_unittest.nc
  267. sequence_token.cc
  268. sequence_token.h
  269. sequence_token_unittest.cc
  270. sequenced_task_runner.cc
  271. sequenced_task_runner.h
  272. sequenced_task_runner_helpers.h
  273. sequenced_task_runner_unittest.cc
  274. single_thread_task_runner.h
  275. stack_canary_linux.cc
  276. stack_canary_linux.h
  277. stack_canary_linux_unittest.cc
  278. stl_util.h
  279. stl_util_unittest.cc
  280. supports_user_data.cc
  281. supports_user_data.h
  282. supports_user_data_unittest.cc
  283. sync_socket.cc
  284. sync_socket.h
  285. sync_socket_nacl.cc
  286. sync_socket_posix.cc
  287. sync_socket_unittest.cc
  288. sync_socket_win.cc
  289. sys_byteorder.h
  290. sys_byteorder_unittest.cc
  291. syslog_logging.cc
  292. syslog_logging.h
  293. task_runner.cc
  294. task_runner.h
  295. task_runner_unittest.cc
  296. task_runner_util.h
  297. task_runner_util_unittest.cc
  298. template_util.h
  299. template_util_unittest.cc
  300. thread_annotations.h
  301. thread_annotations_unittest.cc
  302. thread_annotations_unittest.nc
  303. token.cc
  304. token.h
  305. token_unittest.cc
  306. tools_sanity_unittest.cc
  307. traits_bag.h
  308. traits_bag_unittest.cc
  309. traits_bag_unittest.nc
  310. tuple.h
  311. tuple_unittest.cc
  312. unguessable_token.cc
  313. unguessable_token.h
  314. unguessable_token_unittest.cc
  315. updateable_sequenced_task_runner.h
  316. value_iterators.cc
  317. value_iterators.h
  318. value_iterators_unittest.cc
  319. values.cc
  320. values.h
  321. values_unittest.cc
  322. version.cc
  323. version.h
  324. version_unittest.cc
  325. vlog.cc
  326. vlog.h
  327. vlog_unittest.cc
base/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.
  • PthreadEventPerfTest: Establishes the baseline thread switching cost using pthreads.
  • 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.
  • 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.