Commit c4e4868e authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

Use std::function

Repalce old C style function pointer declaration

Bug: v8:12083
Change-Id: I0e7b0c808a7c195989cc75da5d6617d7295918f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3088357Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76285}
parent 4d073008
......@@ -2209,8 +2209,8 @@ template <typename T>
MaybeHandle<T> FormatRangeCommon(
Isolate* isolate, Handle<JSDateTimeFormat> date_time_format, double x,
double y,
MaybeHandle<T> (*formatToResult)(Isolate*, const icu::FormattedValue&,
bool*),
const std::function<MaybeHandle<T>(Isolate*, const icu::FormattedValue&,
bool*)>& formatToResult,
bool* outputRange) {
// Track newer feature formateRange and formatRangeToParts
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateTimeFormatRange);
......
......@@ -220,7 +220,8 @@ Maybe<std::vector<icu::UnicodeString>> ToUnicodeStringArray(
template <typename T>
MaybeHandle<T> FormatListCommon(
Isolate* isolate, Handle<JSListFormat> format, Handle<JSArray> list,
MaybeHandle<T> (*formatToResult)(Isolate*, const icu::FormattedValue&)) {
const std::function<MaybeHandle<T>(Isolate*, const icu::FormattedValue&)>&
formatToResult) {
DCHECK(!list->IsUndefined());
Maybe<std::vector<icu::UnicodeString>> maybe_array =
ToUnicodeStringArray(isolate, list);
......
......@@ -342,9 +342,9 @@ template <typename T>
MaybeHandle<T> FormatCommon(
Isolate* isolate, Handle<JSRelativeTimeFormat> format,
Handle<Object> value_obj, Handle<Object> unit_obj, const char* func_name,
MaybeHandle<T> (*formatToResult)(Isolate*,
const icu::FormattedRelativeDateTime&,
Handle<Object>, Handle<String>)) {
const std::function<
MaybeHandle<T>(Isolate*, const icu::FormattedRelativeDateTime&,
Handle<Object>, Handle<String>)>& formatToResult) {
// 3. Let value be ? ToNumber(value).
Handle<Object> value;
ASSIGN_RETURN_ON_EXCEPTION(isolate, value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment