Add config angle_maybe_has_histograms to angle_perftests_common.

ANGLE_HAS_HISTOGRAMS wasn't consistently defined in compilation targets.
I was working on a prototype and ran into crashes due to an inline
function in TestSuite (where this class is used) getting invalid
offsets in some cases due to this :-O

Shabi:
"""
angle_source_set makes something the equivalent of a temporary .a,
so objects are not recompiled for every target that links to it
"""

Also change ANGLE_HAS_HISTOGRAMS to =1 or =0 as Yuly suggested so that
we can check if it's defined in the header to avoid inconsistency.

Bug: angleproject:7299
Change-Id: I907184a6ca2bc673f5bffc473b584d78625a11c8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3817602
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Roman Lavrov <romanl@google.com>
Commit-Queue: Roman Lavrov <romanl@google.com>
This commit is contained in:
Roman Lavrov 2022-08-08 16:06:13 -04:00 коммит произвёл Angle LUCI CQ
Родитель 17df2fd32b
Коммит dc82ff15ee
3 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -342,8 +342,10 @@ if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) {
config("angle_maybe_has_histograms") {
if (angle_has_histograms) {
defines = [ "ANGLE_HAS_HISTOGRAMS" ]
defines = [ "ANGLE_HAS_HISTOGRAMS=1" ]
include_dirs = [ "$root_gen_dir" ]
} else {
defines = [ "ANGLE_HAS_HISTOGRAMS=0" ]
}
}
@ -377,7 +379,10 @@ template("angle_perftests_common") {
"$angle_root/third_party/rapidjson:rapidjson",
"${invoker.test_utils}",
]
public_configs += [ "${angle_root}:libANGLE_config" ]
public_configs += [
":angle_maybe_has_histograms",
"$angle_root:libANGLE_config",
]
}
}

Просмотреть файл

@ -12,7 +12,7 @@
#include <rapidjson/document.h>
#if !defined(ANGLE_HAS_HISTOGRAMS)
#if !ANGLE_HAS_HISTOGRAMS
# error "Must have histograms enabled"
#endif // !defined(ANGLE_HAS_HISTOGRAMS)

Просмотреть файл

@ -9,6 +9,10 @@
#ifndef ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_
#define ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_
#if !defined(ANGLE_HAS_HISTOGRAMS)
# error "Requires ANGLE_HAS_HISTOGRAMS, see angle_maybe_has_histograms"
#endif // !defined(ANGLE_HAS_HISTOGRAMS)
#include <map>
#include <memory>
#include <string>