Skip to content

Commit

Permalink
base
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlstrom-g committed Apr 22, 2024
1 parent aada42d commit 64d0fc0
Show file tree
Hide file tree
Showing 36 changed files with 225 additions and 154 deletions.
208 changes: 101 additions & 107 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ if (is_apple) {
}

# Determines whether libevent should be dep.
dep_libevent =
!is_fuchsia && !is_win && !is_mac && !is_nacl && !use_cobalt_customizations
dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl
&& !use_cobalt_customizations

# Determines whether message_pump_libevent should be used.
use_libevent = dep_libevent && !is_ios
Expand Down Expand Up @@ -1460,7 +1460,7 @@ component("base") {
}

# Fuchsia.
if (is_fuchsia && !is_starboard) {
if (is_fuchsia) {
sources += [
"base_paths_fuchsia.cc",
"debug/debugger_fuchsia.cc",
Expand Down Expand Up @@ -2369,9 +2369,9 @@ component("base") {
}

if (!is_starboard) {
if ((is_posix && !is_apple && !is_android) || is_fuchsia) {
sources += [ "profiler/stack_sampler_posix.cc" ]
}
if ((is_posix && !is_apple && !is_android) || is_fuchsia) {
sources += [ "profiler/stack_sampler_posix.cc" ]
}
}

if ((is_posix && !is_apple && !is_android && !is_chromeos) || is_fuchsia || is_starboard) {
Expand Down Expand Up @@ -2762,9 +2762,6 @@ component("i18n") {
"i18n/streaming_utf8_validator.h",
"i18n/string_compare.cc",
"i18n/string_compare.h",

# "i18n/string_search.cc",
# "i18n/string_search.h",
"i18n/time_formatting.cc",
"i18n/time_formatting.h",
"i18n/timezone.cc",
Expand Down Expand Up @@ -2799,8 +2796,8 @@ component("i18n") {
configs -= [ "//starboard/build/config:size" ]
configs += [ "//starboard/build/config:speed" ]
} else {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}

Expand All @@ -2817,82 +2814,82 @@ component("i18n") {
}

if (!is_starboard) {
test("base_perftests") {
sources = [
"hash/hash_perftest.cc",
"message_loop/message_pump_perftest.cc",
"observer_list_perftest.cc",
"rand_util_perftest.cc",
"strings/string_util_perftest.cc",
"substring_set_matcher/substring_set_matcher_perftest.cc",
"task/job_perftest.cc",
"task/sequence_manager/sequence_manager_perftest.cc",
"task/thread_pool/thread_pool_perftest.cc",
"threading/counter_perftest.cc",
"threading/thread_local_storage_perftest.cc",

# "test/run_all_unittests.cc",
"json/json_perftest.cc",
"synchronization/lock_perftest.cc",
"synchronization/waitable_event_perftest.cc",
"threading/thread_perftest.cc",
]

deps = [
":base",
":debugging_buildflags",
"//base/test:test_support",
"//base/test:test_support_perf",
"//testing/gtest",
"//testing/perf",
]
test("base_perftests") {
sources = [
"hash/hash_perftest.cc",
"message_loop/message_pump_perftest.cc",
"observer_list_perftest.cc",
"rand_util_perftest.cc",
"strings/string_util_perftest.cc",
"substring_set_matcher/substring_set_matcher_perftest.cc",
"task/job_perftest.cc",
"task/sequence_manager/sequence_manager_perftest.cc",
"task/thread_pool/thread_pool_perftest.cc",
"threading/counter_perftest.cc",
"threading/thread_local_storage_perftest.cc",

# "test/run_all_unittests.cc",
"json/json_perftest.cc",
"synchronization/lock_perftest.cc",
"synchronization/waitable_event_perftest.cc",
"threading/thread_perftest.cc",
]

if (use_partition_alloc) {
sources += [
"allocator/partition_allocator/partition_alloc_perftest.cc",
"allocator/partition_allocator/partition_lock_perftest.cc",
]
deps += [ ":partition_alloc_test_support" ]
}
deps = [
":base",
":debugging_buildflags",
"//base/test:test_support",
"//base/test:test_support_perf",
"//testing/gtest",
"//testing/perf",
]

data_deps = [
# Needed for isolate script to execute.
"//testing:run_perf_test",
if (use_partition_alloc) {
sources += [
"allocator/partition_allocator/partition_alloc_perftest.cc",
"allocator/partition_allocator/partition_lock_perftest.cc",
]
deps += [ ":partition_alloc_test_support" ]
}

if (is_android) {
deps += [ "//testing/android/native_test:native_test_native_code" ]
shard_timeout = 600
}
data_deps = [
# Needed for isolate script to execute.
"//testing:run_perf_test",
]

if (is_fuchsia) {
# Run these performance tests against the actual system.
run_as_chromium_system_test = true
}
if (is_android) {
deps += [ "//testing/android/native_test:native_test_native_code" ]
shard_timeout = 600
}

if (!is_official_build) {
# The extra data tables required by stack traces are turned off for official
# build, only do stack trace perftest for unofficial build
sources += [ "debug/stack_trace_perftest.cc" ]
}
if (is_fuchsia) {
# Run these performance tests against the actual system.
run_as_chromium_system_test = true
}

if (build_allocation_stack_trace_recorder) {
sources += [ "debug/allocation_trace_perftest.cc" ]
}
if (!is_official_build) {
# The extra data tables required by stack traces are turned off for official
# build, only do stack trace perftest for unofficial build
sources += [ "debug/stack_trace_perftest.cc" ]
}

test("base_i18n_perftests") {
sources = [ "i18n/streaming_utf8_validator_perftest.cc" ]
deps = [
":base",
":i18n",
"//base/test:test_support",
"//base/test:test_support_perf",
"//testing/gtest",
]
if (build_allocation_stack_trace_recorder) {
sources += [ "debug/allocation_trace_perftest.cc" ]
}
}

test("base_i18n_perftests") {
sources = [ "i18n/streaming_utf8_validator_perftest.cc" ]
deps = [
":base",
":i18n",
"//base/test:test_support",
"//base/test:test_support_perf",
"//testing/gtest",
]
}
}

if (!is_ios && !use_cobalt_customizations) {
executable("build_utf8_validator_tables") {
sources = [ "i18n/build_utf8_validator_tables.cc" ]
Expand Down Expand Up @@ -3015,35 +3012,35 @@ source_set("base_stack_sampling_profiler_test_util") {
}

copy("base_unittests_bundle_data") {
testonly = true
testonly = true
if (is_starboard) {
install_content = true
}
sources = [
"//tools/metrics/histograms/enums.xml",
"test/data/file_util/binary_file.bin",
"test/data/file_util/binary_file_diff.bin",
"test/data/file_util/binary_file_same.bin",
"test/data/file_util/blank_line.txt",
"test/data/file_util/blank_line_crlf.txt",
"test/data/file_util/crlf.txt",
"test/data/file_util/different.txt",
"test/data/file_util/different_first.txt",
"test/data/file_util/different_last.txt",
"test/data/file_util/empty1.txt",
"test/data/file_util/empty2.txt",
"test/data/file_util/first1.txt",
"test/data/file_util/first2.txt",
"test/data/file_util/original.txt",
"test/data/file_util/same.txt",
"test/data/file_util/same_length.txt",
"test/data/file_util/shortened.txt",
"test/data/json/bom_feff.json",
"test/data/pe_image_reader/signed.exe",
"test/data/serializer_nested_test.json",
"test/data/serializer_test.json",
"test/data/serializer_test_nowhitespace.json",
]
sources = [
"//tools/metrics/histograms/enums.xml",
"test/data/file_util/binary_file.bin",
"test/data/file_util/binary_file_diff.bin",
"test/data/file_util/binary_file_same.bin",
"test/data/file_util/blank_line.txt",
"test/data/file_util/blank_line_crlf.txt",
"test/data/file_util/crlf.txt",
"test/data/file_util/different.txt",
"test/data/file_util/different_first.txt",
"test/data/file_util/different_last.txt",
"test/data/file_util/empty1.txt",
"test/data/file_util/empty2.txt",
"test/data/file_util/first1.txt",
"test/data/file_util/first2.txt",
"test/data/file_util/original.txt",
"test/data/file_util/same.txt",
"test/data/file_util/same_length.txt",
"test/data/file_util/shortened.txt",
"test/data/json/bom_feff.json",
"test/data/pe_image_reader/signed.exe",
"test/data/serializer_nested_test.json",
"test/data/serializer_test.json",
"test/data/serializer_test_nowhitespace.json",
]
if (is_starboard) {
outputs = [ "$sb_static_contents_output_data_dir/test/base/{{source_target_relative}}" ]
} else {
Expand Down Expand Up @@ -3646,10 +3643,6 @@ test("base_unittests") {
defines = [ "U_COMMON_IMPLEMENTATION" ]

data_deps = [
# "//base/test:immediate_crash_test_helper",
# "//base/test:test_child_process",
# "//base/test:test_shared_library",
# "//testing/buildbot/filters:base_unittests_filters",
]

if (is_android && enable_chrome_android_internal) {
Expand All @@ -3661,11 +3654,11 @@ test("base_unittests") {
}

if (is_apple && !is_starboard) {
public_deps = [ ":base_unittests_bundle_data" ]

deps += [ ":base_unittests_arc" ]
}

public_deps = [ ":base_unittests_bundle_data" ]

if (is_starboard){
data_deps += [
":base_unittests_bundle_data",
Expand Down Expand Up @@ -3759,6 +3752,7 @@ test("base_unittests") {
"debug/proc_maps_linux_unittest.cc",
"files/scoped_file_linux_unittest.cc",
]

if (!!use_cobalt_customizations && !is_nacl) {
deps += [ ":stack_canary_linux_unittests" ]
}
Expand Down
3 changes: 1 addition & 2 deletions base/allocator/dispatcher/tls_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#if USE_LOCAL_TLS_EMULATION()
#include <algorithm>
#include <array>
#include <condition_variable>
#include <cstddef>
#include <functional>
#include <mutex>
Expand Down Expand Up @@ -586,4 +585,4 @@ TEST_F(BasePThreadTLSSystemDeathTest, VerifyDeathIfTearDownWithoutSetup) {
#endif
} // namespace base::allocator::dispatcher

#endif // USE_LOCAL_TLS_EMULATION()
#endif // USE_LOCAL_TLS_EMULATION()
3 changes: 1 addition & 2 deletions base/allocator/partition_allocator/partition_alloc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ if (is_nacl) {
} else if (current_cpu == "x86" || current_cpu == "arm") {
has_64_bit_pointers = false
} else {
has_64_bit_pointers = true
# assert(false, "Unknown CPU: $current_cpu")
assert(false, "Unknown CPU: $current_cpu")
}

if (use_partition_alloc_as_malloc_default) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool IsLargeMemoryDevice() {
}

bool SetAddressSpaceLimit() {
#if !defined(ARCH_CPU_64_BITS) || !BUILDFLAG(IS_POSIX) || 1
#if !defined(ARCH_CPU_64_BITS) || !BUILDFLAG(IS_POSIX)
// 32 bits => address space is limited already.
return true;
#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
Expand Down Expand Up @@ -125,7 +125,7 @@ bool SetAddressSpaceLimit() {
}

bool ClearAddressSpaceLimit() {
#if !defined(ARCH_CPU_64_BITS) || !BUILDFLAG(IS_POSIX) || 1
#if !defined(ARCH_CPU_64_BITS) || !BUILDFLAG(IS_POSIX)
return true;
#elif BUILDFLAG(IS_POSIX)
struct rlimit limit;
Expand Down Expand Up @@ -622,7 +622,7 @@ void FreeFullSlotSpan(PartitionRoot<internal::ThreadSafe>* root,
EXPECT_TRUE(slot_span->is_empty());
}

#if 0// BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
bool CheckPageInCore(void* ptr, bool in_core) {
unsigned char ret = 0;
EXPECT_EQ(0, mincore(ptr, SystemPageSize(), &ret));
Expand Down
1 change: 0 additions & 1 deletion base/android/jni_generator/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.jni.generator">

<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="34" />
<application></application>

</manifest>
2 changes: 1 addition & 1 deletion base/base_paths.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool PathProvider(int key, FilePath* result) {
#endif // !BUILDFLAG(IS_FUCHSIA)
case DIR_TEST_DATA: {
FilePath test_data_path;
if (!PathService::Get(DIR_MODULE, &test_data_path))
if (!PathService::Get(DIR_SRC_TEST_DATA_ROOT, &test_data_path))
return false;
test_data_path = test_data_path.Append(FILE_PATH_LITERAL("base"));
test_data_path = test_data_path.Append(FILE_PATH_LITERAL("test"));
Expand Down
6 changes: 0 additions & 6 deletions base/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ ALWAYS_INLINE constexpr
// use `Log2Floor` and add 1 to the result.
//
// TODO(pkasting): When C++20 is available, replace with std::bit_xxx().
#if defined(COBALT_PENDING_CLEAN_UP) && defined(COMPILER_MSVC)
#define FUNCTION_SPECIFIER ALWAYS_INLINE
#else
#define FUNCTION_SPECIFIER constexpr
#endif
ALWAYS_INLINE int Log2Floor(uint32_t n) {
return 31 - CountLeadingZeroBits(n);
}
Expand All @@ -198,7 +193,6 @@ ALWAYS_INLINE int Log2Ceiling(uint32_t n) {
// why the statement below starts with (n ? 32 : -1).
return (n ? 32 : -1) - CountLeadingZeroBits(n - 1);
}
#undef FUNCTION_SPECIFIER

// Returns a value of type T with a single bit set in the left-most position.
// Can be used instead of manually shifting a 1 to the left.
Expand Down
Loading

0 comments on commit 64d0fc0

Please sign in to comment.