Remove fml::size. (flutter/engine#54476)
std::size because standard in C++17.
This commit is contained in:
@@ -42584,7 +42584,6 @@ ORIGIN: ../../../flutter/fml/raster_thread_merger.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/raster_thread_merger.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/shared_thread_merger.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/shared_thread_merger.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/size.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/status.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/status_or.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/fml/string_conversion.cc + ../../../flutter/LICENSE
|
||||
@@ -45422,7 +45421,6 @@ FILE: ../../../flutter/fml/raster_thread_merger.cc
|
||||
FILE: ../../../flutter/fml/raster_thread_merger.h
|
||||
FILE: ../../../flutter/fml/shared_thread_merger.cc
|
||||
FILE: ../../../flutter/fml/shared_thread_merger.h
|
||||
FILE: ../../../flutter/fml/size.h
|
||||
FILE: ../../../flutter/fml/status.h
|
||||
FILE: ../../../flutter/fml/status_or.h
|
||||
FILE: ../../../flutter/fml/string_conversion.cc
|
||||
|
||||
@@ -71,7 +71,6 @@ source_set("fml") {
|
||||
"raster_thread_merger.h",
|
||||
"shared_thread_merger.cc",
|
||||
"shared_thread_merger.h",
|
||||
"size.h",
|
||||
"status.h",
|
||||
"status_or.h",
|
||||
"synchronization/atomic_object.h",
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace fml {
|
||||
@@ -198,7 +197,7 @@ TEST(CommandLineTest, CommmandLineFromIterators) {
|
||||
{
|
||||
static const char* const argv[] = {"my_program", "--flag=value", "arg"};
|
||||
|
||||
auto cl = CommandLineFromIterators(argv, argv + fml::size(argv));
|
||||
auto cl = CommandLineFromIterators(argv, argv + std::size(argv));
|
||||
EXPECT_TRUE(cl.has_argv0());
|
||||
EXPECT_EQ(argv[0], cl.argv0());
|
||||
std::vector<CommandLine::Option> expected_options = {
|
||||
@@ -212,7 +211,7 @@ TEST(CommandLineTest, CommmandLineFromIterators) {
|
||||
|
||||
TEST(CommandLineTest, CommandLineFromArgcArgv) {
|
||||
static const char* const argv[] = {"my_program", "--flag=value", "arg"};
|
||||
const int argc = static_cast<int>(fml::size(argv));
|
||||
const int argc = static_cast<int>(std::size(argv));
|
||||
|
||||
auto cl = CommandLineFromArgcArgv(argc, argv);
|
||||
EXPECT_TRUE(cl.has_argv0());
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_FML_SIZE_H_
|
||||
#define FLUTTER_FML_SIZE_H_
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace fml {
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
constexpr std::size_t size(T (&array)[N]) {
|
||||
return N;
|
||||
}
|
||||
|
||||
} // namespace fml
|
||||
|
||||
#endif // FLUTTER_FML_SIZE_H_
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "flutter/fml/cpu_affinity.h"
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "flutter/fml/mapping.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "flutter/fml/time/time_delta.h"
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "flutter/lib/ui/dart_ui.h"
|
||||
@@ -334,11 +333,11 @@ DartVM::DartVM(const std::shared_ptr<const DartVMData>& vm_data,
|
||||
args.push_back(profiler_flag);
|
||||
}
|
||||
|
||||
PushBackAll(&args, kDartAllConfigsArgs, fml::size(kDartAllConfigsArgs));
|
||||
PushBackAll(&args, kDartAllConfigsArgs, std::size(kDartAllConfigsArgs));
|
||||
|
||||
if (IsRunningPrecompiledCode()) {
|
||||
PushBackAll(&args, kDartPrecompilationArgs,
|
||||
fml::size(kDartPrecompilationArgs));
|
||||
std::size(kDartPrecompilationArgs));
|
||||
}
|
||||
|
||||
// Enable Dart assertions if we are not running precompiled code. We run non-
|
||||
@@ -356,7 +355,7 @@ DartVM::DartVM(const std::shared_ptr<const DartVMData>& vm_data,
|
||||
// Debug mode uses the JIT, disable code page write protection to avoid
|
||||
// memory page protection changes before and after every compilation.
|
||||
PushBackAll(&args, kDartWriteProtectCodeArgs,
|
||||
fml::size(kDartWriteProtectCodeArgs));
|
||||
std::size(kDartWriteProtectCodeArgs));
|
||||
#else
|
||||
const bool tracing_result = EnableTracingIfNecessary(settings_);
|
||||
// This check should only trip if the embedding made no attempts to enable
|
||||
@@ -370,38 +369,38 @@ DartVM::DartVM(const std::shared_ptr<const DartVMData>& vm_data,
|
||||
// TODO(dnfield): Remove this code
|
||||
// https://github.com/dart-lang/sdk/issues/24743
|
||||
PushBackAll(&args, kDartDisableIntegerDivisionArgs,
|
||||
fml::size(kDartDisableIntegerDivisionArgs));
|
||||
std::size(kDartDisableIntegerDivisionArgs));
|
||||
#endif // TARGET_CPU_ARM
|
||||
#endif // !FML_OS_IOS && !FML_OS_MACOSX
|
||||
#endif // (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
|
||||
|
||||
if (enable_asserts) {
|
||||
PushBackAll(&args, kDartAssertArgs, fml::size(kDartAssertArgs));
|
||||
PushBackAll(&args, kDartAssertArgs, std::size(kDartAssertArgs));
|
||||
}
|
||||
|
||||
// On low power devices with lesser number of cores, using concurrent
|
||||
// marking or sweeping causes contention for the UI thread leading to
|
||||
// Jank, this option can be used to turn off all concurrent GC activities.
|
||||
if (settings_.enable_serial_gc) {
|
||||
PushBackAll(&args, kSerialGCArgs, fml::size(kSerialGCArgs));
|
||||
PushBackAll(&args, kSerialGCArgs, std::size(kSerialGCArgs));
|
||||
}
|
||||
|
||||
if (settings_.start_paused) {
|
||||
PushBackAll(&args, kDartStartPausedArgs, fml::size(kDartStartPausedArgs));
|
||||
PushBackAll(&args, kDartStartPausedArgs, std::size(kDartStartPausedArgs));
|
||||
}
|
||||
|
||||
if (settings_.endless_trace_buffer || settings_.trace_startup) {
|
||||
// If we are tracing startup, make sure the trace buffer is endless so we
|
||||
// don't lose early traces.
|
||||
PushBackAll(&args, kDartEndlessTraceBufferArgs,
|
||||
fml::size(kDartEndlessTraceBufferArgs));
|
||||
std::size(kDartEndlessTraceBufferArgs));
|
||||
}
|
||||
|
||||
if (settings_.trace_systrace) {
|
||||
PushBackAll(&args, kDartSystraceTraceBufferArgs,
|
||||
fml::size(kDartSystraceTraceBufferArgs));
|
||||
std::size(kDartSystraceTraceBufferArgs));
|
||||
PushBackAll(&args, kDartSystraceTraceStreamsArgs,
|
||||
fml::size(kDartSystraceTraceStreamsArgs));
|
||||
std::size(kDartSystraceTraceStreamsArgs));
|
||||
}
|
||||
|
||||
std::string file_recorder_args;
|
||||
@@ -409,23 +408,23 @@ DartVM::DartVM(const std::shared_ptr<const DartVMData>& vm_data,
|
||||
file_recorder_args = DartFileRecorderArgs(settings_.trace_to_file);
|
||||
args.push_back(file_recorder_args.c_str());
|
||||
PushBackAll(&args, kDartSystraceTraceStreamsArgs,
|
||||
fml::size(kDartSystraceTraceStreamsArgs));
|
||||
std::size(kDartSystraceTraceStreamsArgs));
|
||||
}
|
||||
|
||||
if (settings_.trace_startup) {
|
||||
PushBackAll(&args, kDartStartupTraceStreamsArgs,
|
||||
fml::size(kDartStartupTraceStreamsArgs));
|
||||
std::size(kDartStartupTraceStreamsArgs));
|
||||
}
|
||||
|
||||
#if defined(OS_FUCHSIA)
|
||||
PushBackAll(&args, kDartSystraceTraceBufferArgs,
|
||||
fml::size(kDartSystraceTraceBufferArgs));
|
||||
std::size(kDartSystraceTraceBufferArgs));
|
||||
PushBackAll(&args, kDartSystraceTraceStreamsArgs,
|
||||
fml::size(kDartSystraceTraceStreamsArgs));
|
||||
std::size(kDartSystraceTraceStreamsArgs));
|
||||
#else
|
||||
if (!settings_.trace_systrace && !settings_.trace_startup) {
|
||||
PushBackAll(&args, kDartDefaultTraceStreamsArgs,
|
||||
fml::size(kDartDefaultTraceStreamsArgs));
|
||||
std::size(kDartDefaultTraceStreamsArgs));
|
||||
}
|
||||
#endif // defined(OS_FUCHSIA)
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "flutter/fml/native_library.h"
|
||||
#include "flutter/fml/paths.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "flutter/shell/version/version.h"
|
||||
|
||||
// Include once for the default enum definition.
|
||||
@@ -161,7 +160,7 @@ static std::vector<std::string> ParseCommaDelimited(const std::string& input) {
|
||||
}
|
||||
|
||||
static bool IsAllowedDartVMFlag(const std::string& flag) {
|
||||
for (uint32_t i = 0; i < fml::size(kAllowedDartFlags); ++i) {
|
||||
for (uint32_t i = 0; i < std::size(kAllowedDartFlags); ++i) {
|
||||
const std::string& allowed = kAllowedDartFlags[i];
|
||||
// Check that the prefix of the flag matches one of the allowed flags. This
|
||||
// is to handle cases where flags take arguments, such as in
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "flutter/common/graphics/persistent_cache.h"
|
||||
#include "flutter/fml/base32.h"
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "flutter/shell/common/context_options.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_gl_delegate.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "flutter/fml/paths.h"
|
||||
#include "flutter/fml/platform/android/jni_util.h"
|
||||
#include "flutter/fml/platform/android/paths_android.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "flutter/lib/ui/plugins/callback_cache.h"
|
||||
#include "flutter/runtime/dart_vm.h"
|
||||
#include "flutter/shell/common/shell.h"
|
||||
@@ -227,7 +226,7 @@ bool FlutterMain::Register(JNIEnv* env) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return env->RegisterNatives(clazz, methods, fml::size(methods)) == 0;
|
||||
return env->RegisterNatives(clazz, methods, std::size(methods)) == 0;
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "flutter/fml/platform/android/jni_util.h"
|
||||
#include "flutter/fml/platform/android/jni_weak_ref.h"
|
||||
#include "flutter/fml/platform/android/scoped_java_ref.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "flutter/lib/ui/plugins/callback_cache.h"
|
||||
#include "flutter/runtime/dart_service_isolate.h"
|
||||
#include "flutter/shell/common/run_configuration.h"
|
||||
@@ -857,7 +856,7 @@ bool RegisterApi(JNIEnv* env) {
|
||||
};
|
||||
|
||||
if (env->RegisterNatives(g_flutter_jni_class->obj(), flutter_jni_methods,
|
||||
fml::size(flutter_jni_methods)) != 0) {
|
||||
std::size(flutter_jni_methods)) != 0) {
|
||||
FML_LOG(ERROR) << "Failed to RegisterNatives with FlutterJNI";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "flutter/fml/platform/android/jni_util.h"
|
||||
#include "flutter/fml/platform/android/scoped_java_ref.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "impeller/toolkit/android/choreographer.h"
|
||||
|
||||
@@ -145,7 +144,7 @@ bool VsyncWaiterAndroid::Register(JNIEnv* env) {
|
||||
g_vsync_waiter_class->obj(), "asyncWaitForVsync", "(J)V");
|
||||
FML_CHECK(g_async_wait_for_vsync_method_ != nullptr);
|
||||
|
||||
return env->RegisterNatives(clazz, methods, fml::size(methods)) == 0;
|
||||
return env->RegisterNatives(clazz, methods, std::size(methods)) == 0;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "dart-pkg/zircon/sdk_ext/handle.h"
|
||||
#include "dart-pkg/zircon/sdk_ext/natives.h"
|
||||
#include "dart-pkg/zircon/sdk_ext/system.h"
|
||||
#include "flutter/fml/size.h"
|
||||
#include "third_party/dart/runtime/include/dart_api.h"
|
||||
#include "third_party/tonic/dart_binding_macros.h"
|
||||
#include "third_party/tonic/dart_class_library.h"
|
||||
@@ -63,7 +62,7 @@ Dart_NativeFunction NativeLookup(Dart_Handle name,
|
||||
FML_DCHECK(function_name != nullptr);
|
||||
FML_DCHECK(auto_setup_scope != nullptr);
|
||||
*auto_setup_scope = true;
|
||||
size_t num_entries = fml::size(Entries);
|
||||
size_t num_entries = std::size(Entries);
|
||||
for (size_t i = 0; i < num_entries; ++i) {
|
||||
const struct NativeEntries& entry = Entries[i];
|
||||
if (!strcmp(function_name, entry.name) &&
|
||||
@@ -77,7 +76,7 @@ Dart_NativeFunction NativeLookup(Dart_Handle name,
|
||||
}
|
||||
|
||||
const uint8_t* NativeSymbol(Dart_NativeFunction native_function) {
|
||||
size_t num_entries = fml::size(Entries);
|
||||
size_t num_entries = std::size(Entries);
|
||||
for (size_t i = 0; i < num_entries; ++i) {
|
||||
const struct NativeEntries& entry = Entries[i];
|
||||
if (entry.function == native_function) {
|
||||
|
||||
Reference in New Issue
Block a user