.. | ||
allocator | ||
android | ||
containers | ||
debug | ||
files | ||
hash | ||
i18n | ||
json | ||
memory | ||
message_loop | ||
metrics | ||
nix | ||
numerics | ||
posix | ||
power_monitor | ||
process | ||
profiler | ||
sampling_heap_profiler | ||
strings | ||
synchronization | ||
system | ||
task | ||
third_party | ||
threading | ||
time | ||
timer | ||
trace_event | ||
util | ||
at_exit.cc | ||
at_exit.h | ||
atomic_ref_count.h | ||
atomic_sequence_num.h | ||
atomicops.h | ||
atomicops_internals_atomicword_compat.h | ||
atomicops_internals_portable.h | ||
atomicops_internals_x86_msvc.h | ||
auto_reset.h | ||
barrier_closure.cc | ||
barrier_closure.h | ||
base64.cc | ||
base64.h | ||
base64_decode_fuzzer.cc | ||
base64_encode_fuzzer.cc | ||
base64url.cc | ||
base64url.h | ||
base_export.h | ||
base_paths.cc | ||
base_paths.h | ||
base_paths_android.cc | ||
base_paths_android.h | ||
base_paths_fuchsia.cc | ||
base_paths_fuchsia.h | ||
base_paths_mac.h | ||
base_paths_posix.h | ||
base_paths_win.cc | ||
base_paths_win.h | ||
base_switches.cc | ||
base_switches.h | ||
big_endian.cc | ||
big_endian.h | ||
bind.h | ||
bind_helpers.h | ||
bind_internal.h | ||
bit_cast.h | ||
bits.h | ||
build_time.cc | ||
build_time.h | ||
callback.h | ||
callback_forward.h | ||
callback_helpers.cc | ||
callback_helpers.h | ||
callback_internal.cc | ||
callback_internal.h | ||
callback_list.h | ||
cancelable_callback.h | ||
check_example.cc | ||
command_line.cc | ||
command_line.h | ||
compiler_specific.h | ||
component_export.h | ||
cpu.cc | ||
cpu.h | ||
critical_closure.h | ||
critical_closure_internal_ios.mm | ||
deferred_sequenced_task_runner.cc | ||
deferred_sequenced_task_runner.h | ||
enterprise_util.h | ||
enterprise_util_mac.mm | ||
enterprise_util_win.cc | ||
environment.cc | ||
environment.h | ||
export_template.h | ||
feature_list.cc | ||
feature_list.h | ||
file_descriptor_posix.h | ||
file_descriptor_store.cc | ||
file_descriptor_store.h | ||
file_version_info.h | ||
file_version_info_mac.h | ||
file_version_info_mac.mm | ||
file_version_info_win.cc | ||
file_version_info_win.h | ||
format_macros.h | ||
gtest_prod_util.h | ||
guid.cc | ||
guid.h | ||
immediate_crash.h | ||
lazy_instance.h | ||
lazy_instance_helpers.cc | ||
lazy_instance_helpers.h | ||
linux_util.cc | ||
linux_util.h | ||
location.cc | ||
location.h | ||
logging.cc | ||
logging.h | ||
logging_win.cc | ||
logging_win.h | ||
macros.h | ||
native_library.cc | ||
native_library.h | ||
native_library_fuchsia.cc | ||
native_library_ios.mm | ||
native_library_mac.mm | ||
native_library_posix.cc | ||
native_library_win.cc | ||
no_destructor.h | ||
observer_list.h | ||
observer_list_internal.cc | ||
observer_list_internal.h | ||
observer_list_perftest.cc | ||
observer_list_threadsafe.cc | ||
observer_list_threadsafe.h | ||
observer_list_types.cc | ||
observer_list_types.h | ||
one_shot_event.cc | ||
one_shot_event.h | ||
optional.h | ||
os_compat_android.cc | ||
os_compat_android.h | ||
os_compat_nacl.cc | ||
os_compat_nacl.h | ||
OWNERS | ||
parameter_pack.h | ||
path_service.cc | ||
path_service.h | ||
pending_task.cc | ||
pending_task.h | ||
pickle.cc | ||
pickle.h | ||
pickle_fuzzer.cc | ||
post_task_and_reply_with_result_internal.h | ||
rand_util.cc | ||
rand_util.h | ||
rand_util_fuchsia.cc | ||
rand_util_nacl.cc | ||
rand_util_posix.cc | ||
rand_util_win.cc | ||
README.md | ||
run_loop.cc | ||
run_loop.h | ||
scoped_clear_last_error.h | ||
scoped_clear_last_error_win.cc | ||
scoped_generic.h | ||
scoped_native_library.cc | ||
scoped_native_library.h | ||
scoped_observer.h | ||
SECURITY_OWNERS | ||
sequence_checker.h | ||
sequence_checker_impl.cc | ||
sequence_checker_impl.h | ||
sequence_token.cc | ||
sequence_token.h | ||
sequenced_task_runner.cc | ||
sequenced_task_runner.h | ||
sequenced_task_runner_helpers.h | ||
single_thread_task_runner.h | ||
stl_util.h | ||
supports_user_data.cc | ||
supports_user_data.h | ||
sync_socket.cc | ||
sync_socket.h | ||
sync_socket_nacl.cc | ||
sync_socket_posix.cc | ||
sync_socket_win.cc | ||
sys_byteorder.h | ||
syslog_logging.cc | ||
syslog_logging.h | ||
task_runner.cc | ||
task_runner.h | ||
task_runner_util.h | ||
template_util.h | ||
thread_annotations.h | ||
token.cc | ||
token.h | ||
traits_bag.h | ||
tuple.h | ||
unguessable_token.cc | ||
unguessable_token.h | ||
updateable_sequenced_task_runner.h | ||
value_conversions.cc | ||
value_conversions.h | ||
value_iterators.cc | ||
value_iterators.h | ||
values.cc | ||
values.h | ||
version.cc | ||
version.h | ||
vlog.cc | ||
vlog.h |
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.
Base is pulled into many projects. For example, various ChromeOS daemons. So the bar for adding stuff 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.
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.